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> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 134 | ALC269_AMIC, |
| 135 | ALC269_DMIC, |
| 136 | ALC269VB_AMIC, |
| 137 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 138 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 139 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 140 | ALC269_AUTO, |
| 141 | ALC269_MODEL_LAST /* last tag */ |
| 142 | }; |
| 143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | /* ALC861 models */ |
| 145 | enum { |
| 146 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 147 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_3ST_DIG, |
| 149 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 150 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 151 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 152 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 153 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 154 | ALC861_AUTO, |
| 155 | ALC861_MODEL_LAST, |
| 156 | }; |
| 157 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | /* ALC861-VD models */ |
| 159 | enum { |
| 160 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 161 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 162 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_3ST, |
| 164 | ALC861VD_3ST_DIG, |
| 165 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 166 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 167 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 168 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 169 | ALC861VD_AUTO, |
| 170 | ALC861VD_MODEL_LAST, |
| 171 | }; |
| 172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | /* ALC662 models */ |
| 174 | enum { |
| 175 | ALC662_3ST_2ch_DIG, |
| 176 | ALC662_3ST_6ch_DIG, |
| 177 | ALC662_3ST_6ch, |
| 178 | ALC662_5ST_DIG, |
| 179 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 180 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 182 | ALC663_ASUS_M51VA, |
| 183 | ALC663_ASUS_G71V, |
| 184 | ALC663_ASUS_H13, |
| 185 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 186 | ALC662_ECS, |
| 187 | ALC663_ASUS_MODE1, |
| 188 | ALC662_ASUS_MODE2, |
| 189 | ALC663_ASUS_MODE3, |
| 190 | ALC663_ASUS_MODE4, |
| 191 | ALC663_ASUS_MODE5, |
| 192 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 193 | ALC663_ASUS_MODE7, |
| 194 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 195 | ALC272_DELL, |
| 196 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 197 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 198 | ALC662_AUTO, |
| 199 | ALC662_MODEL_LAST, |
| 200 | }; |
| 201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | /* ALC882 models */ |
| 203 | enum { |
| 204 | ALC882_3ST_DIG, |
| 205 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 206 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 207 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 208 | ALC882_TARGA, |
| 209 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 210 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 211 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 212 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 213 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 214 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 215 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 216 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 217 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_3ST_2ch_DIG, |
| 219 | ALC883_3ST_6ch_DIG, |
| 220 | ALC883_3ST_6ch, |
| 221 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 222 | ALC883_TARGA_DIG, |
| 223 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 224 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 225 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 226 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 231 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 232 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 233 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 234 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 235 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 237 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 239 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 240 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 241 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 242 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 243 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 244 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 245 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 246 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 247 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 248 | ALC889A_INTEL, |
| 249 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 250 | ALC888_ASUS_M90V, |
| 251 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 252 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 253 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 254 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 255 | ALC882_AUTO, |
| 256 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 257 | }; |
| 258 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 259 | /* ALC680 models */ |
| 260 | enum { |
| 261 | ALC680_BASE, |
| 262 | ALC680_AUTO, |
| 263 | ALC680_MODEL_LAST, |
| 264 | }; |
| 265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 266 | /* for GPIO Poll */ |
| 267 | #define GPIO_MASK 0x03 |
| 268 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 269 | /* extra amp-initialization sequence types */ |
| 270 | enum { |
| 271 | ALC_INIT_NONE, |
| 272 | ALC_INIT_DEFAULT, |
| 273 | ALC_INIT_GPIO1, |
| 274 | ALC_INIT_GPIO2, |
| 275 | ALC_INIT_GPIO3, |
| 276 | }; |
| 277 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 278 | struct alc_mic_route { |
| 279 | hda_nid_t pin; |
| 280 | unsigned char mux_idx; |
| 281 | unsigned char amix_idx; |
| 282 | }; |
| 283 | |
| 284 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 285 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 286 | struct alc_customize_define { |
| 287 | unsigned int sku_cfg; |
| 288 | unsigned char port_connectivity; |
| 289 | unsigned char check_sum; |
| 290 | unsigned char customization; |
| 291 | unsigned char external_amp; |
| 292 | unsigned int enable_pcbeep:1; |
| 293 | unsigned int platform_type:1; |
| 294 | unsigned int swap:1; |
| 295 | unsigned int override:1; |
| 296 | }; |
| 297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | struct alc_spec { |
| 299 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 300 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 302 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 303 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 305 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 306 | * don't forget NULL |
| 307 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 308 | */ |
| 309 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 311 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | struct hda_pcm_stream *stream_analog_playback; |
| 313 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 314 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 315 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 317 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | struct hda_pcm_stream *stream_digital_playback; |
| 319 | struct hda_pcm_stream *stream_digital_capture; |
| 320 | |
| 321 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 322 | struct hda_multi_out multiout; /* playback set-up |
| 323 | * max_channels, dacs must be set |
| 324 | * dig_out_nid and hp_nid are optional |
| 325 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 326 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 327 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 328 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
| 330 | /* capture */ |
| 331 | unsigned int num_adc_nids; |
| 332 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 333 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 334 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 336 | /* capture setup for dynamic dual-adc switch */ |
| 337 | unsigned int cur_adc_idx; |
| 338 | hda_nid_t cur_adc; |
| 339 | unsigned int cur_adc_stream_tag; |
| 340 | unsigned int cur_adc_format; |
| 341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 343 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | const struct hda_input_mux *input_mux; |
| 345 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 346 | struct alc_mic_route ext_mic; |
| 347 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | |
| 349 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 350 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 352 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 353 | int const_channel_count; |
| 354 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | |
| 356 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 357 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 359 | /* dynamic controls, init_verbs and input_mux */ |
| 360 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 361 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 362 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 363 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 364 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 365 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 366 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 367 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 368 | /* hooks */ |
| 369 | void (*init_hook)(struct hda_codec *codec); |
| 370 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 371 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 372 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 373 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 374 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 375 | /* for pin sensing */ |
| 376 | unsigned int sense_updated: 1; |
| 377 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 378 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 379 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 380 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 381 | /* other flags */ |
| 382 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 383 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 384 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 385 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 386 | /* for virtual master */ |
| 387 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 388 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 389 | struct hda_loopback_check loopback; |
| 390 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 391 | |
| 392 | /* for PLL fix */ |
| 393 | hda_nid_t pll_nid; |
| 394 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | /* |
| 398 | * configuration template - to be copied to the spec instance |
| 399 | */ |
| 400 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 401 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 402 | * with spec |
| 403 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 404 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 405 | const struct hda_verb *init_verbs[5]; |
| 406 | unsigned int num_dacs; |
| 407 | hda_nid_t *dac_nids; |
| 408 | hda_nid_t dig_out_nid; /* optional */ |
| 409 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 410 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 411 | unsigned int num_adc_nids; |
| 412 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 413 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 414 | hda_nid_t dig_in_nid; |
| 415 | unsigned int num_channel_mode; |
| 416 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 417 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 418 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 420 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 421 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 422 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 423 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 424 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 425 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 426 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 427 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | }; |
| 429 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | |
| 431 | /* |
| 432 | * input MUX handling |
| 433 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 435 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | { |
| 437 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 438 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 439 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 440 | if (mux_idx >= spec->num_mux_defs) |
| 441 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 442 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 443 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 444 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
| 452 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 453 | |
| 454 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 455 | return 0; |
| 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 463 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 465 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 466 | hda_nid_t nid = spec->capsrc_nids ? |
| 467 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 468 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 470 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 471 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 472 | if (!imux->num_items && mux_idx > 0) |
| 473 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 474 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 475 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 476 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 477 | /* Matrix-mixer style (e.g. ALC882) */ |
| 478 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 479 | unsigned int i, idx; |
| 480 | |
| 481 | idx = ucontrol->value.enumerated.item[0]; |
| 482 | if (idx >= imux->num_items) |
| 483 | idx = imux->num_items - 1; |
| 484 | if (*cur_val == idx) |
| 485 | return 0; |
| 486 | for (i = 0; i < imux->num_items; i++) { |
| 487 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 488 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 489 | imux->items[i].index, |
| 490 | HDA_AMP_MUTE, v); |
| 491 | } |
| 492 | *cur_val = idx; |
| 493 | return 1; |
| 494 | } else { |
| 495 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 496 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 497 | &spec->cur_mux[adc_idx]); |
| 498 | } |
| 499 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 500 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | /* |
| 502 | * channel mode setting |
| 503 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 504 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 505 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | { |
| 507 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 508 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 509 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 510 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | } |
| 512 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 513 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 514 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | { |
| 516 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 517 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 518 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 519 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 520 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 524 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | { |
| 526 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 528 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 529 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 530 | &spec->ext_channel_count); |
| 531 | if (err >= 0 && !spec->const_channel_count) { |
| 532 | spec->multiout.max_channels = spec->ext_channel_count; |
| 533 | if (spec->need_dac_fix) |
| 534 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 535 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 536 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | * 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] | 541 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | * being part of a format specifier. Maximum allowed length of a value is |
| 543 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 544 | * |
| 545 | * Note: some retasking pin complexes seem to ignore requests for input |
| 546 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 547 | * are requested. Therefore order this list so that this behaviour will not |
| 548 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 549 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 550 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 553 | "Mic 50pc bias", "Mic 80pc bias", |
| 554 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 555 | }; |
| 556 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 557 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | }; |
| 559 | /* 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] | 560 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 561 | * addition, "input" pins may or may not process the mic bias option |
| 562 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 563 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 564 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 565 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 566 | #define ALC_PIN_DIR_IN 0x00 |
| 567 | #define ALC_PIN_DIR_OUT 0x01 |
| 568 | #define ALC_PIN_DIR_INOUT 0x02 |
| 569 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 570 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 572 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | * For each direction the minimum and maximum values are given. |
| 574 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 575 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 577 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 578 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 579 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 580 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | }; |
| 582 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 583 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 584 | #define alc_pin_mode_n_items(_dir) \ |
| 585 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 586 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 589 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 590 | unsigned int item_num = uinfo->value.enumerated.item; |
| 591 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 592 | |
| 593 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 594 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 596 | |
| 597 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 598 | item_num = alc_pin_mode_min(dir); |
| 599 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | return 0; |
| 601 | } |
| 602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 604 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 607 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 608 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 611 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 612 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 613 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 614 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | /* Find enumerated value for current pinctl setting */ |
| 616 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 617 | 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] | 618 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 619 | *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] | 620 | return 0; |
| 621 | } |
| 622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 624 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 625 | { |
| 626 | signed int change; |
| 627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 628 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 629 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 630 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 632 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 633 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 635 | 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] | 636 | val = alc_pin_mode_min(dir); |
| 637 | |
| 638 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 639 | if (change) { |
| 640 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 641 | snd_hda_codec_write_cache(codec, nid, 0, |
| 642 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 643 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 644 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 645 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 646 | * for the requested pin mode. Enum values of 2 or less are |
| 647 | * input modes. |
| 648 | * |
| 649 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 650 | * reduces noise slightly (particularly on input) so we'll |
| 651 | * do it. However, having both input and output buffers |
| 652 | * enabled simultaneously doesn't seem to be problematic if |
| 653 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 654 | */ |
| 655 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 656 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 657 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 658 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 659 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 660 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 661 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 662 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 663 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 664 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | } |
| 666 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 667 | return change; |
| 668 | } |
| 669 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 670 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 671 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 672 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 673 | .info = alc_pin_mode_info, \ |
| 674 | .get = alc_pin_mode_get, \ |
| 675 | .put = alc_pin_mode_put, \ |
| 676 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 677 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 678 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 679 | * together using a mask with more than one bit set. This control is |
| 680 | * currently used only by the ALC260 test model. At this stage they are not |
| 681 | * needed for any "production" models. |
| 682 | */ |
| 683 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 684 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 685 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 686 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 687 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 688 | { |
| 689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 690 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 691 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 692 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 694 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 695 | |
| 696 | *valp = (val & mask) != 0; |
| 697 | return 0; |
| 698 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 700 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 701 | { |
| 702 | signed int change; |
| 703 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 704 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 705 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 706 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 708 | AC_VERB_GET_GPIO_DATA, |
| 709 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 710 | |
| 711 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 713 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | gpio_data &= ~mask; |
| 715 | else |
| 716 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 717 | snd_hda_codec_write_cache(codec, nid, 0, |
| 718 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 719 | |
| 720 | return change; |
| 721 | } |
| 722 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 723 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 724 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | .info = alc_gpio_data_info, \ |
| 726 | .get = alc_gpio_data_get, \ |
| 727 | .put = alc_gpio_data_put, \ |
| 728 | .private_value = nid | (mask<<16) } |
| 729 | #endif /* CONFIG_SND_DEBUG */ |
| 730 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 731 | /* A switch control to allow the enabling of the digital IO pins on the |
| 732 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 733 | * to provide something in the test model allowing digital outputs to be |
| 734 | * identified if present. If models are found which can utilise these |
| 735 | * outputs a more complete mixer control can be devised for those models if |
| 736 | * necessary. |
| 737 | */ |
| 738 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 739 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 740 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 741 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 742 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 743 | { |
| 744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 745 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 746 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 747 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 749 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 750 | |
| 751 | *valp = (val & mask) != 0; |
| 752 | return 0; |
| 753 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 754 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 755 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 756 | { |
| 757 | signed int change; |
| 758 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 759 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 760 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 761 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 762 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 763 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 764 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 765 | |
| 766 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 767 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 768 | if (val==0) |
| 769 | ctrl_data &= ~mask; |
| 770 | else |
| 771 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 772 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 773 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 774 | |
| 775 | return change; |
| 776 | } |
| 777 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 778 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 779 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 780 | .info = alc_spdif_ctrl_info, \ |
| 781 | .get = alc_spdif_ctrl_get, \ |
| 782 | .put = alc_spdif_ctrl_put, \ |
| 783 | .private_value = nid | (mask<<16) } |
| 784 | #endif /* CONFIG_SND_DEBUG */ |
| 785 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 786 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 787 | * Again, this is only used in the ALC26x test models to help identify when |
| 788 | * the EAPD line must be asserted for features to work. |
| 789 | */ |
| 790 | #ifdef CONFIG_SND_DEBUG |
| 791 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 792 | |
| 793 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 794 | struct snd_ctl_elem_value *ucontrol) |
| 795 | { |
| 796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 797 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 798 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 799 | long *valp = ucontrol->value.integer.value; |
| 800 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 801 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 802 | |
| 803 | *valp = (val & mask) != 0; |
| 804 | return 0; |
| 805 | } |
| 806 | |
| 807 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 808 | struct snd_ctl_elem_value *ucontrol) |
| 809 | { |
| 810 | int change; |
| 811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 812 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 813 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 814 | long val = *ucontrol->value.integer.value; |
| 815 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 816 | AC_VERB_GET_EAPD_BTLENABLE, |
| 817 | 0x00); |
| 818 | |
| 819 | /* Set/unset the masked control bit(s) as needed */ |
| 820 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 821 | if (!val) |
| 822 | ctrl_data &= ~mask; |
| 823 | else |
| 824 | ctrl_data |= mask; |
| 825 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 826 | ctrl_data); |
| 827 | |
| 828 | return change; |
| 829 | } |
| 830 | |
| 831 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 832 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 833 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 834 | .info = alc_eapd_ctrl_info, \ |
| 835 | .get = alc_eapd_ctrl_get, \ |
| 836 | .put = alc_eapd_ctrl_put, \ |
| 837 | .private_value = nid | (mask<<16) } |
| 838 | #endif /* CONFIG_SND_DEBUG */ |
| 839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 840 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 841 | * set up the input pin config (depending on the given auto-pin type) |
| 842 | */ |
| 843 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 844 | int auto_pin_type) |
| 845 | { |
| 846 | unsigned int val = PIN_IN; |
| 847 | |
| 848 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 849 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 850 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 851 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 852 | if (pincap & AC_PINCAP_VREF_80) |
| 853 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 854 | else if (pincap & AC_PINCAP_VREF_50) |
| 855 | val = PIN_VREF50; |
| 856 | else if (pincap & AC_PINCAP_VREF_100) |
| 857 | val = PIN_VREF100; |
| 858 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 859 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | } |
| 861 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 862 | } |
| 863 | |
| 864 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 865 | */ |
| 866 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 867 | { |
| 868 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 869 | return; |
| 870 | spec->mixers[spec->num_mixers++] = mix; |
| 871 | } |
| 872 | |
| 873 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 874 | { |
| 875 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 876 | return; |
| 877 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 878 | } |
| 879 | |
| 880 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | * set up from the preset table |
| 882 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 883 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 884 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 886 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | int i; |
| 888 | |
| 889 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 890 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 891 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 892 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 893 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 894 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 896 | spec->channel_mode = preset->channel_mode; |
| 897 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 898 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 899 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 900 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 901 | if (preset->const_channel_count) |
| 902 | spec->multiout.max_channels = preset->const_channel_count; |
| 903 | else |
| 904 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 905 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 906 | |
| 907 | spec->multiout.num_dacs = preset->num_dacs; |
| 908 | spec->multiout.dac_nids = preset->dac_nids; |
| 909 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 910 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 911 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 912 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 913 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 914 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 915 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 916 | spec->input_mux = preset->input_mux; |
| 917 | |
| 918 | spec->num_adc_nids = preset->num_adc_nids; |
| 919 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 920 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 922 | |
| 923 | spec->unsol_event = preset->unsol_event; |
| 924 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 925 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 926 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 927 | spec->loopback.amplist = preset->loopbacks; |
| 928 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 929 | |
| 930 | if (preset->setup) |
| 931 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 932 | } |
| 933 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 934 | /* Enable GPIO mask and set output */ |
| 935 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 939 | { } |
| 940 | }; |
| 941 | |
| 942 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 943 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 944 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 945 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 946 | { } |
| 947 | }; |
| 948 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 949 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 950 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 951 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 952 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 953 | { } |
| 954 | }; |
| 955 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 956 | /* |
| 957 | * Fix hardware PLL issue |
| 958 | * On some codecs, the analog PLL gating control must be off while |
| 959 | * the default value is 1. |
| 960 | */ |
| 961 | static void alc_fix_pll(struct hda_codec *codec) |
| 962 | { |
| 963 | struct alc_spec *spec = codec->spec; |
| 964 | unsigned int val; |
| 965 | |
| 966 | if (!spec->pll_nid) |
| 967 | return; |
| 968 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 969 | spec->pll_coef_idx); |
| 970 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 971 | AC_VERB_GET_PROC_COEF, 0); |
| 972 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 973 | spec->pll_coef_idx); |
| 974 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 975 | val & ~(1 << spec->pll_coef_bit)); |
| 976 | } |
| 977 | |
| 978 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 979 | unsigned int coef_idx, unsigned int coef_bit) |
| 980 | { |
| 981 | struct alc_spec *spec = codec->spec; |
| 982 | spec->pll_nid = nid; |
| 983 | spec->pll_coef_idx = coef_idx; |
| 984 | spec->pll_coef_bit = coef_bit; |
| 985 | alc_fix_pll(codec); |
| 986 | } |
| 987 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 988 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 989 | { |
| 990 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 991 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 992 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 994 | if (!nid) |
| 995 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 996 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 997 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 998 | nid = spec->autocfg.speaker_pins[i]; |
| 999 | if (!nid) |
| 1000 | break; |
| 1001 | snd_hda_codec_write(codec, nid, 0, |
| 1002 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1003 | spec->jack_present ? 0 : PIN_OUT); |
| 1004 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1005 | } |
| 1006 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1007 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1008 | hda_nid_t nid) |
| 1009 | { |
| 1010 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1011 | int i, nums; |
| 1012 | |
| 1013 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1014 | for (i = 0; i < nums; i++) |
| 1015 | if (conn[i] == nid) |
| 1016 | return i; |
| 1017 | return -1; |
| 1018 | } |
| 1019 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 1020 | /* switch the current ADC according to the jack state */ |
| 1021 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1022 | { |
| 1023 | struct alc_spec *spec = codec->spec; |
| 1024 | unsigned int present; |
| 1025 | hda_nid_t new_adc; |
| 1026 | |
| 1027 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1028 | if (present) |
| 1029 | spec->cur_adc_idx = 1; |
| 1030 | else |
| 1031 | spec->cur_adc_idx = 0; |
| 1032 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1033 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1034 | /* stream is running, let's swap the current ADC */ |
| 1035 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 1036 | spec->cur_adc = new_adc; |
| 1037 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1038 | spec->cur_adc_stream_tag, 0, |
| 1039 | spec->cur_adc_format); |
| 1040 | } |
| 1041 | } |
| 1042 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1043 | static void alc_mic_automute(struct hda_codec *codec) |
| 1044 | { |
| 1045 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1046 | struct alc_mic_route *dead, *alive; |
| 1047 | unsigned int present, type; |
| 1048 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1049 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1050 | if (!spec->auto_mic) |
| 1051 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1052 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1053 | return; |
| 1054 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1055 | return; |
| 1056 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 1057 | if (spec->dual_adc_switch) { |
| 1058 | alc_dual_mic_adc_auto_switch(codec); |
| 1059 | return; |
| 1060 | } |
| 1061 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1062 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1063 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1064 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1065 | if (present) { |
| 1066 | alive = &spec->ext_mic; |
| 1067 | dead = &spec->int_mic; |
| 1068 | } else { |
| 1069 | alive = &spec->int_mic; |
| 1070 | dead = &spec->ext_mic; |
| 1071 | } |
| 1072 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1073 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1074 | if (type == AC_WID_AUD_MIX) { |
| 1075 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1076 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1077 | alive->mux_idx, |
| 1078 | HDA_AMP_MUTE, 0); |
| 1079 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1080 | dead->mux_idx, |
| 1081 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1082 | } else { |
| 1083 | /* MUX style (e.g. ALC880) */ |
| 1084 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1085 | AC_VERB_SET_CONNECT_SEL, |
| 1086 | alive->mux_idx); |
| 1087 | } |
| 1088 | |
| 1089 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1090 | } |
| 1091 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1092 | /* unsolicited event for HP jack sensing */ |
| 1093 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1094 | { |
| 1095 | if (codec->vendor_id == 0x10ec0880) |
| 1096 | res >>= 28; |
| 1097 | else |
| 1098 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1099 | switch (res) { |
| 1100 | case ALC880_HP_EVENT: |
| 1101 | alc_automute_pin(codec); |
| 1102 | break; |
| 1103 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1104 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1105 | break; |
| 1106 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | static void alc_inithook(struct hda_codec *codec) |
| 1110 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1111 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1112 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1113 | } |
| 1114 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1115 | /* additional initialization for ALC888 variants */ |
| 1116 | static void alc888_coef_init(struct hda_codec *codec) |
| 1117 | { |
| 1118 | unsigned int tmp; |
| 1119 | |
| 1120 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1121 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1122 | 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] | 1123 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1124 | /* alc888S-VC */ |
| 1125 | snd_hda_codec_read(codec, 0x20, 0, |
| 1126 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1127 | else |
| 1128 | /* alc888-VB */ |
| 1129 | snd_hda_codec_read(codec, 0x20, 0, |
| 1130 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1131 | } |
| 1132 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1133 | static void alc889_coef_init(struct hda_codec *codec) |
| 1134 | { |
| 1135 | unsigned int tmp; |
| 1136 | |
| 1137 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1138 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1139 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1140 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1141 | } |
| 1142 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1143 | /* turn on/off EAPD control (only if available) */ |
| 1144 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1145 | { |
| 1146 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1147 | return; |
| 1148 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1149 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1150 | on ? 2 : 0); |
| 1151 | } |
| 1152 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1153 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1154 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1155 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1156 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1157 | switch (type) { |
| 1158 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1159 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1160 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1161 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1162 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1163 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1164 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1165 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1166 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1167 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1168 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1169 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1170 | set_eapd(codec, 0x0f, 1); |
| 1171 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1172 | break; |
| 1173 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1174 | case 0x10ec0267: |
| 1175 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1176 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1177 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1178 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1179 | case 0x10ec0660: |
| 1180 | case 0x10ec0662: |
| 1181 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1183 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1184 | set_eapd(codec, 0x14, 1); |
| 1185 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1186 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1187 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1188 | switch (codec->vendor_id) { |
| 1189 | case 0x10ec0260: |
| 1190 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1191 | AC_VERB_SET_COEF_INDEX, 7); |
| 1192 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1193 | AC_VERB_GET_PROC_COEF, 0); |
| 1194 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1195 | AC_VERB_SET_COEF_INDEX, 7); |
| 1196 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1197 | AC_VERB_SET_PROC_COEF, |
| 1198 | tmp | 0x2010); |
| 1199 | break; |
| 1200 | case 0x10ec0262: |
| 1201 | case 0x10ec0880: |
| 1202 | case 0x10ec0882: |
| 1203 | case 0x10ec0883: |
| 1204 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1205 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1206 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1207 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1208 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1209 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1210 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1211 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1212 | #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] | 1213 | case 0x10ec0267: |
| 1214 | case 0x10ec0268: |
| 1215 | snd_hda_codec_write(codec, 0x20, 0, |
| 1216 | AC_VERB_SET_COEF_INDEX, 7); |
| 1217 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1218 | AC_VERB_GET_PROC_COEF, 0); |
| 1219 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1220 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1221 | snd_hda_codec_write(codec, 0x20, 0, |
| 1222 | AC_VERB_SET_PROC_COEF, |
| 1223 | tmp | 0x3000); |
| 1224 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1225 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1226 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1227 | break; |
| 1228 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1229 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1230 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1231 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1232 | { |
| 1233 | struct alc_spec *spec = codec->spec; |
| 1234 | |
| 1235 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1236 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1237 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1238 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1239 | if (spec->autocfg.line_out_pins[0] && |
| 1240 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1241 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1242 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | else |
| 1244 | return; |
| 1245 | } |
| 1246 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1247 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1248 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1250 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1251 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1252 | spec->unsol_event = alc_sku_unsol_event; |
| 1253 | } |
| 1254 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1255 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1256 | { |
| 1257 | struct alc_spec *spec = codec->spec; |
| 1258 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1259 | hda_nid_t fixed, ext; |
| 1260 | int i; |
| 1261 | |
| 1262 | /* there must be only two mic inputs exclusively */ |
| 1263 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1264 | if (cfg->input_pins[i]) |
| 1265 | return; |
| 1266 | |
| 1267 | fixed = ext = 0; |
| 1268 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1269 | hda_nid_t nid = cfg->input_pins[i]; |
| 1270 | unsigned int defcfg; |
| 1271 | if (!nid) |
| 1272 | return; |
| 1273 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1274 | switch (get_defcfg_connect(defcfg)) { |
| 1275 | case AC_JACK_PORT_FIXED: |
| 1276 | if (fixed) |
| 1277 | return; /* already occupied */ |
| 1278 | fixed = nid; |
| 1279 | break; |
| 1280 | case AC_JACK_PORT_COMPLEX: |
| 1281 | if (ext) |
| 1282 | return; /* already occupied */ |
| 1283 | ext = nid; |
| 1284 | break; |
| 1285 | default: |
| 1286 | return; /* invalid entry */ |
| 1287 | } |
| 1288 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1289 | if (!ext || !fixed) |
| 1290 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1291 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1292 | return; /* no unsol support */ |
| 1293 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1294 | ext, fixed); |
| 1295 | spec->ext_mic.pin = ext; |
| 1296 | spec->int_mic.pin = fixed; |
| 1297 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1298 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1299 | spec->auto_mic = 1; |
| 1300 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1301 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1302 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1303 | spec->unsol_event = alc_sku_unsol_event; |
| 1304 | } |
| 1305 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1306 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1307 | { |
| 1308 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1309 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1310 | struct alc_spec *spec = codec->spec; |
| 1311 | |
| 1312 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | f189efc | 2010-07-05 17:28:17 +0200 | [diff] [blame] | 1313 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) { |
| 1314 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1315 | goto do_sku; |
Takashi Iwai | f189efc | 2010-07-05 17:28:17 +0200 | [diff] [blame] | 1316 | } |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1317 | |
| 1318 | nid = 0x1d; |
| 1319 | if (codec->vendor_id == 0x10ec0260) |
| 1320 | nid = 0x17; |
| 1321 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1322 | |
| 1323 | if (!(ass & 1)) { |
| 1324 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1325 | codec->chip_name, ass); |
| 1326 | return -1; |
| 1327 | } |
| 1328 | |
| 1329 | /* check sum */ |
| 1330 | tmp = 0; |
| 1331 | for (i = 1; i < 16; i++) { |
| 1332 | if ((ass >> i) & 1) |
| 1333 | tmp++; |
| 1334 | } |
| 1335 | if (((ass >> 16) & 0xf) != tmp) |
| 1336 | return -1; |
| 1337 | |
| 1338 | spec->cdefine.port_connectivity = ass >> 30; |
| 1339 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1340 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1341 | spec->cdefine.customization = ass >> 8; |
| 1342 | do_sku: |
| 1343 | spec->cdefine.sku_cfg = ass; |
| 1344 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1345 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1346 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1347 | spec->cdefine.override = ass & 0x1; |
| 1348 | |
| 1349 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1350 | nid, spec->cdefine.sku_cfg); |
| 1351 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1352 | spec->cdefine.port_connectivity); |
| 1353 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1354 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1355 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1356 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1357 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1358 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1359 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1360 | |
| 1361 | return 0; |
| 1362 | } |
| 1363 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1364 | /* check subsystem ID and set up device-specific initialization; |
| 1365 | * return 1 if initialized, 0 if invalid SSID |
| 1366 | */ |
| 1367 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1368 | * 31 ~ 16 : Manufacture ID |
| 1369 | * 15 ~ 8 : SKU ID |
| 1370 | * 7 ~ 0 : Assembly ID |
| 1371 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1372 | */ |
| 1373 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1374 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1375 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1376 | { |
| 1377 | unsigned int ass, tmp, i; |
| 1378 | unsigned nid; |
| 1379 | struct alc_spec *spec = codec->spec; |
| 1380 | |
| 1381 | ass = codec->subsystem_id & 0xffff; |
| 1382 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1383 | goto do_sku; |
| 1384 | |
| 1385 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1386 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1387 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | * 29~21 : reserve |
| 1389 | * 20 : PCBEEP input |
| 1390 | * 19~16 : Check sum (15:1) |
| 1391 | * 15~1 : Custom |
| 1392 | * 0 : override |
| 1393 | */ |
| 1394 | nid = 0x1d; |
| 1395 | if (codec->vendor_id == 0x10ec0260) |
| 1396 | nid = 0x17; |
| 1397 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1398 | snd_printd("realtek: No valid SSID, " |
| 1399 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1400 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1401 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1402 | return 0; |
| 1403 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1404 | return 0; |
| 1405 | |
| 1406 | /* check sum */ |
| 1407 | tmp = 0; |
| 1408 | for (i = 1; i < 16; i++) { |
| 1409 | if ((ass >> i) & 1) |
| 1410 | tmp++; |
| 1411 | } |
| 1412 | if (((ass >> 16) & 0xf) != tmp) |
| 1413 | return 0; |
| 1414 | do_sku: |
| 1415 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1416 | ass & 0xffff, codec->vendor_id); |
| 1417 | /* |
| 1418 | * 0 : override |
| 1419 | * 1 : Swap Jack |
| 1420 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1421 | * 3~5 : External Amplifier control |
| 1422 | * 7~6 : Reserved |
| 1423 | */ |
| 1424 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1425 | switch (tmp) { |
| 1426 | case 1: |
| 1427 | spec->init_amp = ALC_INIT_GPIO1; |
| 1428 | break; |
| 1429 | case 3: |
| 1430 | spec->init_amp = ALC_INIT_GPIO2; |
| 1431 | break; |
| 1432 | case 7: |
| 1433 | spec->init_amp = ALC_INIT_GPIO3; |
| 1434 | break; |
| 1435 | case 5: |
| 1436 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1437 | break; |
| 1438 | } |
| 1439 | |
| 1440 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1441 | * when the external headphone out jack is plugged" |
| 1442 | */ |
| 1443 | if (!(ass & 0x8000)) |
| 1444 | return 1; |
| 1445 | /* |
| 1446 | * 10~8 : Jack location |
| 1447 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1448 | * 14~13: Resvered |
| 1449 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1450 | * when the external headphone out jack is plugged" |
| 1451 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1452 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1453 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1454 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1455 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1456 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1457 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1458 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1459 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1460 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1461 | else if (tmp == 3) |
| 1462 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1463 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1464 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1465 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1466 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1467 | return 1; |
| 1468 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1469 | } |
| 1470 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1471 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1472 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1473 | return 1; |
| 1474 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1475 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1476 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1477 | hda_nid_t porta, hda_nid_t porte, |
| 1478 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1479 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1480 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1481 | struct alc_spec *spec = codec->spec; |
| 1482 | snd_printd("realtek: " |
| 1483 | "Enable default setup for auto mode as fallback\n"); |
| 1484 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1485 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1486 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1487 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1488 | } |
| 1489 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1490 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1491 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1492 | */ |
| 1493 | |
| 1494 | struct alc_pincfg { |
| 1495 | hda_nid_t nid; |
| 1496 | u32 val; |
| 1497 | }; |
| 1498 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1499 | struct alc_fixup { |
| 1500 | const struct alc_pincfg *pins; |
| 1501 | const struct hda_verb *verbs; |
| 1502 | }; |
| 1503 | |
| 1504 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1505 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1506 | const struct alc_fixup *fix, |
| 1507 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1508 | { |
| 1509 | const struct alc_pincfg *cfg; |
| 1510 | |
| 1511 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1512 | if (!quirk) |
| 1513 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1514 | fix += quirk->value; |
| 1515 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1516 | if (pre_init && cfg) { |
| 1517 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1518 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1519 | codec->chip_name, quirk->name); |
| 1520 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1521 | for (; cfg->nid; cfg++) |
| 1522 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1523 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1524 | if (!pre_init && fix->verbs) { |
| 1525 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1526 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1527 | codec->chip_name, quirk->name); |
| 1528 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1529 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1530 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1531 | } |
| 1532 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1533 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1534 | unsigned int coef_idx) |
| 1535 | { |
| 1536 | unsigned int val; |
| 1537 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1538 | coef_idx); |
| 1539 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1540 | AC_VERB_GET_PROC_COEF, 0); |
| 1541 | return val; |
| 1542 | } |
| 1543 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1544 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1545 | * ALC888 |
| 1546 | */ |
| 1547 | |
| 1548 | /* |
| 1549 | * 2ch mode |
| 1550 | */ |
| 1551 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1552 | /* Mic-in jack as mic in */ |
| 1553 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1554 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1555 | /* Line-in jack as Line in */ |
| 1556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1557 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1558 | /* Line-Out as Front */ |
| 1559 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1560 | { } /* end */ |
| 1561 | }; |
| 1562 | |
| 1563 | /* |
| 1564 | * 4ch mode |
| 1565 | */ |
| 1566 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1567 | /* Mic-in jack as mic in */ |
| 1568 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1569 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1570 | /* Line-in jack as Surround */ |
| 1571 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1572 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1573 | /* Line-Out as Front */ |
| 1574 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1575 | { } /* end */ |
| 1576 | }; |
| 1577 | |
| 1578 | /* |
| 1579 | * 6ch mode |
| 1580 | */ |
| 1581 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1582 | /* Mic-in jack as CLFE */ |
| 1583 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1584 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1585 | /* Line-in jack as Surround */ |
| 1586 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1587 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1588 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1589 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1590 | { } /* end */ |
| 1591 | }; |
| 1592 | |
| 1593 | /* |
| 1594 | * 8ch mode |
| 1595 | */ |
| 1596 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1597 | /* Mic-in jack as CLFE */ |
| 1598 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1599 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1600 | /* Line-in jack as Surround */ |
| 1601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1603 | /* Line-Out as Side */ |
| 1604 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1605 | { } /* end */ |
| 1606 | }; |
| 1607 | |
| 1608 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1609 | { 2, alc888_4ST_ch2_intel_init }, |
| 1610 | { 4, alc888_4ST_ch4_intel_init }, |
| 1611 | { 6, alc888_4ST_ch6_intel_init }, |
| 1612 | { 8, alc888_4ST_ch8_intel_init }, |
| 1613 | }; |
| 1614 | |
| 1615 | /* |
| 1616 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1617 | */ |
| 1618 | |
| 1619 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1620 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1621 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1622 | /* Connect Internal HP to Front */ |
| 1623 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1624 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1625 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1626 | /* Connect Bass HP to Front */ |
| 1627 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1629 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1630 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1631 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1632 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1633 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1634 | /* Connect Mic jack to CLFE */ |
| 1635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1637 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1638 | /* Connect Line-in jack to Surround */ |
| 1639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1642 | /* Connect HP out jack to Front */ |
| 1643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1644 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1645 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1646 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1647 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1648 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1649 | {} |
| 1650 | }; |
| 1651 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1652 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1653 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1654 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1655 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1656 | hda_nid_t nid; |
| 1657 | int i; |
| 1658 | |
| 1659 | spec->jack_present = 0; |
| 1660 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1661 | nid = spec->autocfg.hp_pins[i]; |
| 1662 | if (!nid) |
| 1663 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1664 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1665 | spec->jack_present = 1; |
| 1666 | break; |
| 1667 | } |
| 1668 | } |
| 1669 | |
| 1670 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1671 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1672 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1673 | nid = spec->autocfg.speaker_pins[i]; |
| 1674 | if (!nid) |
| 1675 | break; |
| 1676 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1677 | HDA_AMP_MUTE, mute); |
| 1678 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1679 | } |
| 1680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1681 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1682 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1683 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1684 | if (codec->vendor_id == 0x10ec0880) |
| 1685 | res >>= 28; |
| 1686 | else |
| 1687 | res >>= 26; |
| 1688 | if (res == ALC880_HP_EVENT) |
| 1689 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1690 | } |
| 1691 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1692 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1693 | { |
| 1694 | struct alc_spec *spec = codec->spec; |
| 1695 | |
| 1696 | spec->autocfg.hp_pins[0] = 0x15; |
| 1697 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1698 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1699 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1700 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1701 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1702 | } |
| 1703 | |
| 1704 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1705 | { |
| 1706 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1707 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1708 | } |
| 1709 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1710 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1711 | { |
| 1712 | struct alc_spec *spec = codec->spec; |
| 1713 | |
| 1714 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1715 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1716 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1717 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1718 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1719 | |
| 1720 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1721 | * ALC888 Acer Aspire 4930G model |
| 1722 | */ |
| 1723 | |
| 1724 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1725 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1726 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1727 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1729 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1730 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1731 | /* Connect Internal HP to front */ |
| 1732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1735 | /* Connect HP out to front */ |
| 1736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1739 | { } |
| 1740 | }; |
| 1741 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1742 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1743 | * ALC888 Acer Aspire 6530G model |
| 1744 | */ |
| 1745 | |
| 1746 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1747 | /* Route to built-in subwoofer as well as speakers */ |
| 1748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1749 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1752 | /* Bias voltage on for external mic port */ |
| 1753 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1754 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1755 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1758 | /* Enable unsolicited event for HP jack */ |
| 1759 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1760 | /* Enable speaker output */ |
| 1761 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1763 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1764 | /* Enable headphone output */ |
| 1765 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1766 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1767 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1768 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1769 | { } |
| 1770 | }; |
| 1771 | |
| 1772 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1773 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1774 | */ |
| 1775 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1776 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1777 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1778 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1779 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1780 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1781 | /* Enable unsolicited event for HP jack */ |
| 1782 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1783 | /* Connect Internal Front to Front */ |
| 1784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1786 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1787 | /* Connect Internal Rear to Rear */ |
| 1788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1790 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1791 | /* Connect Internal CLFE to CLFE */ |
| 1792 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1793 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1794 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1795 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1796 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1797 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1798 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1799 | /* Enable all DACs */ |
| 1800 | /* DAC DISABLE/MUTE 1? */ |
| 1801 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1802 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1803 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1804 | /* DAC DISABLE/MUTE 2? */ |
| 1805 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1806 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1807 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1808 | /* DMIC fix |
| 1809 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1810 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1811 | * makes the signal become a difference/sum signal instead of standard |
| 1812 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1813 | * codec replicate the sum signal to both channels, turning it into a |
| 1814 | * normal mono mic. |
| 1815 | */ |
| 1816 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1817 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1818 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1819 | { } |
| 1820 | }; |
| 1821 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1822 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1823 | /* Front mic only available on one ADC */ |
| 1824 | { |
| 1825 | .num_items = 4, |
| 1826 | .items = { |
| 1827 | { "Mic", 0x0 }, |
| 1828 | { "Line", 0x2 }, |
| 1829 | { "CD", 0x4 }, |
| 1830 | { "Front Mic", 0xb }, |
| 1831 | }, |
| 1832 | }, |
| 1833 | { |
| 1834 | .num_items = 3, |
| 1835 | .items = { |
| 1836 | { "Mic", 0x0 }, |
| 1837 | { "Line", 0x2 }, |
| 1838 | { "CD", 0x4 }, |
| 1839 | }, |
| 1840 | } |
| 1841 | }; |
| 1842 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1843 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1844 | /* Interal mic only available on one ADC */ |
| 1845 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1846 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1847 | .items = { |
| 1848 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1849 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1850 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1851 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1852 | { "Int Mic", 0xb }, |
| 1853 | }, |
| 1854 | }, |
| 1855 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1856 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1857 | .items = { |
| 1858 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1859 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1860 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1861 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1862 | }, |
| 1863 | } |
| 1864 | }; |
| 1865 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1866 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1867 | /* Digital mic only available on first "ADC" */ |
| 1868 | { |
| 1869 | .num_items = 5, |
| 1870 | .items = { |
| 1871 | { "Mic", 0x0 }, |
| 1872 | { "Line", 0x2 }, |
| 1873 | { "CD", 0x4 }, |
| 1874 | { "Front Mic", 0xb }, |
| 1875 | { "Input Mix", 0xa }, |
| 1876 | }, |
| 1877 | }, |
| 1878 | { |
| 1879 | .num_items = 4, |
| 1880 | .items = { |
| 1881 | { "Mic", 0x0 }, |
| 1882 | { "Line", 0x2 }, |
| 1883 | { "CD", 0x4 }, |
| 1884 | { "Input Mix", 0xa }, |
| 1885 | }, |
| 1886 | }, |
| 1887 | { |
| 1888 | .num_items = 4, |
| 1889 | .items = { |
| 1890 | { "Mic", 0x0 }, |
| 1891 | { "Line", 0x2 }, |
| 1892 | { "CD", 0x4 }, |
| 1893 | { "Input Mix", 0xa }, |
| 1894 | }, |
| 1895 | } |
| 1896 | }; |
| 1897 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1898 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1900 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1901 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1902 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1903 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1904 | HDA_OUTPUT), |
| 1905 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1906 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1907 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1908 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1909 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1912 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1913 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1914 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1915 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1917 | { } /* end */ |
| 1918 | }; |
| 1919 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1920 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1921 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1922 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1923 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1924 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1925 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1926 | HDA_OUTPUT), |
| 1927 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1928 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1929 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1931 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1933 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1935 | { } /* end */ |
| 1936 | }; |
| 1937 | |
| 1938 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1939 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1940 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1941 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1942 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1943 | spec->autocfg.hp_pins[0] = 0x15; |
| 1944 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1945 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1946 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1947 | } |
| 1948 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1949 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1950 | { |
| 1951 | struct alc_spec *spec = codec->spec; |
| 1952 | |
| 1953 | spec->autocfg.hp_pins[0] = 0x15; |
| 1954 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1955 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1956 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1957 | } |
| 1958 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1959 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1960 | { |
| 1961 | struct alc_spec *spec = codec->spec; |
| 1962 | |
| 1963 | spec->autocfg.hp_pins[0] = 0x15; |
| 1964 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1965 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1966 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1967 | } |
| 1968 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1969 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1970 | * ALC880 3-stack model |
| 1971 | * |
| 1972 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1973 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1974 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1975 | */ |
| 1976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1977 | static hda_nid_t alc880_dac_nids[4] = { |
| 1978 | /* front, rear, clfe, rear_surr */ |
| 1979 | 0x02, 0x05, 0x04, 0x03 |
| 1980 | }; |
| 1981 | |
| 1982 | static hda_nid_t alc880_adc_nids[3] = { |
| 1983 | /* ADC0-2 */ |
| 1984 | 0x07, 0x08, 0x09, |
| 1985 | }; |
| 1986 | |
| 1987 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1988 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1989 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1990 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1991 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1992 | /* ADC1-2 */ |
| 1993 | 0x08, 0x09, |
| 1994 | }; |
| 1995 | |
| 1996 | #define ALC880_DIGOUT_NID 0x06 |
| 1997 | #define ALC880_DIGIN_NID 0x0a |
| 1998 | |
| 1999 | static struct hda_input_mux alc880_capture_source = { |
| 2000 | .num_items = 4, |
| 2001 | .items = { |
| 2002 | { "Mic", 0x0 }, |
| 2003 | { "Front Mic", 0x3 }, |
| 2004 | { "Line", 0x2 }, |
| 2005 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2006 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | }; |
| 2008 | |
| 2009 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2010 | /* 2ch mode */ |
| 2011 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2012 | /* set line-in to input, mute it */ |
| 2013 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2014 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2015 | /* set mic-in to input vref 80%, mute it */ |
| 2016 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2017 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | { } /* end */ |
| 2019 | }; |
| 2020 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2021 | /* 6ch mode */ |
| 2022 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2023 | /* set line-in to output, unmute it */ |
| 2024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2026 | /* set mic-in to output, unmute it */ |
| 2027 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2028 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2029 | { } /* end */ |
| 2030 | }; |
| 2031 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2032 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2033 | { 2, alc880_threestack_ch2_init }, |
| 2034 | { 6, alc880_threestack_ch6_init }, |
| 2035 | }; |
| 2036 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2037 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2040 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2041 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2042 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2043 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2044 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2045 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2054 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2055 | { |
| 2056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2057 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2058 | .info = alc_ch_mode_info, |
| 2059 | .get = alc_ch_mode_get, |
| 2060 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2061 | }, |
| 2062 | { } /* end */ |
| 2063 | }; |
| 2064 | |
| 2065 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2066 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2067 | struct snd_ctl_elem_info *uinfo) |
| 2068 | { |
| 2069 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2070 | struct alc_spec *spec = codec->spec; |
| 2071 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2072 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2073 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2074 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2075 | HDA_INPUT); |
| 2076 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2077 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2078 | return err; |
| 2079 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2080 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2081 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2082 | unsigned int size, unsigned int __user *tlv) |
| 2083 | { |
| 2084 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2085 | struct alc_spec *spec = codec->spec; |
| 2086 | int err; |
| 2087 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2088 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2089 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2090 | HDA_INPUT); |
| 2091 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2092 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2093 | return err; |
| 2094 | } |
| 2095 | |
| 2096 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2097 | struct snd_ctl_elem_value *ucontrol); |
| 2098 | |
| 2099 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2100 | struct snd_ctl_elem_value *ucontrol, |
| 2101 | getput_call_t func) |
| 2102 | { |
| 2103 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2104 | struct alc_spec *spec = codec->spec; |
| 2105 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2106 | int err; |
| 2107 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2108 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2109 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2110 | 3, 0, HDA_INPUT); |
| 2111 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2112 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2113 | return err; |
| 2114 | } |
| 2115 | |
| 2116 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2117 | struct snd_ctl_elem_value *ucontrol) |
| 2118 | { |
| 2119 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2120 | snd_hda_mixer_amp_volume_get); |
| 2121 | } |
| 2122 | |
| 2123 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2124 | struct snd_ctl_elem_value *ucontrol) |
| 2125 | { |
| 2126 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2127 | snd_hda_mixer_amp_volume_put); |
| 2128 | } |
| 2129 | |
| 2130 | /* capture mixer elements */ |
| 2131 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2132 | |
| 2133 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2134 | struct snd_ctl_elem_value *ucontrol) |
| 2135 | { |
| 2136 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2137 | snd_hda_mixer_amp_switch_get); |
| 2138 | } |
| 2139 | |
| 2140 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2141 | struct snd_ctl_elem_value *ucontrol) |
| 2142 | { |
| 2143 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2144 | snd_hda_mixer_amp_switch_put); |
| 2145 | } |
| 2146 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2147 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2148 | { \ |
| 2149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2150 | .name = "Capture Switch", \ |
| 2151 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2152 | .count = num, \ |
| 2153 | .info = alc_cap_sw_info, \ |
| 2154 | .get = alc_cap_sw_get, \ |
| 2155 | .put = alc_cap_sw_put, \ |
| 2156 | }, \ |
| 2157 | { \ |
| 2158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2159 | .name = "Capture Volume", \ |
| 2160 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2161 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2162 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2163 | .count = num, \ |
| 2164 | .info = alc_cap_vol_info, \ |
| 2165 | .get = alc_cap_vol_get, \ |
| 2166 | .put = alc_cap_vol_put, \ |
| 2167 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2168 | } |
| 2169 | |
| 2170 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2171 | { \ |
| 2172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2173 | /* .name = "Capture Source", */ \ |
| 2174 | .name = "Input Source", \ |
| 2175 | .count = num, \ |
| 2176 | .info = alc_mux_enum_info, \ |
| 2177 | .get = alc_mux_enum_get, \ |
| 2178 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2179 | } |
| 2180 | |
| 2181 | #define DEFINE_CAPMIX(num) \ |
| 2182 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2183 | _DEFINE_CAPMIX(num), \ |
| 2184 | _DEFINE_CAPSRC(num), \ |
| 2185 | { } /* end */ \ |
| 2186 | } |
| 2187 | |
| 2188 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2189 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2190 | _DEFINE_CAPMIX(num), \ |
| 2191 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2192 | } |
| 2193 | |
| 2194 | /* up to three ADCs */ |
| 2195 | DEFINE_CAPMIX(1); |
| 2196 | DEFINE_CAPMIX(2); |
| 2197 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2198 | DEFINE_CAPMIX_NOSRC(1); |
| 2199 | DEFINE_CAPMIX_NOSRC(2); |
| 2200 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2201 | |
| 2202 | /* |
| 2203 | * ALC880 5-stack model |
| 2204 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2205 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2206 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2208 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2209 | */ |
| 2210 | |
| 2211 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2212 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2214 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2215 | { } /* end */ |
| 2216 | }; |
| 2217 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2218 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2219 | /* 6ch mode */ |
| 2220 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2221 | /* set line-in to input, mute it */ |
| 2222 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2223 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2224 | { } /* end */ |
| 2225 | }; |
| 2226 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2227 | /* 8ch mode */ |
| 2228 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2229 | /* set line-in to output, unmute it */ |
| 2230 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2231 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2232 | { } /* end */ |
| 2233 | }; |
| 2234 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2235 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | { 6, alc880_fivestack_ch6_init }, |
| 2237 | { 8, alc880_fivestack_ch8_init }, |
| 2238 | }; |
| 2239 | |
| 2240 | |
| 2241 | /* |
| 2242 | * ALC880 6-stack model |
| 2243 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2244 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2245 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2247 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2248 | */ |
| 2249 | |
| 2250 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2251 | /* front, rear, clfe, rear_surr */ |
| 2252 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2253 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2254 | |
| 2255 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2256 | .num_items = 4, |
| 2257 | .items = { |
| 2258 | { "Mic", 0x0 }, |
| 2259 | { "Front Mic", 0x1 }, |
| 2260 | { "Line", 0x2 }, |
| 2261 | { "CD", 0x4 }, |
| 2262 | }, |
| 2263 | }; |
| 2264 | |
| 2265 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2266 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2267 | { 8, NULL }, |
| 2268 | }; |
| 2269 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2270 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2272 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2273 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2274 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2276 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2277 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2278 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2279 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2280 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2287 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2288 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2289 | { |
| 2290 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2291 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2292 | .info = alc_ch_mode_info, |
| 2293 | .get = alc_ch_mode_get, |
| 2294 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2295 | }, |
| 2296 | { } /* end */ |
| 2297 | }; |
| 2298 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2299 | |
| 2300 | /* |
| 2301 | * ALC880 W810 model |
| 2302 | * |
| 2303 | * W810 has rear IO for: |
| 2304 | * Front (DAC 02) |
| 2305 | * Surround (DAC 03) |
| 2306 | * Center/LFE (DAC 04) |
| 2307 | * Digital out (06) |
| 2308 | * |
| 2309 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2310 | * 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] | 2311 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2312 | * There is a variable resistor to control the speaker or headphone |
| 2313 | * volume. This is a hardware-only device without a software API. |
| 2314 | * |
| 2315 | * Plugging headphones in will disable the internal speakers. This is |
| 2316 | * implemented in hardware, not via the driver using jack sense. In |
| 2317 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2318 | * disable both the speakers and headphones. |
| 2319 | * |
| 2320 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2321 | * These may not do anything useful with this driver yet, because I |
| 2322 | * haven't setup any initialization verbs for these yet... |
| 2323 | */ |
| 2324 | |
| 2325 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2326 | /* front, rear/surround, clfe */ |
| 2327 | 0x02, 0x03, 0x04 |
| 2328 | }; |
| 2329 | |
| 2330 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2331 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2332 | { 6, NULL } |
| 2333 | }; |
| 2334 | |
| 2335 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2336 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2337 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2338 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2340 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2341 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2342 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2343 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2344 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2345 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2346 | { } /* end */ |
| 2347 | }; |
| 2348 | |
| 2349 | |
| 2350 | /* |
| 2351 | * Z710V model |
| 2352 | * |
| 2353 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2354 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2355 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2356 | */ |
| 2357 | |
| 2358 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2359 | 0x02 |
| 2360 | }; |
| 2361 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2362 | |
| 2363 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2364 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2365 | { 2, NULL } |
| 2366 | }; |
| 2367 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2368 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +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 | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2371 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2372 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2374 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2376 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2377 | { } /* end */ |
| 2378 | }; |
| 2379 | |
| 2380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2381 | /* |
| 2382 | * ALC880 F1734 model |
| 2383 | * |
| 2384 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2385 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2386 | */ |
| 2387 | |
| 2388 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2389 | 0x03 |
| 2390 | }; |
| 2391 | #define ALC880_F1734_HP_DAC 0x02 |
| 2392 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2393 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2394 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2395 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2396 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2397 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2402 | { } /* end */ |
| 2403 | }; |
| 2404 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2405 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2406 | .num_items = 2, |
| 2407 | .items = { |
| 2408 | { "Mic", 0x1 }, |
| 2409 | { "CD", 0x4 }, |
| 2410 | }, |
| 2411 | }; |
| 2412 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* |
| 2415 | * ALC880 ASUS model |
| 2416 | * |
| 2417 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2418 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2419 | * Mic = 0x18, Line = 0x1a |
| 2420 | */ |
| 2421 | |
| 2422 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2423 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2424 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2425 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2426 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2427 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2428 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2429 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2430 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2431 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2432 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2433 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2434 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2435 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2438 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2439 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2440 | { |
| 2441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2442 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2443 | .info = alc_ch_mode_info, |
| 2444 | .get = alc_ch_mode_get, |
| 2445 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2446 | }, |
| 2447 | { } /* end */ |
| 2448 | }; |
| 2449 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2450 | /* |
| 2451 | * ALC880 ASUS W1V model |
| 2452 | * |
| 2453 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2454 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2455 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2456 | */ |
| 2457 | |
| 2458 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2459 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2460 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2461 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2462 | { } /* end */ |
| 2463 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2465 | /* TCL S700 */ |
| 2466 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2468 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2474 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2475 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2479 | /* Uniwill */ |
| 2480 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2481 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2482 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2483 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2484 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2490 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2491 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2492 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2495 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2496 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2497 | { |
| 2498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2499 | .name = "Channel Mode", |
| 2500 | .info = alc_ch_mode_info, |
| 2501 | .get = alc_ch_mode_get, |
| 2502 | .put = alc_ch_mode_put, |
| 2503 | }, |
| 2504 | { } /* end */ |
| 2505 | }; |
| 2506 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2507 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2508 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2509 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2510 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2511 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2512 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2513 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2514 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2515 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2516 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2517 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2518 | { } /* end */ |
| 2519 | }; |
| 2520 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2521 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2522 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2523 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2524 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2525 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2528 | { } /* end */ |
| 2529 | }; |
| 2530 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2531 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2532 | * virtual master controls |
| 2533 | */ |
| 2534 | |
| 2535 | /* |
| 2536 | * slave controls for virtual master |
| 2537 | */ |
| 2538 | static const char *alc_slave_vols[] = { |
| 2539 | "Front Playback Volume", |
| 2540 | "Surround Playback Volume", |
| 2541 | "Center Playback Volume", |
| 2542 | "LFE Playback Volume", |
| 2543 | "Side Playback Volume", |
| 2544 | "Headphone Playback Volume", |
| 2545 | "Speaker Playback Volume", |
| 2546 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2547 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2548 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2549 | NULL, |
| 2550 | }; |
| 2551 | |
| 2552 | static const char *alc_slave_sws[] = { |
| 2553 | "Front Playback Switch", |
| 2554 | "Surround Playback Switch", |
| 2555 | "Center Playback Switch", |
| 2556 | "LFE Playback Switch", |
| 2557 | "Side Playback Switch", |
| 2558 | "Headphone Playback Switch", |
| 2559 | "Speaker Playback Switch", |
| 2560 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2561 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2562 | "Line-Out Playback Switch", |
| 2563 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2564 | NULL, |
| 2565 | }; |
| 2566 | |
| 2567 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2569 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2570 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2571 | #define NID_MAPPING (-1) |
| 2572 | |
| 2573 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2574 | #define SUBDEV_HP_ (1 << 6) |
| 2575 | #define SUBDEV_LINE_ (2 << 6) |
| 2576 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2577 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2578 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2579 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2580 | static void alc_free_kctls(struct hda_codec *codec); |
| 2581 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2582 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2583 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2584 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2585 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2586 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2587 | { } /* end */ |
| 2588 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2589 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2590 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2591 | static int alc_build_controls(struct hda_codec *codec) |
| 2592 | { |
| 2593 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2594 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2595 | struct snd_kcontrol_new *knew; |
| 2596 | int i, j, err; |
| 2597 | unsigned int u; |
| 2598 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | |
| 2600 | for (i = 0; i < spec->num_mixers; i++) { |
| 2601 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2602 | if (err < 0) |
| 2603 | return err; |
| 2604 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2605 | if (spec->cap_mixer) { |
| 2606 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2607 | if (err < 0) |
| 2608 | return err; |
| 2609 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2610 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2611 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2612 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2613 | if (err < 0) |
| 2614 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2615 | if (!spec->no_analog) { |
| 2616 | err = snd_hda_create_spdif_share_sw(codec, |
| 2617 | &spec->multiout); |
| 2618 | if (err < 0) |
| 2619 | return err; |
| 2620 | spec->multiout.share_spdif = 1; |
| 2621 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2622 | } |
| 2623 | if (spec->dig_in_nid) { |
| 2624 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2625 | if (err < 0) |
| 2626 | return err; |
| 2627 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2628 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2629 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2630 | /* create beep controls if needed */ |
| 2631 | if (spec->beep_amp) { |
| 2632 | struct snd_kcontrol_new *knew; |
| 2633 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2634 | struct snd_kcontrol *kctl; |
| 2635 | kctl = snd_ctl_new1(knew, codec); |
| 2636 | if (!kctl) |
| 2637 | return -ENOMEM; |
| 2638 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2639 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2640 | if (err < 0) |
| 2641 | return err; |
| 2642 | } |
| 2643 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2644 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2645 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2646 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2647 | if (!spec->no_analog && |
| 2648 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2649 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2650 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2651 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2652 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2653 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2654 | if (err < 0) |
| 2655 | return err; |
| 2656 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2657 | if (!spec->no_analog && |
| 2658 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2659 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2660 | NULL, alc_slave_sws); |
| 2661 | if (err < 0) |
| 2662 | return err; |
| 2663 | } |
| 2664 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2665 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2666 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2667 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2668 | if (!kctl) |
| 2669 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2670 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2671 | hda_nid_t *nids = spec->capsrc_nids; |
| 2672 | if (!nids) |
| 2673 | nids = spec->adc_nids; |
| 2674 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2675 | if (err < 0) |
| 2676 | return err; |
| 2677 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2678 | } |
| 2679 | if (spec->cap_mixer) { |
| 2680 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2681 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2682 | if (kname && strcmp(knew->name, kname) == 0) |
| 2683 | continue; |
| 2684 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2685 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2686 | err = snd_hda_add_nid(codec, kctl, i, |
| 2687 | spec->adc_nids[i]); |
| 2688 | if (err < 0) |
| 2689 | return err; |
| 2690 | } |
| 2691 | } |
| 2692 | } |
| 2693 | |
| 2694 | /* other nid->control mapping */ |
| 2695 | for (i = 0; i < spec->num_mixers; i++) { |
| 2696 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2697 | if (knew->iface != NID_MAPPING) |
| 2698 | continue; |
| 2699 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2700 | if (kctl == NULL) |
| 2701 | continue; |
| 2702 | u = knew->subdevice; |
| 2703 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2704 | nid = u & 0x3f; |
| 2705 | if (nid == 0) |
| 2706 | continue; |
| 2707 | switch (u & 0xc0) { |
| 2708 | case SUBDEV_SPEAKER_: |
| 2709 | nid = spec->autocfg.speaker_pins[nid]; |
| 2710 | break; |
| 2711 | case SUBDEV_LINE_: |
| 2712 | nid = spec->autocfg.line_out_pins[nid]; |
| 2713 | break; |
| 2714 | case SUBDEV_HP_: |
| 2715 | nid = spec->autocfg.hp_pins[nid]; |
| 2716 | break; |
| 2717 | default: |
| 2718 | continue; |
| 2719 | } |
| 2720 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2721 | if (err < 0) |
| 2722 | return err; |
| 2723 | } |
| 2724 | u = knew->private_value; |
| 2725 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2726 | nid = u & 0xff; |
| 2727 | if (nid == 0) |
| 2728 | continue; |
| 2729 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2730 | if (err < 0) |
| 2731 | return err; |
| 2732 | } |
| 2733 | } |
| 2734 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2735 | |
| 2736 | alc_free_kctls(codec); /* no longer needed */ |
| 2737 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2738 | return 0; |
| 2739 | } |
| 2740 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2741 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2742 | /* |
| 2743 | * initialize the codec volumes, etc |
| 2744 | */ |
| 2745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | /* |
| 2747 | * generic initialization of ADC, input mixers and output mixers |
| 2748 | */ |
| 2749 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2750 | /* |
| 2751 | * Unmute ADC0-2 and set the default input to mic-in |
| 2752 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2753 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2755 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2759 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2760 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2761 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2762 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2763 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2764 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2765 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2773 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | /* |
| 2775 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2776 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | /* set vol=0 to output mixers */ |
| 2778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2782 | /* set up input amps for analog loopback */ |
| 2783 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2791 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2792 | |
| 2793 | { } |
| 2794 | }; |
| 2795 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | /* |
| 2797 | * 3-stack pin configuration: |
| 2798 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2799 | */ |
| 2800 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2801 | /* |
| 2802 | * preset connection lists of input pins |
| 2803 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2804 | */ |
| 2805 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2806 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2807 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2808 | |
| 2809 | /* |
| 2810 | * Set pin mode and muting |
| 2811 | */ |
| 2812 | /* set front pin widgets 0x14 for output */ |
| 2813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2814 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2815 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2818 | /* Mic2 (as headphone out) for HP output */ |
| 2819 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2821 | /* Line In pin widget for input */ |
| 2822 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2823 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2824 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2827 | /* CD pin widget for input */ |
| 2828 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2829 | |
| 2830 | { } |
| 2831 | }; |
| 2832 | |
| 2833 | /* |
| 2834 | * 5-stack pin configuration: |
| 2835 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2836 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2837 | */ |
| 2838 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2839 | /* |
| 2840 | * preset connection lists of input pins |
| 2841 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2842 | */ |
| 2843 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2844 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2845 | |
| 2846 | /* |
| 2847 | * Set pin mode and muting |
| 2848 | */ |
| 2849 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2852 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2853 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2854 | /* unmute pins for output (no gain on this amp) */ |
| 2855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2856 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2857 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2858 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2860 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2861 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2862 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2863 | /* Mic2 (as headphone out) for HP output */ |
| 2864 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2865 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | /* Line In pin widget for input */ |
| 2867 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2868 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2869 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2870 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2871 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2872 | /* CD pin widget for input */ |
| 2873 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2874 | |
| 2875 | { } |
| 2876 | }; |
| 2877 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2878 | /* |
| 2879 | * W810 pin configuration: |
| 2880 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2881 | */ |
| 2882 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2883 | /* hphone/speaker input selector: front DAC */ |
| 2884 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2885 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2888 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2890 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2891 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2892 | |
| 2893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2894 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | { } |
| 2897 | }; |
| 2898 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2899 | /* |
| 2900 | * Z71V pin configuration: |
| 2901 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2902 | */ |
| 2903 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2906 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2908 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2909 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2911 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2912 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2913 | |
| 2914 | { } |
| 2915 | }; |
| 2916 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2917 | /* |
| 2918 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2919 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2920 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | */ |
| 2922 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2923 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2924 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2929 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2931 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2933 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2934 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2936 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2937 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2938 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2942 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2943 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2944 | { } |
| 2945 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2946 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2947 | /* |
| 2948 | * Uniwill pin configuration: |
| 2949 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2950 | * line = 0x1a |
| 2951 | */ |
| 2952 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2953 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2954 | |
| 2955 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2958 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2960 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2961 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2962 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2966 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2968 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2969 | |
| 2970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2972 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2974 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2976 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2977 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2978 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2979 | |
| 2980 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2981 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2982 | |
| 2983 | { } |
| 2984 | }; |
| 2985 | |
| 2986 | /* |
| 2987 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2988 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2989 | */ |
| 2990 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2991 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2992 | |
| 2993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2997 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2998 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3000 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3001 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3002 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3005 | |
| 3006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3007 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3008 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3009 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3010 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3012 | |
| 3013 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3014 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3015 | |
| 3016 | { } |
| 3017 | }; |
| 3018 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3019 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3020 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3021 | { } |
| 3022 | }; |
| 3023 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3024 | /* auto-toggle front mic */ |
| 3025 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3026 | { |
| 3027 | unsigned int present; |
| 3028 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3029 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3030 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3031 | bits = present ? HDA_AMP_MUTE : 0; |
| 3032 | 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] | 3033 | } |
| 3034 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3035 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3036 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3037 | struct alc_spec *spec = codec->spec; |
| 3038 | |
| 3039 | spec->autocfg.hp_pins[0] = 0x14; |
| 3040 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3041 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3042 | } |
| 3043 | |
| 3044 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3045 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3046 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3047 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3048 | } |
| 3049 | |
| 3050 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3051 | unsigned int res) |
| 3052 | { |
| 3053 | /* Looks like the unsol event is incompatible with the standard |
| 3054 | * definition. 4bit tag is placed at 28 bit! |
| 3055 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3056 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3057 | case ALC880_MIC_EVENT: |
| 3058 | alc880_uniwill_mic_automute(codec); |
| 3059 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3060 | default: |
| 3061 | alc_automute_amp_unsol_event(codec, res); |
| 3062 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3063 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3064 | } |
| 3065 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3066 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3067 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3068 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3069 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3070 | spec->autocfg.hp_pins[0] = 0x14; |
| 3071 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3072 | } |
| 3073 | |
| 3074 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3075 | { |
| 3076 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3077 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3078 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3079 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3080 | present &= HDA_AMP_VOLMASK; |
| 3081 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3082 | HDA_AMP_VOLMASK, present); |
| 3083 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3084 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3085 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3086 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3087 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3088 | unsigned int res) |
| 3089 | { |
| 3090 | /* Looks like the unsol event is incompatible with the standard |
| 3091 | * definition. 4bit tag is placed at 28 bit! |
| 3092 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3093 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3094 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3095 | else |
| 3096 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3097 | } |
| 3098 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | /* |
| 3100 | * F1734 pin configuration: |
| 3101 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3102 | */ |
| 3103 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3104 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3106 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3107 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3108 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3109 | |
| 3110 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3114 | |
| 3115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3116 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3117 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3120 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3123 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3124 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3125 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3126 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3127 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | { } |
| 3129 | }; |
| 3130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | /* |
| 3132 | * ASUS pin configuration: |
| 3133 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3134 | */ |
| 3135 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3136 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3137 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3138 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3139 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3140 | |
| 3141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3144 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3147 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3148 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3149 | |
| 3150 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3151 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3152 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3155 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3157 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3158 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3159 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3160 | { } |
| 3161 | }; |
| 3162 | |
| 3163 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3164 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3165 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3166 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3168 | /* Clevo m520g init */ |
| 3169 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3170 | /* headphone output */ |
| 3171 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3172 | /* line-out */ |
| 3173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3175 | /* Line-in */ |
| 3176 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3178 | /* CD */ |
| 3179 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3180 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3181 | /* Mic1 (rear panel) */ |
| 3182 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3183 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3184 | /* Mic2 (front panel) */ |
| 3185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3186 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | /* headphone */ |
| 3188 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3189 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | /* change to EAPD mode */ |
| 3191 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3192 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3193 | |
| 3194 | { } |
| 3195 | }; |
| 3196 | |
| 3197 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3198 | /* change to EAPD mode */ |
| 3199 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3200 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3202 | /* Headphone output */ |
| 3203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3204 | /* Front output*/ |
| 3205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3206 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3207 | |
| 3208 | /* Line In pin widget for input */ |
| 3209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3210 | /* CD pin widget for input */ |
| 3211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3213 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3214 | |
| 3215 | /* change to EAPD mode */ |
| 3216 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3217 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3218 | |
| 3219 | { } |
| 3220 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | |
| 3222 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3223 | * LG m1 express dual |
| 3224 | * |
| 3225 | * Pin assignment: |
| 3226 | * Rear Line-In/Out (blue): 0x14 |
| 3227 | * Build-in Mic-In: 0x15 |
| 3228 | * Speaker-out: 0x17 |
| 3229 | * HP-Out (green): 0x1b |
| 3230 | * Mic-In/Out (red): 0x19 |
| 3231 | * SPDIF-Out: 0x1e |
| 3232 | */ |
| 3233 | |
| 3234 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3235 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3236 | 0x05, 0x02, 0x03 |
| 3237 | }; |
| 3238 | |
| 3239 | /* seems analog CD is not working */ |
| 3240 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3241 | .num_items = 3, |
| 3242 | .items = { |
| 3243 | { "Mic", 0x1 }, |
| 3244 | { "Line", 0x5 }, |
| 3245 | { "Internal Mic", 0x6 }, |
| 3246 | }, |
| 3247 | }; |
| 3248 | |
| 3249 | /* 2,4,6 channel modes */ |
| 3250 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3251 | /* set line-in and mic-in to input */ |
| 3252 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3253 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3254 | { } |
| 3255 | }; |
| 3256 | |
| 3257 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3258 | /* set line-in to out and mic-in to input */ |
| 3259 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3260 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3261 | { } |
| 3262 | }; |
| 3263 | |
| 3264 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3265 | /* set line-in and mic-in to output */ |
| 3266 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3267 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3268 | { } |
| 3269 | }; |
| 3270 | |
| 3271 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3272 | { 2, alc880_lg_ch2_init }, |
| 3273 | { 4, alc880_lg_ch4_init }, |
| 3274 | { 6, alc880_lg_ch6_init }, |
| 3275 | }; |
| 3276 | |
| 3277 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3279 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3280 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3281 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3282 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3283 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3284 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3285 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3288 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3289 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3290 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3291 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3292 | { |
| 3293 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3294 | .name = "Channel Mode", |
| 3295 | .info = alc_ch_mode_info, |
| 3296 | .get = alc_ch_mode_get, |
| 3297 | .put = alc_ch_mode_put, |
| 3298 | }, |
| 3299 | { } /* end */ |
| 3300 | }; |
| 3301 | |
| 3302 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3303 | /* set capture source to mic-in */ |
| 3304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3305 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3306 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3307 | /* mute all amp mixer inputs */ |
| 3308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3311 | /* line-in to input */ |
| 3312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3313 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3314 | /* built-in mic */ |
| 3315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3317 | /* speaker-out */ |
| 3318 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3319 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3320 | /* mic-in to input */ |
| 3321 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3322 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3323 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3324 | /* HP-out */ |
| 3325 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3326 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3328 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3330 | { } |
| 3331 | }; |
| 3332 | |
| 3333 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3334 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3335 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3336 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3337 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3338 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3339 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3340 | } |
| 3341 | |
| 3342 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3343 | * LG LW20 |
| 3344 | * |
| 3345 | * Pin assignment: |
| 3346 | * Speaker-out: 0x14 |
| 3347 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3348 | * Built-in Mic-In: 0x19 |
| 3349 | * Line-In: 0x1b |
| 3350 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3351 | * SPDIF-Out: 0x1e |
| 3352 | */ |
| 3353 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3354 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3355 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3356 | .items = { |
| 3357 | { "Mic", 0x0 }, |
| 3358 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3359 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3360 | }, |
| 3361 | }; |
| 3362 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3363 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3364 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3365 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3366 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3367 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3368 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3369 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3370 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3371 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3372 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3373 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3378 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3379 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3380 | { |
| 3381 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3382 | .name = "Channel Mode", |
| 3383 | .info = alc_ch_mode_info, |
| 3384 | .get = alc_ch_mode_get, |
| 3385 | .put = alc_ch_mode_put, |
| 3386 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3387 | { } /* end */ |
| 3388 | }; |
| 3389 | |
| 3390 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3391 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3392 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3393 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3394 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3395 | /* set capture source to mic-in */ |
| 3396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3398 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3400 | /* speaker-out */ |
| 3401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3402 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3403 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3404 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3405 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3406 | /* mic-in to input */ |
| 3407 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3408 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3409 | /* built-in mic */ |
| 3410 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3412 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3413 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3414 | { } |
| 3415 | }; |
| 3416 | |
| 3417 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3418 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3419 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3420 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3421 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3422 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3423 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3424 | } |
| 3425 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3426 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3427 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3428 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3431 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3432 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3433 | { } /* end */ |
| 3434 | }; |
| 3435 | |
| 3436 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3437 | .num_items = 2, |
| 3438 | .items = { |
| 3439 | { "Mic", 0x0 }, |
| 3440 | { "Internal Mic", 0x1 }, |
| 3441 | }, |
| 3442 | }; |
| 3443 | |
| 3444 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3445 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3446 | |
| 3447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3449 | |
| 3450 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3451 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3452 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3453 | /* Mic2 (as headphone out) for HP output */ |
| 3454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3455 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3456 | /* Internal Speaker */ |
| 3457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3458 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3459 | |
| 3460 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3461 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3462 | |
| 3463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3464 | { } |
| 3465 | }; |
| 3466 | |
| 3467 | /* toggle speaker-output according to the hp-jack state */ |
| 3468 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3469 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3470 | struct alc_spec *spec = codec->spec; |
| 3471 | alc_automute_amp(codec); |
| 3472 | /* toggle EAPD */ |
| 3473 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3474 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3475 | else |
| 3476 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3477 | } |
| 3478 | |
| 3479 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3480 | unsigned int res) |
| 3481 | { |
| 3482 | /* Looks like the unsol event is incompatible with the standard |
| 3483 | * definition. 4bit tag is placed at 28 bit! |
| 3484 | */ |
| 3485 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3486 | alc880_medion_rim_automute(codec); |
| 3487 | } |
| 3488 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3489 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3490 | { |
| 3491 | struct alc_spec *spec = codec->spec; |
| 3492 | |
| 3493 | spec->autocfg.hp_pins[0] = 0x14; |
| 3494 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3495 | } |
| 3496 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3497 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3498 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3499 | { 0x0b, HDA_INPUT, 0 }, |
| 3500 | { 0x0b, HDA_INPUT, 1 }, |
| 3501 | { 0x0b, HDA_INPUT, 2 }, |
| 3502 | { 0x0b, HDA_INPUT, 3 }, |
| 3503 | { 0x0b, HDA_INPUT, 4 }, |
| 3504 | { } /* end */ |
| 3505 | }; |
| 3506 | |
| 3507 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3508 | { 0x0b, HDA_INPUT, 1 }, |
| 3509 | { 0x0b, HDA_INPUT, 6 }, |
| 3510 | { 0x0b, HDA_INPUT, 7 }, |
| 3511 | { } /* end */ |
| 3512 | }; |
| 3513 | #endif |
| 3514 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3515 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3516 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3517 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3518 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3519 | static int alc_init(struct hda_codec *codec) |
| 3520 | { |
| 3521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3522 | unsigned int i; |
| 3523 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3524 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3525 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3526 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3528 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3529 | |
| 3530 | if (spec->init_hook) |
| 3531 | spec->init_hook(codec); |
| 3532 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3534 | if (codec->patch_ops.check_power_status) |
| 3535 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3536 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3537 | return 0; |
| 3538 | } |
| 3539 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3540 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3541 | { |
| 3542 | struct alc_spec *spec = codec->spec; |
| 3543 | |
| 3544 | if (spec->unsol_event) |
| 3545 | spec->unsol_event(codec, res); |
| 3546 | } |
| 3547 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3549 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3550 | { |
| 3551 | struct alc_spec *spec = codec->spec; |
| 3552 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3553 | } |
| 3554 | #endif |
| 3555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3556 | /* |
| 3557 | * Analog playback callbacks |
| 3558 | */ |
| 3559 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3560 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3561 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3562 | { |
| 3563 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3564 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3565 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3566 | } |
| 3567 | |
| 3568 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3569 | struct hda_codec *codec, |
| 3570 | unsigned int stream_tag, |
| 3571 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3572 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3573 | { |
| 3574 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3575 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3576 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3577 | } |
| 3578 | |
| 3579 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3580 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3581 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3582 | { |
| 3583 | struct alc_spec *spec = codec->spec; |
| 3584 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3585 | } |
| 3586 | |
| 3587 | /* |
| 3588 | * Digital out |
| 3589 | */ |
| 3590 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3591 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3592 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3593 | { |
| 3594 | struct alc_spec *spec = codec->spec; |
| 3595 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3596 | } |
| 3597 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3598 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3599 | struct hda_codec *codec, |
| 3600 | unsigned int stream_tag, |
| 3601 | unsigned int format, |
| 3602 | struct snd_pcm_substream *substream) |
| 3603 | { |
| 3604 | struct alc_spec *spec = codec->spec; |
| 3605 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3606 | stream_tag, format, substream); |
| 3607 | } |
| 3608 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3609 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3610 | struct hda_codec *codec, |
| 3611 | struct snd_pcm_substream *substream) |
| 3612 | { |
| 3613 | struct alc_spec *spec = codec->spec; |
| 3614 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3615 | } |
| 3616 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3617 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3618 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3619 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3620 | { |
| 3621 | struct alc_spec *spec = codec->spec; |
| 3622 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3623 | } |
| 3624 | |
| 3625 | /* |
| 3626 | * Analog capture |
| 3627 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3628 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3629 | struct hda_codec *codec, |
| 3630 | unsigned int stream_tag, |
| 3631 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3632 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3633 | { |
| 3634 | struct alc_spec *spec = codec->spec; |
| 3635 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3636 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3637 | stream_tag, 0, format); |
| 3638 | return 0; |
| 3639 | } |
| 3640 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3641 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3642 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3643 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | { |
| 3645 | struct alc_spec *spec = codec->spec; |
| 3646 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3647 | snd_hda_codec_cleanup_stream(codec, |
| 3648 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3649 | return 0; |
| 3650 | } |
| 3651 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 3652 | /* analog capture with dynamic dual-adc changes */ |
| 3653 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3654 | struct hda_codec *codec, |
| 3655 | unsigned int stream_tag, |
| 3656 | unsigned int format, |
| 3657 | struct snd_pcm_substream *substream) |
| 3658 | { |
| 3659 | struct alc_spec *spec = codec->spec; |
| 3660 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3661 | spec->cur_adc_stream_tag = stream_tag; |
| 3662 | spec->cur_adc_format = format; |
| 3663 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3664 | return 0; |
| 3665 | } |
| 3666 | |
| 3667 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3668 | struct hda_codec *codec, |
| 3669 | struct snd_pcm_substream *substream) |
| 3670 | { |
| 3671 | struct alc_spec *spec = codec->spec; |
| 3672 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3673 | spec->cur_adc = 0; |
| 3674 | return 0; |
| 3675 | } |
| 3676 | |
| 3677 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3678 | .substreams = 1, |
| 3679 | .channels_min = 2, |
| 3680 | .channels_max = 2, |
| 3681 | .nid = 0, /* fill later */ |
| 3682 | .ops = { |
| 3683 | .prepare = dualmic_capture_pcm_prepare, |
| 3684 | .cleanup = dualmic_capture_pcm_cleanup |
| 3685 | }, |
| 3686 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3687 | |
| 3688 | /* |
| 3689 | */ |
| 3690 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3691 | .substreams = 1, |
| 3692 | .channels_min = 2, |
| 3693 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3694 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3695 | .ops = { |
| 3696 | .open = alc880_playback_pcm_open, |
| 3697 | .prepare = alc880_playback_pcm_prepare, |
| 3698 | .cleanup = alc880_playback_pcm_cleanup |
| 3699 | }, |
| 3700 | }; |
| 3701 | |
| 3702 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3703 | .substreams = 1, |
| 3704 | .channels_min = 2, |
| 3705 | .channels_max = 2, |
| 3706 | /* NID is set in alc_build_pcms */ |
| 3707 | }; |
| 3708 | |
| 3709 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3710 | .substreams = 1, |
| 3711 | .channels_min = 2, |
| 3712 | .channels_max = 2, |
| 3713 | /* NID is set in alc_build_pcms */ |
| 3714 | }; |
| 3715 | |
| 3716 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3717 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3718 | .channels_min = 2, |
| 3719 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3720 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3721 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3722 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3723 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3724 | }, |
| 3725 | }; |
| 3726 | |
| 3727 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3728 | .substreams = 1, |
| 3729 | .channels_min = 2, |
| 3730 | .channels_max = 2, |
| 3731 | /* NID is set in alc_build_pcms */ |
| 3732 | .ops = { |
| 3733 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3734 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3735 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3736 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3737 | }, |
| 3738 | }; |
| 3739 | |
| 3740 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3741 | .substreams = 1, |
| 3742 | .channels_min = 2, |
| 3743 | .channels_max = 2, |
| 3744 | /* NID is set in alc_build_pcms */ |
| 3745 | }; |
| 3746 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3747 | /* 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] | 3748 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3749 | .substreams = 0, |
| 3750 | .channels_min = 0, |
| 3751 | .channels_max = 0, |
| 3752 | }; |
| 3753 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3754 | static int alc_build_pcms(struct hda_codec *codec) |
| 3755 | { |
| 3756 | struct alc_spec *spec = codec->spec; |
| 3757 | struct hda_pcm *info = spec->pcm_rec; |
| 3758 | int i; |
| 3759 | |
| 3760 | codec->num_pcms = 1; |
| 3761 | codec->pcm_info = info; |
| 3762 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3763 | if (spec->no_analog) |
| 3764 | goto skip_analog; |
| 3765 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3766 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3767 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3768 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3769 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3770 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3771 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3772 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3773 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3774 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3775 | } |
| 3776 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3777 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3778 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3779 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3780 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3781 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3782 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3783 | if (spec->channel_mode) { |
| 3784 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3785 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3786 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3787 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3788 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3789 | } |
| 3790 | } |
| 3791 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3792 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3793 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3794 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3795 | snprintf(spec->stream_name_digital, |
| 3796 | sizeof(spec->stream_name_digital), |
| 3797 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3798 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3799 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3800 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3801 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3802 | if (spec->dig_out_type) |
| 3803 | info->pcm_type = spec->dig_out_type; |
| 3804 | else |
| 3805 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3806 | if (spec->multiout.dig_out_nid && |
| 3807 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3808 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3809 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3810 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3811 | if (spec->dig_in_nid && |
| 3812 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3813 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3814 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3815 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3816 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3817 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3818 | } |
| 3819 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3820 | if (spec->no_analog) |
| 3821 | return 0; |
| 3822 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3823 | /* If the use of more than one ADC is requested for the current |
| 3824 | * model, configure a second analog capture-only PCM. |
| 3825 | */ |
| 3826 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3827 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3828 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3829 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3830 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3831 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3832 | if (spec->alt_dac_nid) { |
| 3833 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3834 | *spec->stream_analog_alt_playback; |
| 3835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3836 | spec->alt_dac_nid; |
| 3837 | } else { |
| 3838 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3839 | alc_pcm_null_stream; |
| 3840 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3841 | } |
| 3842 | if (spec->num_adc_nids > 1) { |
| 3843 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3844 | *spec->stream_analog_alt_capture; |
| 3845 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3846 | spec->adc_nids[1]; |
| 3847 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3848 | spec->num_adc_nids - 1; |
| 3849 | } else { |
| 3850 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3851 | alc_pcm_null_stream; |
| 3852 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3853 | } |
| 3854 | } |
| 3855 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3856 | return 0; |
| 3857 | } |
| 3858 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3859 | static inline void alc_shutup(struct hda_codec *codec) |
| 3860 | { |
| 3861 | snd_hda_shutup_pins(codec); |
| 3862 | } |
| 3863 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3864 | static void alc_free_kctls(struct hda_codec *codec) |
| 3865 | { |
| 3866 | struct alc_spec *spec = codec->spec; |
| 3867 | |
| 3868 | if (spec->kctls.list) { |
| 3869 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3870 | int i; |
| 3871 | for (i = 0; i < spec->kctls.used; i++) |
| 3872 | kfree(kctl[i].name); |
| 3873 | } |
| 3874 | snd_array_free(&spec->kctls); |
| 3875 | } |
| 3876 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3877 | static void alc_free(struct hda_codec *codec) |
| 3878 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3879 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3880 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3881 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3882 | return; |
| 3883 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3884 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3885 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3886 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3887 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3888 | } |
| 3889 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3890 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3891 | static void alc_power_eapd(struct hda_codec *codec) |
| 3892 | { |
| 3893 | /* We currently only handle front, HP */ |
| 3894 | switch (codec->vendor_id) { |
| 3895 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3896 | set_eapd(codec, 0x0f, 0); |
| 3897 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3898 | break; |
| 3899 | case 0x10ec0262: |
| 3900 | case 0x10ec0267: |
| 3901 | case 0x10ec0268: |
| 3902 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3903 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3904 | case 0x10ec0272: |
| 3905 | case 0x10ec0660: |
| 3906 | case 0x10ec0662: |
| 3907 | case 0x10ec0663: |
| 3908 | case 0x10ec0862: |
| 3909 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3910 | set_eapd(codec, 0x14, 0); |
| 3911 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3912 | break; |
| 3913 | } |
| 3914 | } |
| 3915 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3916 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3917 | { |
| 3918 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3919 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3920 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3921 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3922 | return 0; |
| 3923 | } |
| 3924 | #endif |
| 3925 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3926 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3927 | static int alc_resume(struct hda_codec *codec) |
| 3928 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3929 | codec->patch_ops.init(codec); |
| 3930 | snd_hda_codec_resume_amp(codec); |
| 3931 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3933 | if (codec->patch_ops.check_power_status) |
| 3934 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3935 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3936 | return 0; |
| 3937 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3938 | #endif |
| 3939 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3940 | /* |
| 3941 | */ |
| 3942 | static struct hda_codec_ops alc_patch_ops = { |
| 3943 | .build_controls = alc_build_controls, |
| 3944 | .build_pcms = alc_build_pcms, |
| 3945 | .init = alc_init, |
| 3946 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3947 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3948 | #ifdef SND_HDA_NEEDS_RESUME |
| 3949 | .resume = alc_resume, |
| 3950 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3951 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3952 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3953 | .check_power_status = alc_check_power_status, |
| 3954 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3955 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | }; |
| 3957 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 3958 | /* replace the codec chip_name with the given string */ |
| 3959 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 3960 | { |
| 3961 | kfree(codec->chip_name); |
| 3962 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 3963 | if (!codec->chip_name) { |
| 3964 | alc_free(codec); |
| 3965 | return -ENOMEM; |
| 3966 | } |
| 3967 | return 0; |
| 3968 | } |
| 3969 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3970 | /* |
| 3971 | * Test configuration for debugging |
| 3972 | * |
| 3973 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3974 | * enum controls. |
| 3975 | */ |
| 3976 | #ifdef CONFIG_SND_DEBUG |
| 3977 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3978 | 0x02, 0x03, 0x04, 0x05 |
| 3979 | }; |
| 3980 | |
| 3981 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3982 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3983 | .items = { |
| 3984 | { "In-1", 0x0 }, |
| 3985 | { "In-2", 0x1 }, |
| 3986 | { "In-3", 0x2 }, |
| 3987 | { "In-4", 0x3 }, |
| 3988 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3989 | { "Front", 0x5 }, |
| 3990 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3991 | }, |
| 3992 | }; |
| 3993 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3994 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3995 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3996 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3997 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3998 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3999 | }; |
| 4000 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4001 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4002 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4003 | { |
| 4004 | static char *texts[] = { |
| 4005 | "N/A", "Line Out", "HP Out", |
| 4006 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4007 | }; |
| 4008 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4009 | uinfo->count = 1; |
| 4010 | uinfo->value.enumerated.items = 8; |
| 4011 | if (uinfo->value.enumerated.item >= 8) |
| 4012 | uinfo->value.enumerated.item = 7; |
| 4013 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4014 | return 0; |
| 4015 | } |
| 4016 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4017 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4018 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4019 | { |
| 4020 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4021 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4022 | unsigned int pin_ctl, item = 0; |
| 4023 | |
| 4024 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4025 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4026 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4027 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4028 | item = 2; |
| 4029 | else |
| 4030 | item = 1; |
| 4031 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4032 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4033 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4034 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4035 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4036 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4037 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4038 | } |
| 4039 | } |
| 4040 | ucontrol->value.enumerated.item[0] = item; |
| 4041 | return 0; |
| 4042 | } |
| 4043 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4044 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4045 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4046 | { |
| 4047 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4048 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4049 | static unsigned int ctls[] = { |
| 4050 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4051 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4052 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4053 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4054 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4055 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4056 | }; |
| 4057 | unsigned int old_ctl, new_ctl; |
| 4058 | |
| 4059 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4060 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4061 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4062 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4063 | int val; |
| 4064 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4065 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4066 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4067 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4068 | HDA_AMP_MUTE : 0; |
| 4069 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4070 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4071 | return 1; |
| 4072 | } |
| 4073 | return 0; |
| 4074 | } |
| 4075 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4076 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4077 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4078 | { |
| 4079 | static char *texts[] = { |
| 4080 | "Front", "Surround", "CLFE", "Side" |
| 4081 | }; |
| 4082 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4083 | uinfo->count = 1; |
| 4084 | uinfo->value.enumerated.items = 4; |
| 4085 | if (uinfo->value.enumerated.item >= 4) |
| 4086 | uinfo->value.enumerated.item = 3; |
| 4087 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4088 | return 0; |
| 4089 | } |
| 4090 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4091 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4092 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4093 | { |
| 4094 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4095 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4096 | unsigned int sel; |
| 4097 | |
| 4098 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4099 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4100 | return 0; |
| 4101 | } |
| 4102 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4103 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4104 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4105 | { |
| 4106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4107 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4108 | unsigned int sel; |
| 4109 | |
| 4110 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4111 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4112 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4113 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4114 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4115 | return 1; |
| 4116 | } |
| 4117 | return 0; |
| 4118 | } |
| 4119 | |
| 4120 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4121 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4122 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4123 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4124 | .info = alc_test_pin_ctl_info, \ |
| 4125 | .get = alc_test_pin_ctl_get, \ |
| 4126 | .put = alc_test_pin_ctl_put, \ |
| 4127 | .private_value = nid \ |
| 4128 | } |
| 4129 | |
| 4130 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4131 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4132 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4133 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4134 | .info = alc_test_pin_src_info, \ |
| 4135 | .get = alc_test_pin_src_get, \ |
| 4136 | .put = alc_test_pin_src_put, \ |
| 4137 | .private_value = nid \ |
| 4138 | } |
| 4139 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4140 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4141 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4142 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4143 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4144 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4145 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4146 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4147 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4148 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4149 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4150 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4151 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4152 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4153 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4154 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4155 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4156 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4157 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4158 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4159 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4160 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4161 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4162 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4163 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4164 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4165 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4166 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4167 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4168 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4169 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4170 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4171 | { |
| 4172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4173 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4174 | .info = alc_ch_mode_info, |
| 4175 | .get = alc_ch_mode_get, |
| 4176 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4177 | }, |
| 4178 | { } /* end */ |
| 4179 | }; |
| 4180 | |
| 4181 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4182 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4183 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4186 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4188 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4189 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4191 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4195 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4196 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4200 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4201 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4202 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4205 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4206 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4207 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4210 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4212 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4215 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4216 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4217 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4219 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4220 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4221 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4222 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4223 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4224 | /* Analog input/passthru */ |
| 4225 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4226 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4227 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4229 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4230 | { } |
| 4231 | }; |
| 4232 | #endif |
| 4233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4234 | /* |
| 4235 | */ |
| 4236 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4237 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4238 | [ALC880_3ST] = "3stack", |
| 4239 | [ALC880_TCL_S700] = "tcl", |
| 4240 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4241 | [ALC880_CLEVO] = "clevo", |
| 4242 | [ALC880_5ST] = "5stack", |
| 4243 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4244 | [ALC880_W810] = "w810", |
| 4245 | [ALC880_Z71V] = "z71v", |
| 4246 | [ALC880_6ST] = "6stack", |
| 4247 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4248 | [ALC880_ASUS] = "asus", |
| 4249 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4250 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4251 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4252 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4253 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4254 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4255 | [ALC880_F1734] = "F1734", |
| 4256 | [ALC880_LG] = "lg", |
| 4257 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4258 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4259 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4260 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4261 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4262 | [ALC880_AUTO] = "auto", |
| 4263 | }; |
| 4264 | |
| 4265 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4266 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4267 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4268 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4269 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4270 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4271 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4272 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4273 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4274 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4275 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4276 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4277 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4278 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4279 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4280 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4281 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4282 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4283 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4284 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4285 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4286 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4287 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4288 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4289 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4290 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4291 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4292 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4293 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4294 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4295 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4296 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4297 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4298 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4299 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4300 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4301 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4302 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4303 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4304 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4305 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4306 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4307 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4308 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4309 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4310 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4311 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4312 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4313 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4314 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4315 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4316 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4317 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4318 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4319 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4320 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4321 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4322 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4323 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4324 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4325 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4326 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4327 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4328 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4329 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4330 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4331 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4332 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4333 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4334 | /* default Intel */ |
| 4335 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4336 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4337 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4338 | {} |
| 4339 | }; |
| 4340 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4341 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4343 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4344 | static struct alc_config_preset alc880_presets[] = { |
| 4345 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4347 | .init_verbs = { alc880_volume_init_verbs, |
| 4348 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4349 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4350 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4351 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4352 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4353 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4354 | .input_mux = &alc880_capture_source, |
| 4355 | }, |
| 4356 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4358 | .init_verbs = { alc880_volume_init_verbs, |
| 4359 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4360 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4361 | .dac_nids = alc880_dac_nids, |
| 4362 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4363 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4364 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4365 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4366 | .input_mux = &alc880_capture_source, |
| 4367 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4368 | [ALC880_TCL_S700] = { |
| 4369 | .mixers = { alc880_tcl_s700_mixer }, |
| 4370 | .init_verbs = { alc880_volume_init_verbs, |
| 4371 | alc880_pin_tcl_S700_init_verbs, |
| 4372 | alc880_gpio2_init_verbs }, |
| 4373 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4374 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4375 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4376 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4377 | .hp_nid = 0x03, |
| 4378 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4379 | .channel_mode = alc880_2_jack_modes, |
| 4380 | .input_mux = &alc880_capture_source, |
| 4381 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4382 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | .mixers = { alc880_three_stack_mixer, |
| 4384 | alc880_five_stack_mixer}, |
| 4385 | .init_verbs = { alc880_volume_init_verbs, |
| 4386 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4387 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4388 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4389 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4390 | .channel_mode = alc880_fivestack_modes, |
| 4391 | .input_mux = &alc880_capture_source, |
| 4392 | }, |
| 4393 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4394 | .mixers = { alc880_three_stack_mixer, |
| 4395 | alc880_five_stack_mixer }, |
| 4396 | .init_verbs = { alc880_volume_init_verbs, |
| 4397 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4398 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4399 | .dac_nids = alc880_dac_nids, |
| 4400 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4401 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4402 | .channel_mode = alc880_fivestack_modes, |
| 4403 | .input_mux = &alc880_capture_source, |
| 4404 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4405 | [ALC880_6ST] = { |
| 4406 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4407 | .init_verbs = { alc880_volume_init_verbs, |
| 4408 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4409 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4410 | .dac_nids = alc880_6st_dac_nids, |
| 4411 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4412 | .channel_mode = alc880_sixstack_modes, |
| 4413 | .input_mux = &alc880_6stack_capture_source, |
| 4414 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4415 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4416 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4417 | .init_verbs = { alc880_volume_init_verbs, |
| 4418 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4419 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4420 | .dac_nids = alc880_6st_dac_nids, |
| 4421 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4422 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4423 | .channel_mode = alc880_sixstack_modes, |
| 4424 | .input_mux = &alc880_6stack_capture_source, |
| 4425 | }, |
| 4426 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4428 | .init_verbs = { alc880_volume_init_verbs, |
| 4429 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4430 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4431 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4432 | .dac_nids = alc880_w810_dac_nids, |
| 4433 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4434 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4435 | .channel_mode = alc880_w810_modes, |
| 4436 | .input_mux = &alc880_capture_source, |
| 4437 | }, |
| 4438 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4439 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4440 | .init_verbs = { alc880_volume_init_verbs, |
| 4441 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4442 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4443 | .dac_nids = alc880_z71v_dac_nids, |
| 4444 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4445 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4446 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4447 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4448 | .input_mux = &alc880_capture_source, |
| 4449 | }, |
| 4450 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4452 | .init_verbs = { alc880_volume_init_verbs, |
| 4453 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4455 | .dac_nids = alc880_f1734_dac_nids, |
| 4456 | .hp_nid = 0x02, |
| 4457 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4458 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4459 | .input_mux = &alc880_f1734_capture_source, |
| 4460 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4461 | .setup = alc880_uniwill_p53_setup, |
| 4462 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4463 | }, |
| 4464 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4465 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4466 | .init_verbs = { alc880_volume_init_verbs, |
| 4467 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4468 | alc880_gpio1_init_verbs }, |
| 4469 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4470 | .dac_nids = alc880_asus_dac_nids, |
| 4471 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4472 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4473 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4474 | .input_mux = &alc880_capture_source, |
| 4475 | }, |
| 4476 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4478 | .init_verbs = { alc880_volume_init_verbs, |
| 4479 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4480 | alc880_gpio1_init_verbs }, |
| 4481 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4482 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4483 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4485 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4486 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4487 | .input_mux = &alc880_capture_source, |
| 4488 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | [ALC880_ASUS_DIG2] = { |
| 4490 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4491 | .init_verbs = { alc880_volume_init_verbs, |
| 4492 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4493 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4494 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4495 | .dac_nids = alc880_asus_dac_nids, |
| 4496 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4497 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4498 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4499 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | .input_mux = &alc880_capture_source, |
| 4501 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4502 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4503 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4504 | .init_verbs = { alc880_volume_init_verbs, |
| 4505 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | alc880_gpio1_init_verbs }, |
| 4507 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4508 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4509 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4511 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4512 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4513 | .input_mux = &alc880_capture_source, |
| 4514 | }, |
| 4515 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4516 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4517 | .init_verbs = { alc880_volume_init_verbs, |
| 4518 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4519 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4520 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4521 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4523 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4524 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4525 | .input_mux = &alc880_capture_source, |
| 4526 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4527 | [ALC880_UNIWILL] = { |
| 4528 | .mixers = { alc880_uniwill_mixer }, |
| 4529 | .init_verbs = { alc880_volume_init_verbs, |
| 4530 | alc880_uniwill_init_verbs }, |
| 4531 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4532 | .dac_nids = alc880_asus_dac_nids, |
| 4533 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4534 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4535 | .channel_mode = alc880_threestack_modes, |
| 4536 | .need_dac_fix = 1, |
| 4537 | .input_mux = &alc880_capture_source, |
| 4538 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4539 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4540 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4541 | }, |
| 4542 | [ALC880_UNIWILL_P53] = { |
| 4543 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4544 | .init_verbs = { alc880_volume_init_verbs, |
| 4545 | alc880_uniwill_p53_init_verbs }, |
| 4546 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4547 | .dac_nids = alc880_asus_dac_nids, |
| 4548 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4549 | .channel_mode = alc880_threestack_modes, |
| 4550 | .input_mux = &alc880_capture_source, |
| 4551 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4552 | .setup = alc880_uniwill_p53_setup, |
| 4553 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4554 | }, |
| 4555 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4556 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4557 | .init_verbs = { alc880_volume_init_verbs, |
| 4558 | alc880_uniwill_p53_init_verbs, |
| 4559 | alc880_beep_init_verbs }, |
| 4560 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4561 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4562 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4563 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4564 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4565 | .input_mux = &alc880_capture_source, |
| 4566 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4567 | .setup = alc880_uniwill_p53_setup, |
| 4568 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4569 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4570 | [ALC880_CLEVO] = { |
| 4571 | .mixers = { alc880_three_stack_mixer }, |
| 4572 | .init_verbs = { alc880_volume_init_verbs, |
| 4573 | alc880_pin_clevo_init_verbs }, |
| 4574 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4575 | .dac_nids = alc880_dac_nids, |
| 4576 | .hp_nid = 0x03, |
| 4577 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4578 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4579 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4580 | .input_mux = &alc880_capture_source, |
| 4581 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4582 | [ALC880_LG] = { |
| 4583 | .mixers = { alc880_lg_mixer }, |
| 4584 | .init_verbs = { alc880_volume_init_verbs, |
| 4585 | alc880_lg_init_verbs }, |
| 4586 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4587 | .dac_nids = alc880_lg_dac_nids, |
| 4588 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4589 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4590 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4591 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4592 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4593 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4594 | .setup = alc880_lg_setup, |
| 4595 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4596 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4597 | .loopbacks = alc880_lg_loopbacks, |
| 4598 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4599 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4600 | [ALC880_LG_LW] = { |
| 4601 | .mixers = { alc880_lg_lw_mixer }, |
| 4602 | .init_verbs = { alc880_volume_init_verbs, |
| 4603 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4604 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4605 | .dac_nids = alc880_dac_nids, |
| 4606 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4607 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4608 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4609 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4610 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4611 | .setup = alc880_lg_lw_setup, |
| 4612 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4613 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4614 | [ALC880_MEDION_RIM] = { |
| 4615 | .mixers = { alc880_medion_rim_mixer }, |
| 4616 | .init_verbs = { alc880_volume_init_verbs, |
| 4617 | alc880_medion_rim_init_verbs, |
| 4618 | alc_gpio2_init_verbs }, |
| 4619 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4620 | .dac_nids = alc880_dac_nids, |
| 4621 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4622 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4623 | .channel_mode = alc880_2_jack_modes, |
| 4624 | .input_mux = &alc880_medion_rim_capture_source, |
| 4625 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4626 | .setup = alc880_medion_rim_setup, |
| 4627 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4628 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4629 | #ifdef CONFIG_SND_DEBUG |
| 4630 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4631 | .mixers = { alc880_test_mixer }, |
| 4632 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4633 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4634 | .dac_nids = alc880_test_dac_nids, |
| 4635 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4636 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4637 | .channel_mode = alc880_test_modes, |
| 4638 | .input_mux = &alc880_test_capture_source, |
| 4639 | }, |
| 4640 | #endif |
| 4641 | }; |
| 4642 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4643 | /* |
| 4644 | * Automatic parse of I/O pins from the BIOS configuration |
| 4645 | */ |
| 4646 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4647 | enum { |
| 4648 | ALC_CTL_WIDGET_VOL, |
| 4649 | ALC_CTL_WIDGET_MUTE, |
| 4650 | ALC_CTL_BIND_MUTE, |
| 4651 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4652 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4653 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4654 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4655 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4656 | }; |
| 4657 | |
| 4658 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4659 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4660 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4661 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4662 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4663 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4664 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4665 | knew = snd_array_new(&spec->kctls); |
| 4666 | if (!knew) |
| 4667 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4668 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4669 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4670 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4671 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4672 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4673 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4674 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4675 | return 0; |
| 4676 | } |
| 4677 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4678 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4679 | const char *pfx, const char *dir, |
| 4680 | const char *sfx, unsigned long val) |
| 4681 | { |
| 4682 | char name[32]; |
| 4683 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4684 | return add_control(spec, type, name, val); |
| 4685 | } |
| 4686 | |
| 4687 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4688 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4689 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4690 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4691 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4693 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4694 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4695 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4696 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4697 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4698 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4699 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4700 | #define ALC880_PIN_CD_NID 0x1c |
| 4701 | |
| 4702 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4703 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4704 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4705 | { |
| 4706 | hda_nid_t nid; |
| 4707 | int assigned[4]; |
| 4708 | int i, j; |
| 4709 | |
| 4710 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4711 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4712 | |
| 4713 | /* check the pins hardwired to audio widget */ |
| 4714 | for (i = 0; i < cfg->line_outs; i++) { |
| 4715 | nid = cfg->line_out_pins[i]; |
| 4716 | if (alc880_is_fixed_pin(nid)) { |
| 4717 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4718 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4719 | assigned[idx] = 1; |
| 4720 | } |
| 4721 | } |
| 4722 | /* left pins can be connect to any audio widget */ |
| 4723 | for (i = 0; i < cfg->line_outs; i++) { |
| 4724 | nid = cfg->line_out_pins[i]; |
| 4725 | if (alc880_is_fixed_pin(nid)) |
| 4726 | continue; |
| 4727 | /* search for an empty channel */ |
| 4728 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | if (!assigned[j]) { |
| 4730 | spec->multiout.dac_nids[i] = |
| 4731 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4732 | assigned[j] = 1; |
| 4733 | break; |
| 4734 | } |
| 4735 | } |
| 4736 | } |
| 4737 | spec->multiout.num_dacs = cfg->line_outs; |
| 4738 | return 0; |
| 4739 | } |
| 4740 | |
| 4741 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4742 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4743 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4745 | static const char *chname[4] = { |
| 4746 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4747 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | hda_nid_t nid; |
| 4749 | int i, err; |
| 4750 | |
| 4751 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4752 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4753 | continue; |
| 4754 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4755 | if (i == 2) { |
| 4756 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4757 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4758 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4759 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4760 | HDA_OUTPUT)); |
| 4761 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4762 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4763 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4764 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4765 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4766 | HDA_OUTPUT)); |
| 4767 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4769 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4770 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4771 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4772 | HDA_INPUT)); |
| 4773 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4774 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4775 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4776 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4777 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4778 | HDA_INPUT)); |
| 4779 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | return err; |
| 4781 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4782 | const char *pfx; |
| 4783 | if (cfg->line_outs == 1 && |
| 4784 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4785 | pfx = "Speaker"; |
| 4786 | else |
| 4787 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4788 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4789 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4790 | HDA_OUTPUT)); |
| 4791 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4792 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4793 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4794 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4795 | HDA_INPUT)); |
| 4796 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4797 | return err; |
| 4798 | } |
| 4799 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4800 | return 0; |
| 4801 | } |
| 4802 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4803 | /* add playback controls for speaker and HP outputs */ |
| 4804 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4805 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4806 | { |
| 4807 | hda_nid_t nid; |
| 4808 | int err; |
| 4809 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4811 | return 0; |
| 4812 | |
| 4813 | if (alc880_is_fixed_pin(pin)) { |
| 4814 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4815 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4816 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4818 | else |
| 4819 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4820 | /* control HP volume/switch on the output mixer amp */ |
| 4821 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4822 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4823 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4824 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4825 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4826 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4827 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4828 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | return err; |
| 4830 | } else if (alc880_is_multi_pin(pin)) { |
| 4831 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4833 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4834 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4835 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | return err; |
| 4837 | } |
| 4838 | return 0; |
| 4839 | } |
| 4840 | |
| 4841 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4842 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4843 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4844 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4846 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4847 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4848 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4849 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4850 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4851 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4852 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4853 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4854 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | return err; |
| 4856 | return 0; |
| 4857 | } |
| 4858 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4859 | 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] | 4860 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4861 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4862 | return (pincap & AC_PINCAP_IN) != 0; |
| 4863 | } |
| 4864 | |
| 4865 | /* create playback/capture controls for input pins */ |
| 4866 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4867 | const struct auto_pin_cfg *cfg, |
| 4868 | hda_nid_t mixer, |
| 4869 | hda_nid_t cap1, hda_nid_t cap2) |
| 4870 | { |
| 4871 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4872 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4873 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4874 | |
| 4875 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4876 | hda_nid_t pin; |
| 4877 | |
| 4878 | pin = cfg->input_pins[i]; |
| 4879 | if (!alc_is_input_pin(codec, pin)) |
| 4880 | continue; |
| 4881 | |
| 4882 | if (mixer) { |
| 4883 | idx = get_connection_index(codec, mixer, pin); |
| 4884 | if (idx >= 0) { |
| 4885 | err = new_analog_input(spec, pin, |
| 4886 | auto_pin_cfg_labels[i], |
| 4887 | idx, mixer); |
| 4888 | if (err < 0) |
| 4889 | return err; |
| 4890 | } |
| 4891 | } |
| 4892 | |
| 4893 | if (!cap1) |
| 4894 | continue; |
| 4895 | idx = get_connection_index(codec, cap1, pin); |
| 4896 | if (idx < 0 && cap2) |
| 4897 | idx = get_connection_index(codec, cap2, pin); |
| 4898 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4899 | imux->items[imux->num_items].label = |
| 4900 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4901 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | imux->num_items++; |
| 4903 | } |
| 4904 | } |
| 4905 | return 0; |
| 4906 | } |
| 4907 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4908 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4909 | const struct auto_pin_cfg *cfg) |
| 4910 | { |
| 4911 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4912 | } |
| 4913 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4914 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4915 | unsigned int pin_type) |
| 4916 | { |
| 4917 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4918 | pin_type); |
| 4919 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4920 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4921 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4922 | } |
| 4923 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4924 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4925 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4926 | int dac_idx) |
| 4927 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4928 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4929 | /* need the manual connection? */ |
| 4930 | if (alc880_is_multi_pin(nid)) { |
| 4931 | struct alc_spec *spec = codec->spec; |
| 4932 | int idx = alc880_multi_pin_idx(nid); |
| 4933 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4934 | AC_VERB_SET_CONNECT_SEL, |
| 4935 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4936 | } |
| 4937 | } |
| 4938 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4939 | static int get_pin_type(int line_out_type) |
| 4940 | { |
| 4941 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4942 | return PIN_HP; |
| 4943 | else |
| 4944 | return PIN_OUT; |
| 4945 | } |
| 4946 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4948 | { |
| 4949 | struct alc_spec *spec = codec->spec; |
| 4950 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4951 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4952 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4953 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4954 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4955 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4956 | } |
| 4957 | } |
| 4958 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4959 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | { |
| 4961 | struct alc_spec *spec = codec->spec; |
| 4962 | hda_nid_t pin; |
| 4963 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4964 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4965 | if (pin) /* connect to front */ |
| 4966 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4967 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4968 | if (pin) /* connect to front */ |
| 4969 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4970 | } |
| 4971 | |
| 4972 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4973 | { |
| 4974 | struct alc_spec *spec = codec->spec; |
| 4975 | int i; |
| 4976 | |
| 4977 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4978 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4979 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4980 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4981 | if (nid != ALC880_PIN_CD_NID && |
| 4982 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4983 | snd_hda_codec_write(codec, nid, 0, |
| 4984 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4985 | AMP_OUT_MUTE); |
| 4986 | } |
| 4987 | } |
| 4988 | } |
| 4989 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4990 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 4991 | { |
| 4992 | struct alc_spec *spec = codec->spec; |
| 4993 | int c; |
| 4994 | |
| 4995 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 4996 | unsigned int mux_idx; |
| 4997 | const struct hda_input_mux *imux; |
| 4998 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 4999 | imux = &spec->input_mux[mux_idx]; |
| 5000 | if (!imux->num_items && mux_idx > 0) |
| 5001 | imux = &spec->input_mux[0]; |
| 5002 | if (imux) |
| 5003 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5004 | AC_VERB_SET_CONNECT_SEL, |
| 5005 | imux->items[0].index); |
| 5006 | } |
| 5007 | } |
| 5008 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5010 | /* return 1 if successful, 0 if the proper config is not found, |
| 5011 | * or a negative error code |
| 5012 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5013 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5014 | { |
| 5015 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5016 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5018 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5019 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5020 | alc880_ignore); |
| 5021 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5022 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5023 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5024 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5025 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5027 | if (err < 0) |
| 5028 | return err; |
| 5029 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5030 | if (err < 0) |
| 5031 | return err; |
| 5032 | err = alc880_auto_create_extra_out(spec, |
| 5033 | spec->autocfg.speaker_pins[0], |
| 5034 | "Speaker"); |
| 5035 | if (err < 0) |
| 5036 | return err; |
| 5037 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5038 | "Headphone"); |
| 5039 | if (err < 0) |
| 5040 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5041 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5042 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | return err; |
| 5044 | |
| 5045 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5046 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5047 | /* check multiple SPDIF-out (for recent codecs) */ |
| 5048 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 5049 | hda_nid_t dig_nid; |
| 5050 | err = snd_hda_get_connections(codec, |
| 5051 | spec->autocfg.dig_out_pins[i], |
| 5052 | &dig_nid, 1); |
| 5053 | if (err < 0) |
| 5054 | continue; |
| 5055 | if (!i) |
| 5056 | spec->multiout.dig_out_nid = dig_nid; |
| 5057 | else { |
| 5058 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 5059 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5060 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 5061 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5062 | } |
| 5063 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5064 | if (spec->autocfg.dig_in_pin) |
| 5065 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 5066 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5067 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5068 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5069 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5070 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5072 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5073 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5075 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5076 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5077 | return 1; |
| 5078 | } |
| 5079 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5080 | /* additional initialization for auto-configuration model */ |
| 5081 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5082 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5083 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5084 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5085 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5086 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5087 | alc880_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5088 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5089 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5090 | } |
| 5091 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5092 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5093 | * one of two digital mic pins, e.g. on ALC272 |
| 5094 | */ |
| 5095 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5096 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5097 | struct alc_spec *spec = codec->spec; |
| 5098 | int i; |
| 5099 | |
| 5100 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5101 | hda_nid_t cap = spec->capsrc_nids ? |
| 5102 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5103 | int iidx, eidx; |
| 5104 | |
| 5105 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5106 | if (iidx < 0) |
| 5107 | continue; |
| 5108 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5109 | if (eidx < 0) |
| 5110 | continue; |
| 5111 | spec->int_mic.mux_idx = iidx; |
| 5112 | spec->ext_mic.mux_idx = eidx; |
| 5113 | if (spec->capsrc_nids) |
| 5114 | spec->capsrc_nids += i; |
| 5115 | spec->adc_nids += i; |
| 5116 | spec->num_adc_nids = 1; |
| 5117 | return; |
| 5118 | } |
| 5119 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5120 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5121 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5122 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5123 | } |
| 5124 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 5125 | /* set the default connection to that pin */ |
| 5126 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5127 | { |
| 5128 | struct alc_spec *spec = codec->spec; |
| 5129 | int i; |
| 5130 | |
| 5131 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5132 | hda_nid_t cap = spec->capsrc_nids ? |
| 5133 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5134 | int idx; |
| 5135 | |
| 5136 | idx = get_connection_index(codec, cap, pin); |
| 5137 | if (idx < 0) |
| 5138 | continue; |
| 5139 | /* select or unmute this route */ |
| 5140 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5141 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5142 | HDA_AMP_MUTE, 0); |
| 5143 | } else { |
| 5144 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5145 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5146 | } |
| 5147 | return i; /* return the found index */ |
| 5148 | } |
| 5149 | return -1; /* not found */ |
| 5150 | } |
| 5151 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5152 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5153 | static void fixup_single_adc(struct hda_codec *codec) |
| 5154 | { |
| 5155 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5156 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5157 | int i; |
| 5158 | |
| 5159 | /* search for the input pin; there must be only one */ |
| 5160 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5161 | if (spec->autocfg.input_pins[i]) { |
| 5162 | pin = spec->autocfg.input_pins[i]; |
| 5163 | break; |
| 5164 | } |
| 5165 | } |
| 5166 | if (!pin) |
| 5167 | return; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 5168 | i = init_capsrc_for_pin(codec, pin); |
| 5169 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5170 | /* use only this ADC */ |
| 5171 | if (spec->capsrc_nids) |
| 5172 | spec->capsrc_nids += i; |
| 5173 | spec->adc_nids += i; |
| 5174 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5175 | } |
| 5176 | } |
| 5177 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 5178 | /* initialize dual adcs */ |
| 5179 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5180 | { |
| 5181 | struct alc_spec *spec = codec->spec; |
| 5182 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5183 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5184 | } |
| 5185 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5186 | static void set_capture_mixer(struct hda_codec *codec) |
| 5187 | { |
| 5188 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5189 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5190 | { alc_capture_mixer_nosrc1, |
| 5191 | alc_capture_mixer_nosrc2, |
| 5192 | alc_capture_mixer_nosrc3 }, |
| 5193 | { alc_capture_mixer1, |
| 5194 | alc_capture_mixer2, |
| 5195 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5196 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5197 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5198 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 5199 | int num_adcs = spec->num_adc_nids; |
| 5200 | if (spec->dual_adc_switch) |
| 5201 | fixup_dual_adc_switch(codec); |
| 5202 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5203 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5204 | else if (spec->input_mux) { |
| 5205 | if (spec->input_mux->num_items > 1) |
| 5206 | mux = 1; |
| 5207 | else if (spec->input_mux->num_items == 1) |
| 5208 | fixup_single_adc(codec); |
| 5209 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 5210 | if (spec->dual_adc_switch) |
| 5211 | num_adcs = 1; |
| 5212 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5213 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5214 | } |
| 5215 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5216 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5217 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5218 | int num_nids) |
| 5219 | { |
| 5220 | struct alc_spec *spec = codec->spec; |
| 5221 | int n; |
| 5222 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5223 | |
| 5224 | for (n = 0; n < num_nids; n++) { |
| 5225 | hda_nid_t adc, cap; |
| 5226 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5227 | int nconns, i, j; |
| 5228 | |
| 5229 | adc = nids[n]; |
| 5230 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5231 | continue; |
| 5232 | cap = adc; |
| 5233 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5234 | ARRAY_SIZE(conn)); |
| 5235 | if (nconns == 1) { |
| 5236 | cap = conn[0]; |
| 5237 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5238 | ARRAY_SIZE(conn)); |
| 5239 | } |
| 5240 | if (nconns <= 0) |
| 5241 | continue; |
| 5242 | if (!fallback_adc) { |
| 5243 | fallback_adc = adc; |
| 5244 | fallback_cap = cap; |
| 5245 | } |
| 5246 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5247 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5248 | if (!nid) |
| 5249 | continue; |
| 5250 | for (j = 0; j < nconns; j++) { |
| 5251 | if (conn[j] == nid) |
| 5252 | break; |
| 5253 | } |
| 5254 | if (j >= nconns) |
| 5255 | break; |
| 5256 | } |
| 5257 | if (i >= AUTO_PIN_LAST) { |
| 5258 | int num_adcs = spec->num_adc_nids; |
| 5259 | spec->private_adc_nids[num_adcs] = adc; |
| 5260 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5261 | spec->num_adc_nids++; |
| 5262 | spec->adc_nids = spec->private_adc_nids; |
| 5263 | if (adc != cap) |
| 5264 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5265 | } |
| 5266 | } |
| 5267 | if (!spec->num_adc_nids) { |
| 5268 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5269 | " using fallback 0x%x\n", |
| 5270 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5271 | spec->private_adc_nids[0] = fallback_adc; |
| 5272 | spec->adc_nids = spec->private_adc_nids; |
| 5273 | if (fallback_adc != fallback_cap) { |
| 5274 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5275 | spec->capsrc_nids = spec->private_adc_nids; |
| 5276 | } |
| 5277 | } |
| 5278 | } |
| 5279 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5280 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5281 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5282 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5283 | #else |
| 5284 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 5285 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5286 | |
| 5287 | /* |
| 5288 | * OK, here we have finally the patch for ALC880 |
| 5289 | */ |
| 5290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5291 | static int patch_alc880(struct hda_codec *codec) |
| 5292 | { |
| 5293 | struct alc_spec *spec; |
| 5294 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5295 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5296 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5297 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5298 | if (spec == NULL) |
| 5299 | return -ENOMEM; |
| 5300 | |
| 5301 | codec->spec = spec; |
| 5302 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5303 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5304 | alc880_models, |
| 5305 | alc880_cfg_tbl); |
| 5306 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5307 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5308 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5309 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5310 | } |
| 5311 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5312 | if (board_config == ALC880_AUTO) { |
| 5313 | /* automatic parse from the BIOS config */ |
| 5314 | err = alc880_parse_auto_config(codec); |
| 5315 | if (err < 0) { |
| 5316 | alc_free(codec); |
| 5317 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5318 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5319 | printk(KERN_INFO |
| 5320 | "hda_codec: Cannot set up configuration " |
| 5321 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5322 | board_config = ALC880_3ST; |
| 5323 | } |
| 5324 | } |
| 5325 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5326 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5327 | if (err < 0) { |
| 5328 | alc_free(codec); |
| 5329 | return err; |
| 5330 | } |
| 5331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5332 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5333 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5334 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5335 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5336 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5337 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5338 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5339 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5340 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5341 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5342 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5343 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5344 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5345 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5346 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5347 | if (wcap != AC_WID_AUD_IN) { |
| 5348 | spec->adc_nids = alc880_adc_nids_alt; |
| 5349 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5350 | } else { |
| 5351 | spec->adc_nids = alc880_adc_nids; |
| 5352 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5353 | } |
| 5354 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5355 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5356 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5357 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5358 | spec->vmaster_nid = 0x0c; |
| 5359 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5360 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5361 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5362 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5363 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5364 | if (!spec->loopback.amplist) |
| 5365 | spec->loopback.amplist = alc880_loopbacks; |
| 5366 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5367 | |
| 5368 | return 0; |
| 5369 | } |
| 5370 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5371 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5372 | /* |
| 5373 | * ALC260 support |
| 5374 | */ |
| 5375 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5376 | static hda_nid_t alc260_dac_nids[1] = { |
| 5377 | /* front */ |
| 5378 | 0x02, |
| 5379 | }; |
| 5380 | |
| 5381 | static hda_nid_t alc260_adc_nids[1] = { |
| 5382 | /* ADC0 */ |
| 5383 | 0x04, |
| 5384 | }; |
| 5385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5386 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | /* ADC1 */ |
| 5388 | 0x05, |
| 5389 | }; |
| 5390 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5391 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5392 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5393 | */ |
| 5394 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5395 | /* ADC0, ADC1 */ |
| 5396 | 0x04, 0x05 |
| 5397 | }; |
| 5398 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5399 | #define ALC260_DIGOUT_NID 0x03 |
| 5400 | #define ALC260_DIGIN_NID 0x06 |
| 5401 | |
| 5402 | static struct hda_input_mux alc260_capture_source = { |
| 5403 | .num_items = 4, |
| 5404 | .items = { |
| 5405 | { "Mic", 0x0 }, |
| 5406 | { "Front Mic", 0x1 }, |
| 5407 | { "Line", 0x2 }, |
| 5408 | { "CD", 0x4 }, |
| 5409 | }, |
| 5410 | }; |
| 5411 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5412 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5413 | * headphone jack and the internal CD lines since these are the only pins at |
| 5414 | * which audio can appear. For flexibility, also allow the option of |
| 5415 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5416 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5417 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5418 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5419 | { |
| 5420 | .num_items = 3, |
| 5421 | .items = { |
| 5422 | { "Mic/Line", 0x0 }, |
| 5423 | { "CD", 0x4 }, |
| 5424 | { "Headphone", 0x2 }, |
| 5425 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5426 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5427 | { |
| 5428 | .num_items = 4, |
| 5429 | .items = { |
| 5430 | { "Mic/Line", 0x0 }, |
| 5431 | { "CD", 0x4 }, |
| 5432 | { "Headphone", 0x2 }, |
| 5433 | { "Mixer", 0x5 }, |
| 5434 | }, |
| 5435 | }, |
| 5436 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5437 | }; |
| 5438 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5439 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5440 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5441 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5442 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5443 | { |
| 5444 | .num_items = 4, |
| 5445 | .items = { |
| 5446 | { "Mic", 0x0 }, |
| 5447 | { "Line", 0x2 }, |
| 5448 | { "CD", 0x4 }, |
| 5449 | { "Headphone", 0x5 }, |
| 5450 | }, |
| 5451 | }, |
| 5452 | { |
| 5453 | .num_items = 5, |
| 5454 | .items = { |
| 5455 | { "Mic", 0x0 }, |
| 5456 | { "Line", 0x2 }, |
| 5457 | { "CD", 0x4 }, |
| 5458 | { "Headphone", 0x6 }, |
| 5459 | { "Mixer", 0x5 }, |
| 5460 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5461 | }, |
| 5462 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5463 | |
| 5464 | /* Maxdata Favorit 100XS */ |
| 5465 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5466 | { |
| 5467 | .num_items = 2, |
| 5468 | .items = { |
| 5469 | { "Line/Mic", 0x0 }, |
| 5470 | { "CD", 0x4 }, |
| 5471 | }, |
| 5472 | }, |
| 5473 | { |
| 5474 | .num_items = 3, |
| 5475 | .items = { |
| 5476 | { "Line/Mic", 0x0 }, |
| 5477 | { "CD", 0x4 }, |
| 5478 | { "Mixer", 0x5 }, |
| 5479 | }, |
| 5480 | }, |
| 5481 | }; |
| 5482 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5483 | /* |
| 5484 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5485 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5486 | * element which allows changing the channel mode, so the verb list is |
| 5487 | * never used. |
| 5488 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5489 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5490 | { 2, NULL }, |
| 5491 | }; |
| 5492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5493 | |
| 5494 | /* Mixer combinations |
| 5495 | * |
| 5496 | * basic: base_output + input + pc_beep + capture |
| 5497 | * HP: base_output + input + capture_alt |
| 5498 | * HP_3013: hp_3013 + input + capture |
| 5499 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5500 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5501 | */ |
| 5502 | |
| 5503 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5505 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5506 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5507 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5508 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5509 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5510 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5511 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5512 | |
| 5513 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5514 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5515 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5516 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5517 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5518 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5519 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5520 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5521 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5522 | { } /* end */ |
| 5523 | }; |
| 5524 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5525 | /* update HP, line and mono out pins according to the master switch */ |
| 5526 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5527 | hda_nid_t hp, hda_nid_t line, |
| 5528 | hda_nid_t mono) |
| 5529 | { |
| 5530 | struct alc_spec *spec = codec->spec; |
| 5531 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5532 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5533 | 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] | 5534 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5535 | 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] | 5536 | val); |
| 5537 | /* mono (speaker) depending on the HP jack sense */ |
| 5538 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5539 | 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] | 5540 | val); |
| 5541 | } |
| 5542 | |
| 5543 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5544 | struct snd_ctl_elem_value *ucontrol) |
| 5545 | { |
| 5546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5547 | struct alc_spec *spec = codec->spec; |
| 5548 | *ucontrol->value.integer.value = spec->master_sw; |
| 5549 | return 0; |
| 5550 | } |
| 5551 | |
| 5552 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5553 | struct snd_ctl_elem_value *ucontrol) |
| 5554 | { |
| 5555 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5556 | struct alc_spec *spec = codec->spec; |
| 5557 | int val = !!*ucontrol->value.integer.value; |
| 5558 | hda_nid_t hp, line, mono; |
| 5559 | |
| 5560 | if (val == spec->master_sw) |
| 5561 | return 0; |
| 5562 | spec->master_sw = val; |
| 5563 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5564 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5565 | mono = kcontrol->private_value & 0xff; |
| 5566 | alc260_hp_master_update(codec, hp, line, mono); |
| 5567 | return 1; |
| 5568 | } |
| 5569 | |
| 5570 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5571 | { |
| 5572 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5573 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5574 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5575 | .info = snd_ctl_boolean_mono_info, |
| 5576 | .get = alc260_hp_master_sw_get, |
| 5577 | .put = alc260_hp_master_sw_put, |
| 5578 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5579 | }, |
| 5580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5581 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5582 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5583 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5584 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5585 | HDA_OUTPUT), |
| 5586 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5587 | { } /* end */ |
| 5588 | }; |
| 5589 | |
| 5590 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5591 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5592 | {}, |
| 5593 | }; |
| 5594 | |
| 5595 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5596 | { |
| 5597 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5598 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5599 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5600 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5601 | } |
| 5602 | |
| 5603 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5604 | { |
| 5605 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5606 | alc260_hp_automute(codec); |
| 5607 | } |
| 5608 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5609 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5610 | { |
| 5611 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5612 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5613 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5614 | .info = snd_ctl_boolean_mono_info, |
| 5615 | .get = alc260_hp_master_sw_get, |
| 5616 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5617 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5618 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5619 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5620 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5621 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5622 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5623 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5624 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5625 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5626 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5627 | { } /* end */ |
| 5628 | }; |
| 5629 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5630 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5631 | .ops = &snd_hda_bind_vol, |
| 5632 | .values = { |
| 5633 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5634 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5635 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5636 | 0 |
| 5637 | }, |
| 5638 | }; |
| 5639 | |
| 5640 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5641 | .ops = &snd_hda_bind_sw, |
| 5642 | .values = { |
| 5643 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5644 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5645 | 0 |
| 5646 | }, |
| 5647 | }; |
| 5648 | |
| 5649 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5650 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5651 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5652 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5654 | { } /* end */ |
| 5655 | }; |
| 5656 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5657 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5658 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5659 | {}, |
| 5660 | }; |
| 5661 | |
| 5662 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5663 | { |
| 5664 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5665 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5666 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5667 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5668 | } |
| 5669 | |
| 5670 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5671 | unsigned int res) |
| 5672 | { |
| 5673 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5674 | alc260_hp_3013_automute(codec); |
| 5675 | } |
| 5676 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5677 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5678 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5679 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5680 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5681 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5682 | bits); |
| 5683 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5684 | bits); |
| 5685 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5686 | bits); |
| 5687 | } |
| 5688 | |
| 5689 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5690 | unsigned int res) |
| 5691 | { |
| 5692 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5693 | alc260_hp_3012_automute(codec); |
| 5694 | } |
| 5695 | |
| 5696 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5697 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5698 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5699 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5700 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5701 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5702 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5703 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5704 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5705 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5706 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5707 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5708 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5709 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5710 | { } /* end */ |
| 5711 | }; |
| 5712 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5713 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5714 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5715 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5716 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5717 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5718 | * revisions available in early 2006. Therefore for now allow the |
| 5719 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5720 | * that the lack of mic bias for this NID is intentional we could change the |
| 5721 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5722 | * |
| 5723 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5724 | * don't appear to make the mic bias available from the "line" jack, even |
| 5725 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5726 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5727 | * and the output jack. If this turns out to be the case for all such |
| 5728 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5729 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5730 | * |
| 5731 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5732 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5733 | * controls for such models. On models without a "mono speaker" the control |
| 5734 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5735 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5736 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5737 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5738 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5739 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5740 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5741 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5742 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5743 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5744 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5745 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5748 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5749 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5750 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5751 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5752 | { } /* end */ |
| 5753 | }; |
| 5754 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5755 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5756 | */ |
| 5757 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5758 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5759 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5760 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5761 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5762 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5763 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5764 | { } /* end */ |
| 5765 | }; |
| 5766 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5767 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5768 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5769 | */ |
| 5770 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5771 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5772 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5773 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5774 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5775 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5776 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5777 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5778 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5780 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5781 | { } /* end */ |
| 5782 | }; |
| 5783 | |
| 5784 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5785 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5786 | */ |
| 5787 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5788 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5789 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5792 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5793 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5794 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5796 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5797 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5798 | { } /* end */ |
| 5799 | }; |
| 5800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5801 | /* |
| 5802 | * initialization verbs |
| 5803 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5804 | static struct hda_verb alc260_init_verbs[] = { |
| 5805 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5807 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5808 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5809 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5810 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5811 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5812 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5813 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5815 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5816 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5817 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5818 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5819 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5820 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5821 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5822 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5823 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5824 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5825 | /* set connection select to line in (default select for this ADC) */ |
| 5826 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5827 | /* mute capture amp left and right */ |
| 5828 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5829 | /* set connection select to line in (default select for this ADC) */ |
| 5830 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5831 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5833 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5834 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5835 | /* set vol=0 HP mixer amp left and right */ |
| 5836 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5837 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5838 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5839 | /* set vol=0 Mono mixer amp left and right */ |
| 5840 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5841 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5842 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5843 | /* unmute LINE-2 out pin */ |
| 5844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5845 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5846 | * Line In 2 = 0x03 |
| 5847 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5848 | /* mute analog inputs */ |
| 5849 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5850 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5854 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5855 | /* mute Front out path */ |
| 5856 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5857 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5858 | /* mute Headphone out path */ |
| 5859 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5860 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5861 | /* mute Mono out path */ |
| 5862 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5863 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5864 | { } |
| 5865 | }; |
| 5866 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5867 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5868 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5869 | /* Headphone and output */ |
| 5870 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5871 | /* mono output */ |
| 5872 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5873 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5874 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5875 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5876 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5877 | /* Line In pin widget for input */ |
| 5878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5879 | /* Line-2 pin widget for output */ |
| 5880 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5881 | /* CD pin widget for input */ |
| 5882 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5883 | /* unmute amp left and right */ |
| 5884 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5885 | /* set connection select to line in (default select for this ADC) */ |
| 5886 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5887 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5888 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5889 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5891 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5892 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5893 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5894 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5895 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5896 | * Line In 2 = 0x03 |
| 5897 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5898 | /* mute analog inputs */ |
| 5899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5904 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5905 | /* Unmute Front out path */ |
| 5906 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5907 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5908 | /* Unmute Headphone out path */ |
| 5909 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5910 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5911 | /* Unmute Mono out path */ |
| 5912 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5913 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5914 | { } |
| 5915 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5916 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5917 | |
| 5918 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5919 | /* Line out and output */ |
| 5920 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5921 | /* mono output */ |
| 5922 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5923 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5924 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5925 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5926 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5927 | /* Line In pin widget for input */ |
| 5928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5929 | /* Headphone pin widget for output */ |
| 5930 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5931 | /* CD pin widget for input */ |
| 5932 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5933 | /* unmute amp left and right */ |
| 5934 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5935 | /* set connection select to line in (default select for this ADC) */ |
| 5936 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5937 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5938 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5939 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5941 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5942 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5943 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5944 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5945 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5946 | * Line In 2 = 0x03 |
| 5947 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5948 | /* mute analog inputs */ |
| 5949 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5950 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5951 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5954 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5955 | /* Unmute Front out path */ |
| 5956 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5957 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5958 | /* Unmute Headphone out path */ |
| 5959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5960 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5961 | /* Unmute Mono out path */ |
| 5962 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5963 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5964 | { } |
| 5965 | }; |
| 5966 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5967 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5968 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5969 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5970 | */ |
| 5971 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5972 | /* Disable all GPIOs */ |
| 5973 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5974 | /* Internal speaker is connected to headphone pin */ |
| 5975 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5976 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5977 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5978 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5979 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5980 | /* Ensure all other unused pins are disabled and muted. */ |
| 5981 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5983 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5984 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5985 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5986 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5987 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5988 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5989 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5990 | /* Disable digital (SPDIF) pins */ |
| 5991 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5992 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5993 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5994 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5995 | * when acting as an output. |
| 5996 | */ |
| 5997 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5998 | |
| 5999 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6000 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6001 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6003 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6004 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6005 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6006 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6007 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6008 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6009 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6010 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6011 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6012 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6013 | * If the pin mode is changed by the user the pin mode control will |
| 6014 | * take care of enabling the pin's input/output buffers as needed. |
| 6015 | * Therefore there's no need to enable the input buffer at this |
| 6016 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6017 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6018 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6019 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6020 | * mixer ctrl) |
| 6021 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6022 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6023 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6024 | /* Mute capture amp left and right */ |
| 6025 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6026 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6027 | * in (on mic1 pin) |
| 6028 | */ |
| 6029 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6030 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6031 | /* Do the same for the second ADC: mute capture input amp and |
| 6032 | * set ADC connection to line in (on mic1 pin) |
| 6033 | */ |
| 6034 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6035 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6036 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6037 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6038 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6039 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6040 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6041 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6042 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6043 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6045 | {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] | 6046 | |
| 6047 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6048 | }; |
| 6049 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6050 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6051 | * similar laptops (adapted from Fujitsu init verbs). |
| 6052 | */ |
| 6053 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6054 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6055 | * the headphone jack. Turn this on and rely on the standard mute |
| 6056 | * methods whenever the user wants to turn these outputs off. |
| 6057 | */ |
| 6058 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6059 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6060 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6061 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6062 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6063 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6064 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6065 | /* Line In jack is connected to Line1 pin */ |
| 6066 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6067 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6068 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6069 | /* Ensure all other unused pins are disabled and muted. */ |
| 6070 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6071 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6072 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6073 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6076 | /* Disable digital (SPDIF) pins */ |
| 6077 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6078 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6079 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6080 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6081 | * bus when acting as outputs. |
| 6082 | */ |
| 6083 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6084 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6085 | |
| 6086 | /* Start with output sum widgets muted and their output gains at min */ |
| 6087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6088 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6089 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6091 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6092 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6093 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6094 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6095 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6097 | /* Unmute Line-out pin widget amp left and right |
| 6098 | * (no equiv mixer ctrl) |
| 6099 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6100 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6101 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6102 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6103 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6104 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6105 | * will take care of enabling the pin's input/output buffers as needed. |
| 6106 | * Therefore there's no need to enable the input buffer at this |
| 6107 | * stage. |
| 6108 | */ |
| 6109 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6110 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6111 | |
| 6112 | /* Mute capture amp left and right */ |
| 6113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6114 | /* Set ADC connection select to match default mixer setting - mic |
| 6115 | * (on mic1 pin) |
| 6116 | */ |
| 6117 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6118 | |
| 6119 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6120 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6121 | */ |
| 6122 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6123 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6124 | |
| 6125 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6134 | |
| 6135 | { } |
| 6136 | }; |
| 6137 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6138 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6139 | * (adapted from Acer init verbs). |
| 6140 | */ |
| 6141 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6142 | /* GPIO 0 enables the output jack. |
| 6143 | * Turn this on and rely on the standard mute |
| 6144 | * methods whenever the user wants to turn these outputs off. |
| 6145 | */ |
| 6146 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6147 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6148 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6149 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6150 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6151 | /* Ensure all other unused pins are disabled and muted. */ |
| 6152 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6153 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6154 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6155 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6156 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6157 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6158 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6160 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6161 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6162 | /* Disable digital (SPDIF) pins */ |
| 6163 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6164 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6165 | |
| 6166 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6167 | * bus when acting as outputs. |
| 6168 | */ |
| 6169 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6170 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6171 | |
| 6172 | /* Start with output sum widgets muted and their output gains at min */ |
| 6173 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6175 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6176 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6177 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6178 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6179 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6180 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6181 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6182 | |
| 6183 | /* Unmute Line-out pin widget amp left and right |
| 6184 | * (no equiv mixer ctrl) |
| 6185 | */ |
| 6186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6187 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6188 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6189 | * will take care of enabling the pin's input/output buffers as needed. |
| 6190 | * Therefore there's no need to enable the input buffer at this |
| 6191 | * stage. |
| 6192 | */ |
| 6193 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6194 | |
| 6195 | /* Mute capture amp left and right */ |
| 6196 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6197 | /* Set ADC connection select to match default mixer setting - mic |
| 6198 | * (on mic1 pin) |
| 6199 | */ |
| 6200 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6201 | |
| 6202 | /* Do similar with the second ADC: mute capture input amp and |
| 6203 | * set ADC connection to mic to match ALSA's default state. |
| 6204 | */ |
| 6205 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6206 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6207 | |
| 6208 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6209 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6210 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6211 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6212 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6213 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6214 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6215 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6217 | |
| 6218 | { } |
| 6219 | }; |
| 6220 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6221 | static struct hda_verb alc260_will_verbs[] = { |
| 6222 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6223 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6224 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6225 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6226 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6227 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6228 | {} |
| 6229 | }; |
| 6230 | |
| 6231 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6232 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6233 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6234 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6235 | |
| 6236 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6237 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6238 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6239 | |
| 6240 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6241 | {} |
| 6242 | }; |
| 6243 | |
| 6244 | /* toggle speaker-output according to the hp-jack state */ |
| 6245 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6246 | { |
| 6247 | unsigned int present; |
| 6248 | |
| 6249 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6250 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6251 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6252 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6253 | AC_VERB_SET_GPIO_DATA, 1); |
| 6254 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6255 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6256 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6257 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6258 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6259 | AC_VERB_SET_GPIO_DATA, 0); |
| 6260 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6261 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6262 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6263 | } |
| 6264 | } |
| 6265 | |
| 6266 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6267 | unsigned int res) |
| 6268 | { |
| 6269 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6270 | alc260_replacer_672v_automute(codec); |
| 6271 | } |
| 6272 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6273 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6274 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6275 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6276 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6277 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6278 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6279 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6280 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6281 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6282 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6283 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6284 | {} |
| 6285 | }; |
| 6286 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6287 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6288 | * configuration. |
| 6289 | */ |
| 6290 | #ifdef CONFIG_SND_DEBUG |
| 6291 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6292 | 0x02, |
| 6293 | }; |
| 6294 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6295 | 0x04, 0x05, |
| 6296 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6297 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6298 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6299 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6300 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6301 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6302 | { |
| 6303 | .num_items = 7, |
| 6304 | .items = { |
| 6305 | { "MIC1 pin", 0x0 }, |
| 6306 | { "MIC2 pin", 0x1 }, |
| 6307 | { "LINE1 pin", 0x2 }, |
| 6308 | { "LINE2 pin", 0x3 }, |
| 6309 | { "CD pin", 0x4 }, |
| 6310 | { "LINE-OUT pin", 0x5 }, |
| 6311 | { "HP-OUT pin", 0x6 }, |
| 6312 | }, |
| 6313 | }, |
| 6314 | { |
| 6315 | .num_items = 8, |
| 6316 | .items = { |
| 6317 | { "MIC1 pin", 0x0 }, |
| 6318 | { "MIC2 pin", 0x1 }, |
| 6319 | { "LINE1 pin", 0x2 }, |
| 6320 | { "LINE2 pin", 0x3 }, |
| 6321 | { "CD pin", 0x4 }, |
| 6322 | { "Mixer", 0x5 }, |
| 6323 | { "LINE-OUT pin", 0x6 }, |
| 6324 | { "HP-OUT pin", 0x7 }, |
| 6325 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6326 | }, |
| 6327 | }; |
| 6328 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6329 | /* Output driver widgets */ |
| 6330 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6331 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6332 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6333 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6334 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6335 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6336 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6337 | /* Modes for retasking pin widgets |
| 6338 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6339 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6340 | * mention this restriction. At this stage it's not clear whether |
| 6341 | * this behaviour is intentional or is a hardware bug in chip |
| 6342 | * revisions available at least up until early 2006. Therefore for |
| 6343 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6344 | * choices, but if it turns out that the lack of mic bias for these |
| 6345 | * NIDs is intentional we could change their modes from |
| 6346 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6347 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6348 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6349 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6350 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6351 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6352 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6353 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6354 | |
| 6355 | /* Loopback mixer controls */ |
| 6356 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6357 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6358 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6359 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6360 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6361 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6362 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6363 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6365 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6366 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6367 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6368 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6369 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6370 | |
| 6371 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6372 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6373 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6374 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6375 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6376 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6377 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6378 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6379 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6380 | */ |
| 6381 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6382 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6383 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6384 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6385 | * this output to turn on an external amplifier. |
| 6386 | */ |
| 6387 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6388 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6389 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6390 | { } /* end */ |
| 6391 | }; |
| 6392 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6393 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6394 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6395 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6396 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6397 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6398 | /* Enable retasking pins as output, initially without power amp */ |
| 6399 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6400 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6402 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6403 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6404 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6405 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6406 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6407 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6408 | * payload also sets the generation to 0, output to be in "consumer" |
| 6409 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6410 | * control. |
| 6411 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6412 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6413 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6414 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6415 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6416 | * OUT1 sum bus when acting as an output. |
| 6417 | */ |
| 6418 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6419 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6420 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6421 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6422 | |
| 6423 | /* Start with output sum widgets muted and their output gains at min */ |
| 6424 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6425 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6426 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6427 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6428 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6429 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6430 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6431 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6432 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6433 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6434 | /* Unmute retasking pin widget output buffers since the default |
| 6435 | * state appears to be output. As the pin mode is changed by the |
| 6436 | * user the pin mode control will take care of enabling the pin's |
| 6437 | * input/output buffers as needed. |
| 6438 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6439 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6440 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6441 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6442 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6443 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6444 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6445 | /* Also unmute the mono-out pin widget */ |
| 6446 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6447 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6448 | /* Mute capture amp left and right */ |
| 6449 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6450 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6451 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6452 | */ |
| 6453 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6454 | |
| 6455 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6456 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6457 | */ |
| 6458 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6459 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6460 | |
| 6461 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6463 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6464 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6465 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6466 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6467 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6468 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6469 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6470 | |
| 6471 | { } |
| 6472 | }; |
| 6473 | #endif |
| 6474 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6475 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6476 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6477 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6478 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6479 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6480 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6481 | /* |
| 6482 | * for BIOS auto-configuration |
| 6483 | */ |
| 6484 | |
| 6485 | 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] | 6486 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6487 | { |
| 6488 | hda_nid_t nid_vol; |
| 6489 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | int err; |
| 6491 | |
| 6492 | if (nid >= 0x0f && nid < 0x11) { |
| 6493 | nid_vol = nid - 0x7; |
| 6494 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6495 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6496 | } else if (nid == 0x11) { |
| 6497 | nid_vol = nid - 0x7; |
| 6498 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6499 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6500 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6501 | nid_vol = 0x08; |
| 6502 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6503 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6504 | } else |
| 6505 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6506 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6507 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6508 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6509 | 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] | 6510 | if (err < 0) |
| 6511 | return err; |
| 6512 | *vol_bits |= (1 << nid_vol); |
| 6513 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6514 | 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] | 6515 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6516 | return err; |
| 6517 | return 1; |
| 6518 | } |
| 6519 | |
| 6520 | /* add playback controls from the parsed DAC table */ |
| 6521 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6522 | const struct auto_pin_cfg *cfg) |
| 6523 | { |
| 6524 | hda_nid_t nid; |
| 6525 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6526 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6527 | |
| 6528 | spec->multiout.num_dacs = 1; |
| 6529 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6530 | spec->multiout.dac_nids[0] = 0x02; |
| 6531 | |
| 6532 | nid = cfg->line_out_pins[0]; |
| 6533 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6534 | const char *pfx; |
| 6535 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6536 | pfx = "Master"; |
| 6537 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6538 | pfx = "Speaker"; |
| 6539 | else |
| 6540 | pfx = "Front"; |
| 6541 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6542 | if (err < 0) |
| 6543 | return err; |
| 6544 | } |
| 6545 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6546 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6547 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6548 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6549 | if (err < 0) |
| 6550 | return err; |
| 6551 | } |
| 6552 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6553 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6554 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6555 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6556 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6557 | if (err < 0) |
| 6558 | return err; |
| 6559 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6560 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6561 | } |
| 6562 | |
| 6563 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6564 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6565 | const struct auto_pin_cfg *cfg) |
| 6566 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6567 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6568 | } |
| 6569 | |
| 6570 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6571 | hda_nid_t nid, int pin_type, |
| 6572 | int sel_idx) |
| 6573 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6574 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6575 | /* need the manual connection? */ |
| 6576 | if (nid >= 0x12) { |
| 6577 | int idx = nid - 0x12; |
| 6578 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6579 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6580 | } |
| 6581 | } |
| 6582 | |
| 6583 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6584 | { |
| 6585 | struct alc_spec *spec = codec->spec; |
| 6586 | hda_nid_t nid; |
| 6587 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6588 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6589 | if (nid) { |
| 6590 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6591 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6592 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6593 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6594 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6595 | if (nid) |
| 6596 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6597 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6598 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6599 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6600 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6601 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6602 | |
| 6603 | #define ALC260_PIN_CD_NID 0x16 |
| 6604 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6605 | { |
| 6606 | struct alc_spec *spec = codec->spec; |
| 6607 | int i; |
| 6608 | |
| 6609 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6610 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6611 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6612 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6613 | if (nid != ALC260_PIN_CD_NID && |
| 6614 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6615 | snd_hda_codec_write(codec, nid, 0, |
| 6616 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6617 | AMP_OUT_MUTE); |
| 6618 | } |
| 6619 | } |
| 6620 | } |
| 6621 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6622 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6623 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6624 | /* |
| 6625 | * generic initialization of ADC, input mixers and output mixers |
| 6626 | */ |
| 6627 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6628 | /* |
| 6629 | * Unmute ADC0-1 and set the default input to mic-in |
| 6630 | */ |
| 6631 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6633 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6634 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6636 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6637 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6638 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6639 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | */ |
| 6641 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6642 | /* mute analog inputs */ |
| 6643 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6644 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6646 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6648 | |
| 6649 | /* |
| 6650 | * Set up output mixers (0x08 - 0x0a) |
| 6651 | */ |
| 6652 | /* set vol=0 to output mixers */ |
| 6653 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6654 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6655 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6656 | /* set up input amps for analog loopback */ |
| 6657 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6661 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6662 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6663 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6665 | { } |
| 6666 | }; |
| 6667 | |
| 6668 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6669 | { |
| 6670 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6671 | int err; |
| 6672 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6673 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6674 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6675 | alc260_ignore); |
| 6676 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6677 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6678 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6679 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6680 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6681 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6682 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6683 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6684 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6685 | return err; |
| 6686 | |
| 6687 | spec->multiout.max_channels = 2; |
| 6688 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6689 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6690 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6691 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6692 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6693 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6694 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6695 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6696 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6697 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6698 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6699 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6700 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6701 | return 1; |
| 6702 | } |
| 6703 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6704 | /* additional initialization for auto-configuration model */ |
| 6705 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6706 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6707 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6708 | alc260_auto_init_multi_out(codec); |
| 6709 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6710 | alc260_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6711 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6712 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6713 | } |
| 6714 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6715 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6716 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6717 | { 0x07, HDA_INPUT, 0 }, |
| 6718 | { 0x07, HDA_INPUT, 1 }, |
| 6719 | { 0x07, HDA_INPUT, 2 }, |
| 6720 | { 0x07, HDA_INPUT, 3 }, |
| 6721 | { 0x07, HDA_INPUT, 4 }, |
| 6722 | { } /* end */ |
| 6723 | }; |
| 6724 | #endif |
| 6725 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6726 | /* |
| 6727 | * ALC260 configurations |
| 6728 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6729 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6730 | [ALC260_BASIC] = "basic", |
| 6731 | [ALC260_HP] = "hp", |
| 6732 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6733 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6734 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6735 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6736 | [ALC260_WILL] = "will", |
| 6737 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6738 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6739 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6740 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6741 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6742 | [ALC260_AUTO] = "auto", |
| 6743 | }; |
| 6744 | |
| 6745 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6746 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6747 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6748 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6749 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6750 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6751 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6752 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6753 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6754 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6755 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6756 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6757 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6758 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6759 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6760 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6761 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6762 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6763 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6764 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6765 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6766 | {} |
| 6767 | }; |
| 6768 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6769 | static struct alc_config_preset alc260_presets[] = { |
| 6770 | [ALC260_BASIC] = { |
| 6771 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6772 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6773 | .init_verbs = { alc260_init_verbs }, |
| 6774 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6775 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6776 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6777 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6779 | .channel_mode = alc260_modes, |
| 6780 | .input_mux = &alc260_capture_source, |
| 6781 | }, |
| 6782 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6783 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6784 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6785 | .init_verbs = { alc260_init_verbs, |
| 6786 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6787 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6788 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6789 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6790 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6791 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6792 | .channel_mode = alc260_modes, |
| 6793 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6794 | .unsol_event = alc260_hp_unsol_event, |
| 6795 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6796 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6797 | [ALC260_HP_DC7600] = { |
| 6798 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6799 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6800 | .init_verbs = { alc260_init_verbs, |
| 6801 | alc260_hp_dc7600_verbs }, |
| 6802 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6803 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6804 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6805 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6806 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6807 | .channel_mode = alc260_modes, |
| 6808 | .input_mux = &alc260_capture_source, |
| 6809 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6810 | .init_hook = alc260_hp_3012_automute, |
| 6811 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6812 | [ALC260_HP_3013] = { |
| 6813 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6814 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6815 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6816 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6817 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6818 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6819 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6820 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6821 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6822 | .channel_mode = alc260_modes, |
| 6823 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6824 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6825 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6826 | }, |
| 6827 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6828 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6829 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6830 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6831 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6832 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6833 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6834 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6835 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6836 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6837 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6838 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6839 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6840 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6841 | .init_verbs = { alc260_acer_init_verbs }, |
| 6842 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6843 | .dac_nids = alc260_dac_nids, |
| 6844 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6845 | .adc_nids = alc260_dual_adc_nids, |
| 6846 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6847 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6848 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6849 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6850 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6851 | [ALC260_FAVORIT100] = { |
| 6852 | .mixers = { alc260_favorit100_mixer }, |
| 6853 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6854 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6855 | .dac_nids = alc260_dac_nids, |
| 6856 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6857 | .adc_nids = alc260_dual_adc_nids, |
| 6858 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6859 | .channel_mode = alc260_modes, |
| 6860 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6861 | .input_mux = alc260_favorit100_capture_sources, |
| 6862 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6863 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6864 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6865 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6866 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6867 | .dac_nids = alc260_dac_nids, |
| 6868 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6869 | .adc_nids = alc260_adc_nids, |
| 6870 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6871 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6872 | .channel_mode = alc260_modes, |
| 6873 | .input_mux = &alc260_capture_source, |
| 6874 | }, |
| 6875 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6876 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6877 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6878 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6879 | .dac_nids = alc260_dac_nids, |
| 6880 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6881 | .adc_nids = alc260_adc_nids, |
| 6882 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6883 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6884 | .channel_mode = alc260_modes, |
| 6885 | .input_mux = &alc260_capture_source, |
| 6886 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6887 | .init_hook = alc260_replacer_672v_automute, |
| 6888 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6889 | #ifdef CONFIG_SND_DEBUG |
| 6890 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6891 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6892 | .init_verbs = { alc260_test_init_verbs }, |
| 6893 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6894 | .dac_nids = alc260_test_dac_nids, |
| 6895 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6896 | .adc_nids = alc260_test_adc_nids, |
| 6897 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6898 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6899 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6900 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6901 | }, |
| 6902 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6903 | }; |
| 6904 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6905 | static int patch_alc260(struct hda_codec *codec) |
| 6906 | { |
| 6907 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6908 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6909 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6910 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6911 | if (spec == NULL) |
| 6912 | return -ENOMEM; |
| 6913 | |
| 6914 | codec->spec = spec; |
| 6915 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6916 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6917 | alc260_models, |
| 6918 | alc260_cfg_tbl); |
| 6919 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6920 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6921 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6922 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6923 | } |
| 6924 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6925 | if (board_config == ALC260_AUTO) { |
| 6926 | /* automatic parse from the BIOS config */ |
| 6927 | err = alc260_parse_auto_config(codec); |
| 6928 | if (err < 0) { |
| 6929 | alc_free(codec); |
| 6930 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6931 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6932 | printk(KERN_INFO |
| 6933 | "hda_codec: Cannot set up configuration " |
| 6934 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6935 | board_config = ALC260_BASIC; |
| 6936 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6937 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6938 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6939 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6940 | if (err < 0) { |
| 6941 | alc_free(codec); |
| 6942 | return err; |
| 6943 | } |
| 6944 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6945 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6946 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6947 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6948 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6949 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6950 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6951 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6952 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6953 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6954 | if (!spec->adc_nids && spec->input_mux) { |
| 6955 | /* check whether NID 0x04 is valid */ |
| 6956 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6957 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6958 | /* get type */ |
| 6959 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6960 | spec->adc_nids = alc260_adc_nids_alt; |
| 6961 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6962 | } else { |
| 6963 | spec->adc_nids = alc260_adc_nids; |
| 6964 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6965 | } |
| 6966 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6967 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6968 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6969 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6970 | spec->vmaster_nid = 0x08; |
| 6971 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6972 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6973 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6974 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6975 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6976 | if (!spec->loopback.amplist) |
| 6977 | spec->loopback.amplist = alc260_loopbacks; |
| 6978 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6979 | |
| 6980 | return 0; |
| 6981 | } |
| 6982 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6983 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6984 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6985 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6986 | * |
| 6987 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6988 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6989 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6990 | * 6-channel independent captures. |
| 6991 | * |
| 6992 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6993 | * driver yet). |
| 6994 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6995 | #define ALC882_DIGOUT_NID 0x06 |
| 6996 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6997 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6998 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6999 | #define ALC1200_DIGOUT_NID 0x10 |
| 7000 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7001 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7002 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7003 | { 8, NULL } |
| 7004 | }; |
| 7005 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7006 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7007 | static hda_nid_t alc882_dac_nids[4] = { |
| 7008 | /* front, rear, clfe, rear_surr */ |
| 7009 | 0x02, 0x03, 0x04, 0x05 |
| 7010 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7011 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7012 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7013 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7014 | #define alc882_adc_nids alc880_adc_nids |
| 7015 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7016 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7017 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7018 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7019 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7020 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7021 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7022 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7023 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7024 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7025 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7026 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7027 | /* input MUX */ |
| 7028 | /* FIXME: should be a matrix-type input source selection */ |
| 7029 | |
| 7030 | static struct hda_input_mux alc882_capture_source = { |
| 7031 | .num_items = 4, |
| 7032 | .items = { |
| 7033 | { "Mic", 0x0 }, |
| 7034 | { "Front Mic", 0x1 }, |
| 7035 | { "Line", 0x2 }, |
| 7036 | { "CD", 0x4 }, |
| 7037 | }, |
| 7038 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7039 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7040 | #define alc883_capture_source alc882_capture_source |
| 7041 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7042 | static struct hda_input_mux alc889_capture_source = { |
| 7043 | .num_items = 3, |
| 7044 | .items = { |
| 7045 | { "Front Mic", 0x0 }, |
| 7046 | { "Mic", 0x3 }, |
| 7047 | { "Line", 0x2 }, |
| 7048 | }, |
| 7049 | }; |
| 7050 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7051 | static struct hda_input_mux mb5_capture_source = { |
| 7052 | .num_items = 3, |
| 7053 | .items = { |
| 7054 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7055 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7056 | { "CD", 0x4 }, |
| 7057 | }, |
| 7058 | }; |
| 7059 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7060 | static struct hda_input_mux macmini3_capture_source = { |
| 7061 | .num_items = 2, |
| 7062 | .items = { |
| 7063 | { "Line", 0x2 }, |
| 7064 | { "CD", 0x4 }, |
| 7065 | }, |
| 7066 | }; |
| 7067 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7068 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7069 | .num_items = 4, |
| 7070 | .items = { |
| 7071 | { "Mic", 0x1 }, |
| 7072 | { "Front Mic", 0x0 }, |
| 7073 | { "Line", 0x2 }, |
| 7074 | { "CD", 0x4 }, |
| 7075 | }, |
| 7076 | }; |
| 7077 | |
| 7078 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7079 | .num_items = 2, |
| 7080 | .items = { |
| 7081 | { "Mic", 0x1 }, |
| 7082 | { "Line", 0x2 }, |
| 7083 | }, |
| 7084 | }; |
| 7085 | |
| 7086 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7087 | .num_items = 4, |
| 7088 | .items = { |
| 7089 | { "Mic", 0x0 }, |
| 7090 | { "iMic", 0x1 }, |
| 7091 | { "Line", 0x2 }, |
| 7092 | { "CD", 0x4 }, |
| 7093 | }, |
| 7094 | }; |
| 7095 | |
| 7096 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7097 | .num_items = 2, |
| 7098 | .items = { |
| 7099 | { "Mic", 0x0 }, |
| 7100 | { "Int Mic", 0x1 }, |
| 7101 | }, |
| 7102 | }; |
| 7103 | |
| 7104 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7105 | .num_items = 3, |
| 7106 | .items = { |
| 7107 | { "Mic", 0x0 }, |
| 7108 | { "Front Mic", 0x1 }, |
| 7109 | { "Line", 0x4 }, |
| 7110 | }, |
| 7111 | }; |
| 7112 | |
| 7113 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7114 | .num_items = 2, |
| 7115 | .items = { |
| 7116 | { "Mic", 0x0 }, |
| 7117 | { "Line", 0x2 }, |
| 7118 | }, |
| 7119 | }; |
| 7120 | |
| 7121 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7122 | .num_items = 2, |
| 7123 | .items = { |
| 7124 | { "Mic", 0x0 }, |
| 7125 | /* Front Mic (0x01) unused */ |
| 7126 | { "Line", 0x2 }, |
| 7127 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7128 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7129 | }, |
| 7130 | }; |
| 7131 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7132 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7133 | .num_items = 2, |
| 7134 | .items = { |
| 7135 | { "Mic", 0x01 }, |
| 7136 | { "Line", 0x2 }, /* Not sure! */ |
| 7137 | }, |
| 7138 | }; |
| 7139 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7140 | /* |
| 7141 | * 2ch mode |
| 7142 | */ |
| 7143 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7144 | { 2, NULL } |
| 7145 | }; |
| 7146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7147 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7148 | * 2ch mode |
| 7149 | */ |
| 7150 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7151 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7152 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7153 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7154 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7155 | { } /* end */ |
| 7156 | }; |
| 7157 | |
| 7158 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7159 | * 4ch mode |
| 7160 | */ |
| 7161 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7162 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7163 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7164 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7165 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7166 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7167 | { } /* end */ |
| 7168 | }; |
| 7169 | |
| 7170 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7171 | * 6ch mode |
| 7172 | */ |
| 7173 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7174 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7175 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7176 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7177 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7178 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7179 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7180 | { } /* end */ |
| 7181 | }; |
| 7182 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7183 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7184 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7185 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7186 | { 6, alc882_3ST_ch6_init }, |
| 7187 | }; |
| 7188 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7189 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7190 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7191 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7192 | * 2ch mode |
| 7193 | */ |
| 7194 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7195 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7196 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7197 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7198 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7199 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7200 | { } /* end */ |
| 7201 | }; |
| 7202 | |
| 7203 | /* |
| 7204 | * 4ch mode |
| 7205 | */ |
| 7206 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7207 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7208 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7209 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7210 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7211 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7212 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7213 | { } /* end */ |
| 7214 | }; |
| 7215 | |
| 7216 | /* |
| 7217 | * 6ch mode |
| 7218 | */ |
| 7219 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7220 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7221 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7222 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7223 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7224 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7225 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7226 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7227 | { } /* end */ |
| 7228 | }; |
| 7229 | |
| 7230 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7231 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7232 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7233 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7234 | }; |
| 7235 | |
| 7236 | |
| 7237 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7238 | * 6ch mode |
| 7239 | */ |
| 7240 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7241 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7242 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7243 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7244 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7245 | { } /* end */ |
| 7246 | }; |
| 7247 | |
| 7248 | /* |
| 7249 | * 8ch mode |
| 7250 | */ |
| 7251 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7252 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7253 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7254 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7255 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7256 | { } /* end */ |
| 7257 | }; |
| 7258 | |
| 7259 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7260 | { 6, alc882_sixstack_ch6_init }, |
| 7261 | { 8, alc882_sixstack_ch8_init }, |
| 7262 | }; |
| 7263 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7264 | |
| 7265 | /* Macbook Air 2,1 */ |
| 7266 | |
| 7267 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7268 | { 2, NULL }, |
| 7269 | }; |
| 7270 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7271 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7272 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7273 | */ |
| 7274 | |
| 7275 | /* |
| 7276 | * 2ch mode |
| 7277 | */ |
| 7278 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7279 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7280 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7281 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7282 | { } /* end */ |
| 7283 | }; |
| 7284 | |
| 7285 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7286 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7287 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7288 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7289 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7290 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7291 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7292 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7293 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7294 | { } /* end */ |
| 7295 | }; |
| 7296 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7297 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7298 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7299 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7300 | }; |
| 7301 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7302 | /* |
| 7303 | * 2ch |
| 7304 | * Speakers/Woofer/HP = Front |
| 7305 | * LineIn = Input |
| 7306 | */ |
| 7307 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7310 | { } /* end */ |
| 7311 | }; |
| 7312 | |
| 7313 | /* |
| 7314 | * 6ch mode |
| 7315 | * Speakers/HP = Front |
| 7316 | * Woofer = LFE |
| 7317 | * LineIn = Surround |
| 7318 | */ |
| 7319 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7320 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7321 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7323 | { } /* end */ |
| 7324 | }; |
| 7325 | |
| 7326 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7327 | { 2, alc885_mb5_ch2_init }, |
| 7328 | { 6, alc885_mb5_ch6_init }, |
| 7329 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7330 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7331 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7332 | |
| 7333 | /* |
| 7334 | * 2ch mode |
| 7335 | */ |
| 7336 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7337 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7338 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7341 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7342 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7343 | { } /* end */ |
| 7344 | }; |
| 7345 | |
| 7346 | /* |
| 7347 | * 4ch mode |
| 7348 | */ |
| 7349 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7350 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7351 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7352 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7353 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7354 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7355 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7356 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7357 | { } /* end */ |
| 7358 | }; |
| 7359 | |
| 7360 | /* |
| 7361 | * 6ch mode |
| 7362 | */ |
| 7363 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7364 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7365 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7366 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7367 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7368 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7369 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7370 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7371 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7372 | { } /* end */ |
| 7373 | }; |
| 7374 | |
| 7375 | /* |
| 7376 | * 8ch mode |
| 7377 | */ |
| 7378 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7379 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7380 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7381 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7382 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7383 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7384 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7385 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7386 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7387 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7388 | { } /* end */ |
| 7389 | }; |
| 7390 | |
| 7391 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7392 | { 2, alc883_4ST_ch2_init }, |
| 7393 | { 4, alc883_4ST_ch4_init }, |
| 7394 | { 6, alc883_4ST_ch6_init }, |
| 7395 | { 8, alc883_4ST_ch8_init }, |
| 7396 | }; |
| 7397 | |
| 7398 | |
| 7399 | /* |
| 7400 | * 2ch mode |
| 7401 | */ |
| 7402 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7403 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7404 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7405 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7406 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7407 | { } /* end */ |
| 7408 | }; |
| 7409 | |
| 7410 | /* |
| 7411 | * 4ch mode |
| 7412 | */ |
| 7413 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7414 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7415 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7416 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7417 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7418 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7419 | { } /* end */ |
| 7420 | }; |
| 7421 | |
| 7422 | /* |
| 7423 | * 6ch mode |
| 7424 | */ |
| 7425 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7426 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7427 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7428 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7429 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7430 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7431 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7432 | { } /* end */ |
| 7433 | }; |
| 7434 | |
| 7435 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7436 | { 2, alc883_3ST_ch2_intel_init }, |
| 7437 | { 4, alc883_3ST_ch4_intel_init }, |
| 7438 | { 6, alc883_3ST_ch6_intel_init }, |
| 7439 | }; |
| 7440 | |
| 7441 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7442 | * 2ch mode |
| 7443 | */ |
| 7444 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7445 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7446 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7447 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7448 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7449 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7450 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7451 | { } /* end */ |
| 7452 | }; |
| 7453 | |
| 7454 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7455 | * 6ch mode |
| 7456 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7457 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7458 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7459 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7460 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7461 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7462 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7463 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7464 | { } /* end */ |
| 7465 | }; |
| 7466 | |
| 7467 | /* |
| 7468 | * 8ch mode |
| 7469 | */ |
| 7470 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7471 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7472 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7473 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7474 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7475 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7476 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7477 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7478 | { } /* end */ |
| 7479 | }; |
| 7480 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7481 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7482 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7483 | { 6, alc889_ch6_intel_init }, |
| 7484 | { 8, alc889_ch8_intel_init }, |
| 7485 | }; |
| 7486 | |
| 7487 | /* |
| 7488 | * 6ch mode |
| 7489 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7490 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7491 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7492 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7493 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7494 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7495 | { } /* end */ |
| 7496 | }; |
| 7497 | |
| 7498 | /* |
| 7499 | * 8ch mode |
| 7500 | */ |
| 7501 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7502 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7503 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7504 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7505 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7506 | { } /* end */ |
| 7507 | }; |
| 7508 | |
| 7509 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7510 | { 6, alc883_sixstack_ch6_init }, |
| 7511 | { 8, alc883_sixstack_ch8_init }, |
| 7512 | }; |
| 7513 | |
| 7514 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7515 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7516 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7517 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7518 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7519 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7520 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7521 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7522 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7523 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7524 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7525 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7526 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7527 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7528 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7529 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7531 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7532 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7533 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7535 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7536 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7537 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7538 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7539 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7540 | { } /* end */ |
| 7541 | }; |
| 7542 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7543 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7544 | |
| 7545 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7546 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7547 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7548 | { } |
| 7549 | }; |
| 7550 | |
| 7551 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7552 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7553 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7554 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7555 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7556 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7557 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7558 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7559 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7561 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7562 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7564 | { } /* end */ |
| 7565 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7566 | |
| 7567 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7569 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7571 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7572 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7573 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7574 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7575 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7576 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7577 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7579 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7580 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7582 | { } /* end */ |
| 7583 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7584 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7585 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7586 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7587 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7588 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7589 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7590 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7591 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7592 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7593 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7594 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7595 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7596 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7597 | { } /* end */ |
| 7598 | }; |
| 7599 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7600 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7601 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7602 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7603 | { } /* end */ |
| 7604 | }; |
| 7605 | |
| 7606 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7607 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7609 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7611 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7612 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7613 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7614 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7615 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7617 | { } /* end */ |
| 7618 | }; |
| 7619 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7620 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7622 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7623 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7624 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7625 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7628 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7630 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7631 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7632 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7633 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7634 | { } /* end */ |
| 7635 | }; |
| 7636 | |
| 7637 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7638 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7639 | */ |
| 7640 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7641 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7642 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7643 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7644 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7645 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7646 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7647 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7648 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7649 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7650 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7653 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7654 | { } /* end */ |
| 7655 | }; |
| 7656 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7657 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7658 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7659 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7660 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7661 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7662 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7666 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7668 | { } /* end */ |
| 7669 | }; |
| 7670 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7671 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7672 | { |
| 7673 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7674 | .name = "Channel Mode", |
| 7675 | .info = alc_ch_mode_info, |
| 7676 | .get = alc_ch_mode_get, |
| 7677 | .put = alc_ch_mode_put, |
| 7678 | }, |
| 7679 | { } /* end */ |
| 7680 | }; |
| 7681 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7682 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7683 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7684 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7685 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7686 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7687 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7689 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7690 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7691 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7692 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7693 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7694 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7695 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7696 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7697 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7698 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7699 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7700 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7703 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7704 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7705 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7706 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7707 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7708 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7709 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7710 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7711 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7712 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7713 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7714 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7715 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7716 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7717 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7718 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7719 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7720 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7721 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7723 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7724 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7725 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7726 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7727 | |
| 7728 | /* FIXME: use matrix-type input source selection */ |
| 7729 | /* 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] | 7730 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7731 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7732 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7733 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7734 | /* ADC2: mute amp left and right */ |
| 7735 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7736 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7737 | /* ADC3: mute amp left and right */ |
| 7738 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7739 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7740 | |
| 7741 | { } |
| 7742 | }; |
| 7743 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7744 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7745 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7750 | /* ADC1: mute amp left and right */ |
| 7751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7752 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7753 | { } |
| 7754 | }; |
| 7755 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7756 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7757 | /* change to EAPD mode */ |
| 7758 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7759 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7760 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7761 | }; |
| 7762 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7763 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7764 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7765 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7766 | { } |
| 7767 | }; |
| 7768 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7769 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7770 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7771 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7772 | {} |
| 7773 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7774 | |
| 7775 | static struct hda_verb alc885_init_verbs[] = { |
| 7776 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7777 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7779 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7782 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7784 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7785 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7786 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7787 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7788 | |
| 7789 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7792 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7793 | /* Front Pin: output 0 (0x0c) */ |
| 7794 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7795 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7796 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7797 | /* Rear Pin: output 1 (0x0d) */ |
| 7798 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7799 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7800 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7801 | /* CLFE Pin: output 2 (0x0e) */ |
| 7802 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7803 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7804 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7805 | /* Side Pin: output 3 (0x0f) */ |
| 7806 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7807 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7808 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7809 | /* Mic (rear) pin: input vref at 80% */ |
| 7810 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7811 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7812 | /* Front Mic pin: input vref at 80% */ |
| 7813 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7814 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7815 | /* Line In pin: input */ |
| 7816 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7817 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7818 | |
| 7819 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7820 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7821 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7822 | /* Input mixer2 */ |
| 7823 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7824 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7825 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7826 | /* ADC2: mute amp left and right */ |
| 7827 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7828 | /* ADC3: mute amp left and right */ |
| 7829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7830 | |
| 7831 | { } |
| 7832 | }; |
| 7833 | |
| 7834 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7836 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7838 | { } |
| 7839 | }; |
| 7840 | |
| 7841 | |
| 7842 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7843 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7844 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7845 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7846 | { } |
| 7847 | }; |
| 7848 | |
| 7849 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7850 | #define alc883_init_verbs alc882_base_init_verbs |
| 7851 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7852 | /* Mac Pro test */ |
| 7853 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7854 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7855 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7857 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7858 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7859 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7860 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7861 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7862 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7863 | { } /* end */ |
| 7864 | }; |
| 7865 | |
| 7866 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7867 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7868 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7869 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7871 | /* Front Pin: output 0 (0x0c) */ |
| 7872 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7873 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7874 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7875 | /* Front Mic pin: input vref at 80% */ |
| 7876 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7877 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7878 | /* Speaker: output */ |
| 7879 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7880 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7881 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7882 | /* Headphone output (output 0 - 0x0c) */ |
| 7883 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7884 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7885 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7886 | |
| 7887 | /* FIXME: use matrix-type input source selection */ |
| 7888 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7889 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7890 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7891 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7892 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7893 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7894 | /* Input mixer2 */ |
| 7895 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7896 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7897 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7898 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7899 | /* Input mixer3 */ |
| 7900 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7901 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7904 | /* ADC1: mute amp left and right */ |
| 7905 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7906 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7907 | /* ADC2: mute amp left and right */ |
| 7908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7909 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7910 | /* ADC3: mute amp left and right */ |
| 7911 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7912 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7913 | |
| 7914 | { } |
| 7915 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7916 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7917 | /* Macbook 5,1 */ |
| 7918 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7919 | /* DACs */ |
| 7920 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7921 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7922 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7923 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7924 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7925 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7928 | /* Surround mixer */ |
| 7929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7930 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7931 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7932 | /* LFE mixer */ |
| 7933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7934 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7936 | /* HP mixer */ |
| 7937 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7938 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7939 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7940 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7941 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7942 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7943 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7944 | /* LFE Pin (0x0e) */ |
| 7945 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7946 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7947 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7948 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7949 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7950 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7951 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7952 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7953 | /* Front Mic pin: input vref at 80% */ |
| 7954 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7955 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7956 | /* Line In pin */ |
| 7957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7958 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7959 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7960 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 7961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 7962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7963 | { } |
| 7964 | }; |
| 7965 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7966 | /* Macmini 3,1 */ |
| 7967 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7968 | /* DACs */ |
| 7969 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7970 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7971 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7972 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7973 | /* Front mixer */ |
| 7974 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7975 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7976 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7977 | /* Surround mixer */ |
| 7978 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7979 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7980 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7981 | /* LFE mixer */ |
| 7982 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7983 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7984 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7985 | /* HP mixer */ |
| 7986 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7987 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7988 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7989 | /* Front Pin (0x0c) */ |
| 7990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7991 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7992 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7993 | /* LFE Pin (0x0e) */ |
| 7994 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7995 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7996 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7997 | /* HP Pin (0x0f) */ |
| 7998 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7999 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8000 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8001 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8002 | /* Line In pin */ |
| 8003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8004 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8005 | |
| 8006 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8007 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8008 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8009 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8010 | { } |
| 8011 | }; |
| 8012 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8013 | |
| 8014 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8015 | /*Internal and HP Speaker Mixer*/ |
| 8016 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8019 | /*Internal Speaker Pin (0x0c)*/ |
| 8020 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8021 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8022 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8023 | /* HP Pin: output 0 (0x0e) */ |
| 8024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8025 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8026 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8027 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8028 | /* Line in (is hp when jack connected)*/ |
| 8029 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8030 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8031 | |
| 8032 | { } |
| 8033 | }; |
| 8034 | |
| 8035 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8036 | /* Macbook Pro rev3 */ |
| 8037 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8038 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8040 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8041 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8042 | /* Rear mixer */ |
| 8043 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8044 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8045 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8046 | /* HP mixer */ |
| 8047 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8048 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8050 | /* Front Pin: output 0 (0x0c) */ |
| 8051 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8052 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8053 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8054 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8055 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8056 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8057 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8058 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8059 | /* Mic (rear) pin: input vref at 80% */ |
| 8060 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8061 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8062 | /* Front Mic pin: input vref at 80% */ |
| 8063 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8064 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8065 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8066 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8067 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8068 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8069 | |
| 8070 | /* FIXME: use matrix-type input source selection */ |
| 8071 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8072 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8074 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8076 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8077 | /* Input mixer2 */ |
| 8078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8079 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8082 | /* Input mixer3 */ |
| 8083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8084 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8087 | /* ADC1: mute amp left and right */ |
| 8088 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8089 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8090 | /* ADC2: mute amp left and right */ |
| 8091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8092 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8093 | /* ADC3: mute amp left and right */ |
| 8094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8095 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8096 | |
| 8097 | { } |
| 8098 | }; |
| 8099 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8100 | /* iMac 9,1 */ |
| 8101 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8102 | /* Internal Speaker Pin (0x0c) */ |
| 8103 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8104 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8105 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8106 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8107 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8108 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8109 | /* HP Pin: Rear */ |
| 8110 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8112 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8113 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8114 | /* Line in Rear */ |
| 8115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8116 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8117 | /* Front Mic pin: input vref at 80% */ |
| 8118 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8119 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8120 | /* Rear mixer */ |
| 8121 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8123 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8124 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8126 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8128 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8129 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8130 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8131 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8132 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8133 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8134 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8135 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8136 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8137 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8138 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8139 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8140 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8142 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8143 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8145 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8146 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8147 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8148 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8149 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8150 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8151 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8152 | { } |
| 8153 | }; |
| 8154 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8155 | /* iMac 24 mixer. */ |
| 8156 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8157 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8158 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8159 | { } /* end */ |
| 8160 | }; |
| 8161 | |
| 8162 | /* iMac 24 init verbs. */ |
| 8163 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8164 | /* Internal speakers: output 0 (0x0c) */ |
| 8165 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8166 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8167 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8168 | /* Internal speakers: output 0 (0x0c) */ |
| 8169 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8170 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8171 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8172 | /* Headphone: output 0 (0x0c) */ |
| 8173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8175 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8176 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8177 | /* Front Mic: input vref at 80% */ |
| 8178 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8179 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8180 | { } |
| 8181 | }; |
| 8182 | |
| 8183 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8184 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8185 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8186 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8187 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8188 | spec->autocfg.hp_pins[0] = 0x14; |
| 8189 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8190 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8191 | } |
| 8192 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8193 | #define alc885_mb5_setup alc885_imac24_setup |
| 8194 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8195 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8196 | /* Macbook Air 2,1 */ |
| 8197 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8198 | { |
| 8199 | struct alc_spec *spec = codec->spec; |
| 8200 | |
| 8201 | spec->autocfg.hp_pins[0] = 0x14; |
| 8202 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8203 | } |
| 8204 | |
| 8205 | |
| 8206 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8207 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8208 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8209 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8210 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8211 | spec->autocfg.hp_pins[0] = 0x15; |
| 8212 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8213 | } |
| 8214 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8215 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8216 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8217 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8218 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8219 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8220 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8221 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8222 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8223 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8224 | static struct hda_verb alc882_targa_verbs[] = { |
| 8225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8227 | |
| 8228 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8229 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8230 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8231 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8232 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8233 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8234 | |
| 8235 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8236 | { } /* end */ |
| 8237 | }; |
| 8238 | |
| 8239 | /* toggle speaker-output according to the hp-jack state */ |
| 8240 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8241 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8242 | struct alc_spec *spec = codec->spec; |
| 8243 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8244 | 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] | 8245 | spec->jack_present ? 1 : 3); |
| 8246 | } |
| 8247 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8248 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8249 | { |
| 8250 | struct alc_spec *spec = codec->spec; |
| 8251 | |
| 8252 | spec->autocfg.hp_pins[0] = 0x14; |
| 8253 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8254 | } |
| 8255 | |
| 8256 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8257 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8258 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8259 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8260 | } |
| 8261 | |
| 8262 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8265 | |
| 8266 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8268 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8269 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8270 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8271 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8272 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8273 | |
| 8274 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8275 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8276 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8277 | { } /* end */ |
| 8278 | }; |
| 8279 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8280 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8281 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8283 | |
| 8284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8285 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8286 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8287 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8288 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8290 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8291 | |
| 8292 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8293 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8294 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8295 | { } /* end */ |
| 8296 | }; |
| 8297 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8298 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8299 | { |
| 8300 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8301 | |
| 8302 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8303 | AC_VERB_GET_GPIO_DATA, 0); |
| 8304 | |
| 8305 | if (!muted) |
| 8306 | gpiostate |= (1 << pin); |
| 8307 | else |
| 8308 | gpiostate &= ~(1 << pin); |
| 8309 | |
| 8310 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8311 | AC_VERB_GET_GPIO_MASK, 0); |
| 8312 | gpiomask |= (1 << pin); |
| 8313 | |
| 8314 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8315 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8316 | gpiodir |= (1 << pin); |
| 8317 | |
| 8318 | |
| 8319 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8320 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8321 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8322 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8323 | |
| 8324 | msleep(1); |
| 8325 | |
| 8326 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8327 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8328 | } |
| 8329 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8330 | /* set up GPIO at initialization */ |
| 8331 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8332 | { |
| 8333 | alc882_gpio_mute(codec, 0, 0); |
| 8334 | alc882_gpio_mute(codec, 1, 0); |
| 8335 | } |
| 8336 | |
| 8337 | /* set up GPIO and update auto-muting at initialization */ |
| 8338 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8339 | { |
| 8340 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8341 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8342 | } |
| 8343 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8344 | /* |
| 8345 | * generic initialization of ADC, input mixers and output mixers |
| 8346 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8347 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8348 | /* |
| 8349 | * Unmute ADC0-2 and set the default input to mic-in |
| 8350 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8351 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8352 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8353 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8354 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8355 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8356 | /* |
| 8357 | * Set up output mixers (0x0c - 0x0f) |
| 8358 | */ |
| 8359 | /* set vol=0 to output mixers */ |
| 8360 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8361 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8362 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8363 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8364 | /* set up input amps for analog loopback */ |
| 8365 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8367 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8368 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8369 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8370 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8371 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8372 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8373 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8374 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8375 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8376 | |
| 8377 | /* FIXME: use matrix-type input source selection */ |
| 8378 | /* 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] | 8379 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8380 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8381 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8383 | { } |
| 8384 | }; |
| 8385 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8386 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8387 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8388 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8389 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8390 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8391 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8392 | { } /* end */ |
| 8393 | }; |
| 8394 | |
| 8395 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8396 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8397 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8398 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8399 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8400 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8401 | { } /* end */ |
| 8402 | }; |
| 8403 | |
| 8404 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8405 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8406 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8407 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8408 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8409 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8410 | { } /* end */ |
| 8411 | }; |
| 8412 | |
| 8413 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8414 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8416 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8417 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8418 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8419 | { } /* end */ |
| 8420 | }; |
| 8421 | |
| 8422 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8423 | { 2, alc889A_mb31_ch2_init }, |
| 8424 | { 4, alc889A_mb31_ch4_init }, |
| 8425 | { 5, alc889A_mb31_ch5_init }, |
| 8426 | { 6, alc889A_mb31_ch6_init }, |
| 8427 | }; |
| 8428 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8429 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8430 | /* eanable EAPD on medion laptop */ |
| 8431 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8432 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8433 | { } |
| 8434 | }; |
| 8435 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8436 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8437 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8438 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8439 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8440 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8441 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8442 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8443 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8444 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8446 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8447 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8449 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8450 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8451 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8452 | { } /* end */ |
| 8453 | }; |
| 8454 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8455 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8457 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8461 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8462 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8463 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8464 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8465 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8466 | { } /* end */ |
| 8467 | }; |
| 8468 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8469 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8470 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8471 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8472 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8473 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8474 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8475 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8476 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8477 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8478 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8479 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8480 | { } /* end */ |
| 8481 | }; |
| 8482 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8483 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8484 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8485 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8486 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8487 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8488 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8489 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8490 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8491 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8492 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8493 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8494 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8495 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8496 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8497 | { } /* end */ |
| 8498 | }; |
| 8499 | |
| 8500 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8502 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8503 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8504 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8505 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8506 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8507 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8508 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8509 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8512 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8513 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8514 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8515 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8516 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8517 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8518 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8519 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8520 | { } /* end */ |
| 8521 | }; |
| 8522 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8523 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8525 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8526 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8527 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8528 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8529 | HDA_OUTPUT), |
| 8530 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8531 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8532 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8533 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8534 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8535 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8536 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8537 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8539 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8541 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8542 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8543 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8544 | { } /* end */ |
| 8545 | }; |
| 8546 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8547 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8549 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8550 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8551 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8552 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8553 | HDA_OUTPUT), |
| 8554 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8555 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8556 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8558 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8559 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8560 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8561 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8562 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8563 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8565 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8566 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8567 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8568 | { } /* end */ |
| 8569 | }; |
| 8570 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8571 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8572 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8573 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8574 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8575 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8576 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8577 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8578 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8579 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8580 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8582 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8583 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8584 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8585 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8586 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8587 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8588 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8589 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8590 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8591 | { } /* end */ |
| 8592 | }; |
| 8593 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8594 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8595 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8596 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8597 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8598 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8599 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8600 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8601 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8602 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8603 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8604 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8605 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8606 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8607 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8608 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8609 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8610 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8612 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8613 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8614 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8615 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8616 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8617 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8619 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8620 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8621 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8622 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8623 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8624 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8625 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8626 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8627 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8628 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8629 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8630 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8631 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8632 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8633 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8634 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8635 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8636 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8637 | { } /* end */ |
| 8638 | }; |
| 8639 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8640 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8641 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8642 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8643 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8644 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8645 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8646 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8647 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8649 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8650 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8651 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8652 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8653 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8654 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8655 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8656 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8657 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8659 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8660 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8661 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8662 | { } /* end */ |
| 8663 | }; |
| 8664 | |
| 8665 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8666 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8667 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8668 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8672 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8673 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8674 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8675 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8676 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8677 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8678 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8679 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8680 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8681 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8683 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8684 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8685 | { } /* end */ |
| 8686 | }; |
| 8687 | |
| 8688 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8689 | /* Unmute front mixer */ |
| 8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8692 | |
| 8693 | /* Set speaker pin to front mixer */ |
| 8694 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8695 | |
| 8696 | /* Init headphone pin */ |
| 8697 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8698 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8699 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8700 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8701 | |
| 8702 | { } /* end */ |
| 8703 | }; |
| 8704 | |
| 8705 | /* toggle speaker-output according to the hp-jack state */ |
| 8706 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8707 | { |
| 8708 | struct alc_spec *spec = codec->spec; |
| 8709 | |
| 8710 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8711 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8712 | } |
| 8713 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8714 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8715 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8716 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8717 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8718 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8719 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8720 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8721 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8723 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8724 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8725 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8726 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8728 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8729 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8730 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8731 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8732 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8734 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8735 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8736 | { } /* end */ |
| 8737 | }; |
| 8738 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8739 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8740 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8741 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8742 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8743 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8744 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8745 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8746 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8747 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8748 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8749 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8750 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8752 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8754 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8756 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8758 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8759 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8760 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8761 | { } /* end */ |
| 8762 | }; |
| 8763 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8764 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8765 | /* Output mixers */ |
| 8766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8767 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8768 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8769 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8770 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8771 | HDA_OUTPUT), |
| 8772 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8773 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8774 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8775 | /* Output switches */ |
| 8776 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8777 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8778 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8779 | /* Boost mixers */ |
| 8780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8781 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8782 | /* Input mixers */ |
| 8783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8785 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8786 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8787 | { } /* end */ |
| 8788 | }; |
| 8789 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8790 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8791 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8792 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8793 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8795 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8797 | { } /* end */ |
| 8798 | }; |
| 8799 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8800 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8801 | .ops = &snd_hda_bind_vol, |
| 8802 | .values = { |
| 8803 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8804 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8805 | 0 |
| 8806 | }, |
| 8807 | }; |
| 8808 | |
| 8809 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8810 | .ops = &snd_hda_bind_sw, |
| 8811 | .values = { |
| 8812 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8813 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8814 | 0 |
| 8815 | }, |
| 8816 | }; |
| 8817 | |
| 8818 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8820 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8821 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8825 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8826 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8827 | { } /* end */ |
| 8828 | }; |
| 8829 | |
| 8830 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8831 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8832 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8833 | { |
| 8834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8835 | /* .name = "Capture Source", */ |
| 8836 | .name = "Input Source", |
| 8837 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8838 | .info = alc_mux_enum_info, |
| 8839 | .get = alc_mux_enum_get, |
| 8840 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8841 | }, |
| 8842 | { } /* end */ |
| 8843 | }; |
| 8844 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8845 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8846 | { |
| 8847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8848 | .name = "Channel Mode", |
| 8849 | .info = alc_ch_mode_info, |
| 8850 | .get = alc_ch_mode_get, |
| 8851 | .put = alc_ch_mode_put, |
| 8852 | }, |
| 8853 | { } /* end */ |
| 8854 | }; |
| 8855 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8856 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8857 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8858 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8859 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8860 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8861 | spec->autocfg.hp_pins[0] = 0x15; |
| 8862 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8863 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8864 | } |
| 8865 | |
| 8866 | /* auto-toggle front mic */ |
| 8867 | /* |
| 8868 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8869 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8870 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8871 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8872 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8873 | } |
| 8874 | */ |
| 8875 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8876 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8877 | /* HP */ |
| 8878 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8879 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8880 | /* Subwoofer */ |
| 8881 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8882 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8883 | |
| 8884 | /* enable unsolicited event */ |
| 8885 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8886 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8887 | |
| 8888 | { } /* end */ |
| 8889 | }; |
| 8890 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8891 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8892 | /* HP */ |
| 8893 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8894 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8895 | /* Int speaker */ |
| 8896 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8897 | |
| 8898 | /* enable unsolicited event */ |
| 8899 | /* |
| 8900 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8901 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8902 | */ |
| 8903 | |
| 8904 | { } /* end */ |
| 8905 | }; |
| 8906 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8907 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8908 | /* HP */ |
| 8909 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8911 | /* Int speaker */ |
| 8912 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8913 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8914 | |
| 8915 | /* enable unsolicited event */ |
| 8916 | {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] | 8917 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8918 | |
| 8919 | { } /* end */ |
| 8920 | }; |
| 8921 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8922 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8923 | /* HP */ |
| 8924 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8926 | /* Subwoofer */ |
| 8927 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8929 | |
| 8930 | /* enable unsolicited event */ |
| 8931 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8932 | |
| 8933 | { } /* end */ |
| 8934 | }; |
| 8935 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8936 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8939 | |
| 8940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8941 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8942 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8943 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8944 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8945 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8946 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8947 | /* Connect Mic jack to CLFE */ |
| 8948 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8949 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8950 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8951 | /* Connect Line-in jack to Surround */ |
| 8952 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8953 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8954 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8955 | /* Connect HP out jack to Front */ |
| 8956 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8957 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8958 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8959 | |
| 8960 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8961 | |
| 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8965 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8966 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8967 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8968 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8969 | { } /* end */ |
| 8970 | }; |
| 8971 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8972 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8974 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8975 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8977 | { } /* end */ |
| 8978 | }; |
| 8979 | |
| 8980 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8981 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8982 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8983 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8984 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8985 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8986 | { } /* end */ |
| 8987 | }; |
| 8988 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8989 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8992 | |
| 8993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8994 | |
| 8995 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8996 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8997 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8998 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8999 | { } /* end */ |
| 9000 | }; |
| 9001 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9002 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9004 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9005 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9006 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9007 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9008 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9009 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9010 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9011 | { } /* end */ |
| 9012 | }; |
| 9013 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9014 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9015 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9016 | { } |
| 9017 | }; |
| 9018 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9019 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9020 | /* HP */ |
| 9021 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9022 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9023 | |
| 9024 | /* enable unsolicited event */ |
| 9025 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9026 | |
| 9027 | { } /* end */ |
| 9028 | }; |
| 9029 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9030 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9031 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9032 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9033 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9034 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9035 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9036 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9037 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9038 | } |
| 9039 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9040 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9041 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9042 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9043 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9044 | {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] | 9045 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9046 | }; |
| 9047 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9048 | /* |
| 9049 | * 2ch mode |
| 9050 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9051 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9052 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9053 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9054 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9055 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9056 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9057 | }; |
| 9058 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9059 | /* |
| 9060 | * 4ch mode |
| 9061 | */ |
| 9062 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9063 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9064 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9065 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9066 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9067 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9068 | { } /* end */ |
| 9069 | }; |
| 9070 | |
| 9071 | /* |
| 9072 | * 6ch mode |
| 9073 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9074 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9075 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9076 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9077 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9078 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9079 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9080 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9081 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9082 | }; |
| 9083 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9084 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9085 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9086 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9087 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9088 | }; |
| 9089 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9090 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9091 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9092 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9093 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9094 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9095 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9096 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9097 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9098 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9099 | } |
| 9100 | |
| 9101 | /* toggle RCA according to the front-jack state */ |
| 9102 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9103 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9104 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9105 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9106 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9107 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9108 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9109 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9110 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9111 | unsigned int res) |
| 9112 | { |
| 9113 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9114 | alc888_lenovo_ms7195_front_automute(codec); |
| 9115 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9116 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9117 | } |
| 9118 | |
| 9119 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9121 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9122 | |
| 9123 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9124 | |
| 9125 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9126 | { } /* end */ |
| 9127 | }; |
| 9128 | |
| 9129 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9130 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9131 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9132 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9133 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9134 | spec->autocfg.hp_pins[0] = 0x14; |
| 9135 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9136 | } |
| 9137 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9138 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9139 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9140 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9141 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9142 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9143 | { |
| 9144 | unsigned int present; |
| 9145 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9146 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9147 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9148 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9149 | } |
| 9150 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9151 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9152 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9153 | struct alc_spec *spec = codec->spec; |
| 9154 | |
| 9155 | spec->autocfg.hp_pins[0] = 0x15; |
| 9156 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9157 | } |
| 9158 | |
| 9159 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9160 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9161 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9162 | alc883_clevo_m720_mic_automute(codec); |
| 9163 | } |
| 9164 | |
| 9165 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9166 | unsigned int res) |
| 9167 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9168 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9169 | case ALC880_MIC_EVENT: |
| 9170 | alc883_clevo_m720_mic_automute(codec); |
| 9171 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9172 | default: |
| 9173 | alc_automute_amp_unsol_event(codec, res); |
| 9174 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9175 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9176 | } |
| 9177 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9178 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9179 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9180 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9181 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9182 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9183 | spec->autocfg.hp_pins[0] = 0x14; |
| 9184 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9185 | } |
| 9186 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9187 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9188 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9189 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9190 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9191 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9192 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9193 | } |
| 9194 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9195 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9196 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9197 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9198 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9199 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9200 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9201 | } |
| 9202 | |
| 9203 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9204 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9205 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9206 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9207 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9208 | HDA_AMP_MUTE, bits); |
| 9209 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9210 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9211 | } |
| 9212 | |
| 9213 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9214 | unsigned int res) |
| 9215 | { |
| 9216 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9217 | alc883_lenovo_101e_all_automute(codec); |
| 9218 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9219 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9220 | } |
| 9221 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9222 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9223 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9224 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9225 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9226 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9227 | spec->autocfg.hp_pins[0] = 0x14; |
| 9228 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9229 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9230 | } |
| 9231 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9232 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9233 | /* HP Pin: output 0 (0x0c) */ |
| 9234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9235 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9236 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9237 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9239 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9240 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9241 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9242 | /* eanable EAPD on medion laptop */ |
| 9243 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9244 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9245 | /* enable unsolicited event */ |
| 9246 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9247 | { } |
| 9248 | }; |
| 9249 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9250 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9251 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9252 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9253 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9254 | { } /* end */ |
| 9255 | }; |
| 9256 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9257 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9258 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9259 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9260 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9261 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9262 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9263 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9264 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9265 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9266 | } |
| 9267 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9268 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9269 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9270 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9271 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9272 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9273 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9274 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9275 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9276 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9277 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9278 | } |
| 9279 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9280 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9281 | { |
| 9282 | struct alc_spec *spec = codec->spec; |
| 9283 | |
| 9284 | spec->autocfg.hp_pins[0] = 0x15; |
| 9285 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9286 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9287 | } |
| 9288 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9289 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9292 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9293 | /* enable unsolicited event */ |
| 9294 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9295 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9296 | { } /* end */ |
| 9297 | }; |
| 9298 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9299 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9300 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9301 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9302 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9303 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9304 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9305 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9306 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9307 | spec->ext_mic.pin = 0x18; |
| 9308 | spec->int_mic.pin = 0x19; |
| 9309 | spec->ext_mic.mux_idx = 0; |
| 9310 | spec->int_mic.mux_idx = 1; |
| 9311 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9312 | } |
| 9313 | |
| 9314 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9315 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9316 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9317 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9318 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9319 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9320 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9321 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9322 | /* enable unsolicited event */ |
| 9323 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9324 | { } /* end */ |
| 9325 | }; |
| 9326 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9327 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9328 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9329 | struct alc_spec *spec = codec->spec; |
| 9330 | |
| 9331 | spec->autocfg.hp_pins[0] = 0x14; |
| 9332 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9333 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9334 | } |
| 9335 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9336 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9337 | /* Init rear pin (used as headphone output) */ |
| 9338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9339 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9340 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9341 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9342 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9343 | /* Init line 2 pin (used as headphone out by default) */ |
| 9344 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9345 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9346 | { } /* end */ |
| 9347 | }; |
| 9348 | |
| 9349 | /* Mute speakers according to the headphone jack state */ |
| 9350 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9351 | { |
| 9352 | unsigned int present; |
| 9353 | |
| 9354 | /* Mute only in 2ch or 4ch mode */ |
| 9355 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9356 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9357 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9358 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9359 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9360 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9361 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9362 | } |
| 9363 | } |
| 9364 | |
| 9365 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9366 | { |
| 9367 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9368 | alc889A_mb31_automute(codec); |
| 9369 | } |
| 9370 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9371 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9373 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9374 | #endif |
| 9375 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9376 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9377 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9378 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9379 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9380 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9381 | |
| 9382 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9383 | ALC1200_DIGOUT_NID, 0, |
| 9384 | }; |
| 9385 | |
| 9386 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9387 | ALC883_DIGOUT_NID, 0, |
| 9388 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9389 | |
| 9390 | /* |
| 9391 | * configuration and preset |
| 9392 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9394 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9395 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9396 | [ALC882_ARIMA] = "arima", |
| 9397 | [ALC882_W2JC] = "w2jc", |
| 9398 | [ALC882_TARGA] = "targa", |
| 9399 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9400 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9401 | [ALC885_MACPRO] = "macpro", |
| 9402 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9403 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9404 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9405 | [ALC885_MBP3] = "mbp3", |
| 9406 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9407 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9408 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9409 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9410 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9411 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9412 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9413 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9414 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9415 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9416 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9417 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9418 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9419 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9420 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9421 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9422 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9423 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9424 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9425 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9426 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9427 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9428 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9429 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9430 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9431 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9432 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9433 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9434 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9435 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9436 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9437 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9438 | [ALC889A_INTEL] = "intel-alc889a", |
| 9439 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9440 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9441 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9442 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9443 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9444 | }; |
| 9445 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9446 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9447 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9448 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9449 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9450 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9451 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9452 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9453 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9454 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9455 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9456 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9457 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9458 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9459 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9460 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9461 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9462 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9463 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9464 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9465 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9466 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9467 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9468 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9469 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9470 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9471 | /* default Acer -- disabled as it causes more problems. |
| 9472 | * model=auto should work fine now |
| 9473 | */ |
| 9474 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9475 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9476 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9477 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9478 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9479 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9480 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9481 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9482 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9483 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9484 | |
| 9485 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9486 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9487 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9488 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9489 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9490 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9491 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9492 | 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] | 9493 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9494 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9495 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9496 | |
| 9497 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9498 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9499 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9500 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9501 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9502 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9503 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9504 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9506 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9507 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9508 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9509 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9510 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9512 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9514 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9515 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9516 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9517 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9518 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9519 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9520 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9521 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9522 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9523 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9524 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9525 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9527 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9528 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9529 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9530 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9531 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9532 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9533 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9534 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9535 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9536 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9537 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9538 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9539 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9540 | 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] | 9541 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9542 | 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] | 9543 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9544 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9545 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9546 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9547 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9548 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9549 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9550 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9551 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9552 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9553 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9554 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9555 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9556 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9557 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9558 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9559 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9560 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9561 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9562 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9563 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9564 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9565 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9566 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9567 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9568 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9570 | {} |
| 9571 | }; |
| 9572 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9573 | /* codec SSID table for Intel Mac */ |
| 9574 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9575 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9576 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9577 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9578 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9579 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9580 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9581 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9582 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9583 | 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] | 9584 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9585 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9587 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9588 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9589 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9590 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9591 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9592 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9593 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9594 | */ |
| 9595 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9596 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9597 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9598 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9599 | }; |
| 9600 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9601 | static struct alc_config_preset alc882_presets[] = { |
| 9602 | [ALC882_3ST_DIG] = { |
| 9603 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9604 | .init_verbs = { alc882_base_init_verbs, |
| 9605 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9606 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9607 | .dac_nids = alc882_dac_nids, |
| 9608 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9609 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9610 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9611 | .channel_mode = alc882_ch_modes, |
| 9612 | .need_dac_fix = 1, |
| 9613 | .input_mux = &alc882_capture_source, |
| 9614 | }, |
| 9615 | [ALC882_6ST_DIG] = { |
| 9616 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9617 | .init_verbs = { alc882_base_init_verbs, |
| 9618 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9619 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9620 | .dac_nids = alc882_dac_nids, |
| 9621 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9622 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9623 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9624 | .channel_mode = alc882_sixstack_modes, |
| 9625 | .input_mux = &alc882_capture_source, |
| 9626 | }, |
| 9627 | [ALC882_ARIMA] = { |
| 9628 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9629 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9630 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9631 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9632 | .dac_nids = alc882_dac_nids, |
| 9633 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9634 | .channel_mode = alc882_sixstack_modes, |
| 9635 | .input_mux = &alc882_capture_source, |
| 9636 | }, |
| 9637 | [ALC882_W2JC] = { |
| 9638 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9639 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9640 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9641 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9642 | .dac_nids = alc882_dac_nids, |
| 9643 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9644 | .channel_mode = alc880_threestack_modes, |
| 9645 | .need_dac_fix = 1, |
| 9646 | .input_mux = &alc882_capture_source, |
| 9647 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9648 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9649 | [ALC885_MBA21] = { |
| 9650 | .mixers = { alc885_mba21_mixer }, |
| 9651 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9652 | .num_dacs = 2, |
| 9653 | .dac_nids = alc882_dac_nids, |
| 9654 | .channel_mode = alc885_mba21_ch_modes, |
| 9655 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9656 | .input_mux = &alc882_capture_source, |
| 9657 | .unsol_event = alc_automute_amp_unsol_event, |
| 9658 | .setup = alc885_mba21_setup, |
| 9659 | .init_hook = alc_automute_amp, |
| 9660 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9661 | [ALC885_MBP3] = { |
| 9662 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9663 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9664 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9665 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9666 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9667 | .hp_nid = 0x04, |
| 9668 | .channel_mode = alc885_mbp_4ch_modes, |
| 9669 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9670 | .input_mux = &alc882_capture_source, |
| 9671 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9672 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9673 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9674 | .setup = alc885_mbp3_setup, |
| 9675 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9676 | }, |
| 9677 | [ALC885_MB5] = { |
| 9678 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9679 | .init_verbs = { alc885_mb5_init_verbs, |
| 9680 | alc880_gpio1_init_verbs }, |
| 9681 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9682 | .dac_nids = alc882_dac_nids, |
| 9683 | .channel_mode = alc885_mb5_6ch_modes, |
| 9684 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9685 | .input_mux = &mb5_capture_source, |
| 9686 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9687 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9688 | .unsol_event = alc_automute_amp_unsol_event, |
| 9689 | .setup = alc885_mb5_setup, |
| 9690 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9691 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9692 | [ALC885_MACMINI3] = { |
| 9693 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9694 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9695 | alc880_gpio1_init_verbs }, |
| 9696 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9697 | .dac_nids = alc882_dac_nids, |
| 9698 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9699 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9700 | .input_mux = &macmini3_capture_source, |
| 9701 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9702 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9703 | .unsol_event = alc_automute_amp_unsol_event, |
| 9704 | .setup = alc885_macmini3_setup, |
| 9705 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9706 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9707 | [ALC885_MACPRO] = { |
| 9708 | .mixers = { alc882_macpro_mixer }, |
| 9709 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9710 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9711 | .dac_nids = alc882_dac_nids, |
| 9712 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9713 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9714 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9715 | .channel_mode = alc882_ch_modes, |
| 9716 | .input_mux = &alc882_capture_source, |
| 9717 | .init_hook = alc885_macpro_init_hook, |
| 9718 | }, |
| 9719 | [ALC885_IMAC24] = { |
| 9720 | .mixers = { alc885_imac24_mixer }, |
| 9721 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9722 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9723 | .dac_nids = alc882_dac_nids, |
| 9724 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9725 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9726 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9727 | .channel_mode = alc882_ch_modes, |
| 9728 | .input_mux = &alc882_capture_source, |
| 9729 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9730 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9731 | .init_hook = alc885_imac24_init_hook, |
| 9732 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9733 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9734 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9735 | .init_verbs = { alc885_imac91_init_verbs, |
| 9736 | alc880_gpio1_init_verbs }, |
| 9737 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9738 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9739 | .channel_mode = alc885_mba21_ch_modes, |
| 9740 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9741 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9742 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9743 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9744 | .unsol_event = alc_automute_amp_unsol_event, |
| 9745 | .setup = alc885_imac91_setup, |
| 9746 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9747 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9748 | [ALC882_TARGA] = { |
| 9749 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9750 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9751 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9752 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9753 | .dac_nids = alc882_dac_nids, |
| 9754 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9755 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9756 | .adc_nids = alc882_adc_nids, |
| 9757 | .capsrc_nids = alc882_capsrc_nids, |
| 9758 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9759 | .channel_mode = alc882_3ST_6ch_modes, |
| 9760 | .need_dac_fix = 1, |
| 9761 | .input_mux = &alc882_capture_source, |
| 9762 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9763 | .setup = alc882_targa_setup, |
| 9764 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9765 | }, |
| 9766 | [ALC882_ASUS_A7J] = { |
| 9767 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9768 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9769 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9770 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9771 | .dac_nids = alc882_dac_nids, |
| 9772 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9773 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9774 | .adc_nids = alc882_adc_nids, |
| 9775 | .capsrc_nids = alc882_capsrc_nids, |
| 9776 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9777 | .channel_mode = alc882_3ST_6ch_modes, |
| 9778 | .need_dac_fix = 1, |
| 9779 | .input_mux = &alc882_capture_source, |
| 9780 | }, |
| 9781 | [ALC882_ASUS_A7M] = { |
| 9782 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9783 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9784 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9785 | alc882_asus_a7m_verbs }, |
| 9786 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9787 | .dac_nids = alc882_dac_nids, |
| 9788 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9789 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9790 | .channel_mode = alc880_threestack_modes, |
| 9791 | .need_dac_fix = 1, |
| 9792 | .input_mux = &alc882_capture_source, |
| 9793 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9794 | [ALC883_3ST_2ch_DIG] = { |
| 9795 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9796 | .init_verbs = { alc883_init_verbs }, |
| 9797 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9798 | .dac_nids = alc883_dac_nids, |
| 9799 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9800 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9801 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9802 | .channel_mode = alc883_3ST_2ch_modes, |
| 9803 | .input_mux = &alc883_capture_source, |
| 9804 | }, |
| 9805 | [ALC883_3ST_6ch_DIG] = { |
| 9806 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9807 | .init_verbs = { alc883_init_verbs }, |
| 9808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9809 | .dac_nids = alc883_dac_nids, |
| 9810 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9811 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9813 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9814 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9815 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9816 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9817 | [ALC883_3ST_6ch] = { |
| 9818 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9819 | .init_verbs = { alc883_init_verbs }, |
| 9820 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9821 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9823 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9824 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9825 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9826 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9827 | [ALC883_3ST_6ch_INTEL] = { |
| 9828 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9829 | .init_verbs = { alc883_init_verbs }, |
| 9830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9831 | .dac_nids = alc883_dac_nids, |
| 9832 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9833 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9834 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9835 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9836 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9837 | .need_dac_fix = 1, |
| 9838 | .input_mux = &alc883_3stack_6ch_intel, |
| 9839 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9840 | [ALC889A_INTEL] = { |
| 9841 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9842 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9843 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9844 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9845 | .dac_nids = alc883_dac_nids, |
| 9846 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9847 | .adc_nids = alc889_adc_nids, |
| 9848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9849 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9850 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9851 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9852 | .channel_mode = alc889_8ch_intel_modes, |
| 9853 | .capsrc_nids = alc889_capsrc_nids, |
| 9854 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9855 | .setup = alc889_automute_setup, |
| 9856 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9857 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9858 | .need_dac_fix = 1, |
| 9859 | }, |
| 9860 | [ALC889_INTEL] = { |
| 9861 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9862 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9863 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9864 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9865 | .dac_nids = alc883_dac_nids, |
| 9866 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9867 | .adc_nids = alc889_adc_nids, |
| 9868 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9869 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9870 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9871 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9872 | .channel_mode = alc889_8ch_intel_modes, |
| 9873 | .capsrc_nids = alc889_capsrc_nids, |
| 9874 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9875 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9876 | .init_hook = alc889_intel_init_hook, |
| 9877 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9878 | .need_dac_fix = 1, |
| 9879 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9880 | [ALC883_6ST_DIG] = { |
| 9881 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9882 | .init_verbs = { alc883_init_verbs }, |
| 9883 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9884 | .dac_nids = alc883_dac_nids, |
| 9885 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9886 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9887 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9888 | .channel_mode = alc883_sixstack_modes, |
| 9889 | .input_mux = &alc883_capture_source, |
| 9890 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9891 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9892 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9893 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9894 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9895 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9896 | .dac_nids = alc883_dac_nids, |
| 9897 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9898 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9899 | .channel_mode = alc883_3ST_6ch_modes, |
| 9900 | .need_dac_fix = 1, |
| 9901 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9902 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9903 | .setup = alc882_targa_setup, |
| 9904 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9905 | }, |
| 9906 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9907 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9908 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9909 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9910 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9911 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9912 | .adc_nids = alc883_adc_nids_alt, |
| 9913 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9914 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9915 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9916 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9917 | .channel_mode = alc883_3ST_2ch_modes, |
| 9918 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9919 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9920 | .setup = alc882_targa_setup, |
| 9921 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9922 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9923 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9924 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9925 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9926 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9927 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9928 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9929 | .dac_nids = alc883_dac_nids, |
| 9930 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9931 | .adc_nids = alc883_adc_nids_rev, |
| 9932 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9933 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9934 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9935 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9936 | .channel_mode = alc883_4ST_8ch_modes, |
| 9937 | .need_dac_fix = 1, |
| 9938 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9939 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9940 | .setup = alc882_targa_setup, |
| 9941 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9942 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9943 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9944 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9945 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9946 | * and the headphone jack. Turn this on and rely on the |
| 9947 | * standard mute methods whenever the user wants to turn |
| 9948 | * these outputs off. |
| 9949 | */ |
| 9950 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9951 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9952 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9953 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9954 | .channel_mode = alc883_3ST_2ch_modes, |
| 9955 | .input_mux = &alc883_capture_source, |
| 9956 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9957 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9958 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9959 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9960 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9961 | .dac_nids = alc883_dac_nids, |
| 9962 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9963 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9964 | .channel_mode = alc883_3ST_2ch_modes, |
| 9965 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9966 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9967 | .setup = alc883_acer_aspire_setup, |
| 9968 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9969 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9970 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9971 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9972 | alc883_chmode_mixer }, |
| 9973 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9974 | alc888_acer_aspire_4930g_verbs }, |
| 9975 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9976 | .dac_nids = alc883_dac_nids, |
| 9977 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9978 | .adc_nids = alc883_adc_nids_rev, |
| 9979 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9980 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9981 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9982 | .channel_mode = alc883_3ST_6ch_modes, |
| 9983 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9984 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9985 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9986 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9987 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9988 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9989 | .setup = alc888_acer_aspire_4930g_setup, |
| 9990 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9991 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9992 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9993 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9994 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9995 | alc888_acer_aspire_6530g_verbs }, |
| 9996 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9997 | .dac_nids = alc883_dac_nids, |
| 9998 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9999 | .adc_nids = alc883_adc_nids_rev, |
| 10000 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10001 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10002 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10003 | .channel_mode = alc883_3ST_2ch_modes, |
| 10004 | .num_mux_defs = |
| 10005 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10006 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10007 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10008 | .setup = alc888_acer_aspire_6530g_setup, |
| 10009 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10010 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10011 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10012 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10013 | alc883_chmode_mixer }, |
| 10014 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10015 | alc889_acer_aspire_8930g_verbs, |
| 10016 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10018 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10019 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10020 | .adc_nids = alc889_adc_nids, |
| 10021 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10022 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10023 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10024 | .channel_mode = alc883_3ST_6ch_modes, |
| 10025 | .need_dac_fix = 1, |
| 10026 | .const_channel_count = 6, |
| 10027 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10028 | ARRAY_SIZE(alc889_capture_sources), |
| 10029 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10030 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10031 | .setup = alc889_acer_aspire_8930g_setup, |
| 10032 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10033 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10034 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10035 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10036 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10037 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10038 | .mixers = { alc883_3ST_6ch_mixer, |
| 10039 | alc883_chmode_mixer }, |
| 10040 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10041 | alc888_acer_aspire_7730G_verbs }, |
| 10042 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10043 | .dac_nids = alc883_dac_nids, |
| 10044 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10045 | .adc_nids = alc883_adc_nids_rev, |
| 10046 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10047 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10048 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10049 | .channel_mode = alc883_3ST_6ch_modes, |
| 10050 | .need_dac_fix = 1, |
| 10051 | .const_channel_count = 6, |
| 10052 | .input_mux = &alc883_capture_source, |
| 10053 | .unsol_event = alc_automute_amp_unsol_event, |
| 10054 | .setup = alc888_acer_aspire_6530g_setup, |
| 10055 | .init_hook = alc_automute_amp, |
| 10056 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10057 | [ALC883_MEDION] = { |
| 10058 | .mixers = { alc883_fivestack_mixer, |
| 10059 | alc883_chmode_mixer }, |
| 10060 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10061 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10062 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10063 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10064 | .adc_nids = alc883_adc_nids_alt, |
| 10065 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10066 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10067 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10068 | .channel_mode = alc883_sixstack_modes, |
| 10069 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10070 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10071 | [ALC883_MEDION_MD2] = { |
| 10072 | .mixers = { alc883_medion_md2_mixer}, |
| 10073 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10074 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10075 | .dac_nids = alc883_dac_nids, |
| 10076 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10077 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10078 | .channel_mode = alc883_3ST_2ch_modes, |
| 10079 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10080 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10081 | .setup = alc883_medion_md2_setup, |
| 10082 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10083 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10084 | [ALC883_MEDION_WIM2160] = { |
| 10085 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10086 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10087 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10088 | .dac_nids = alc883_dac_nids, |
| 10089 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10090 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10091 | .adc_nids = alc883_adc_nids, |
| 10092 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10093 | .channel_mode = alc883_3ST_2ch_modes, |
| 10094 | .input_mux = &alc883_capture_source, |
| 10095 | .unsol_event = alc_automute_amp_unsol_event, |
| 10096 | .setup = alc883_medion_wim2160_setup, |
| 10097 | .init_hook = alc_automute_amp, |
| 10098 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10099 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10100 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10101 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10102 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10103 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10104 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10105 | .channel_mode = alc883_3ST_2ch_modes, |
| 10106 | .input_mux = &alc883_capture_source, |
| 10107 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10108 | [ALC883_CLEVO_M540R] = { |
| 10109 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10110 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10112 | .dac_nids = alc883_dac_nids, |
| 10113 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10114 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10115 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10116 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10117 | .need_dac_fix = 1, |
| 10118 | .input_mux = &alc883_capture_source, |
| 10119 | /* This machine has the hardware HP auto-muting, thus |
| 10120 | * we need no software mute via unsol event |
| 10121 | */ |
| 10122 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10123 | [ALC883_CLEVO_M720] = { |
| 10124 | .mixers = { alc883_clevo_m720_mixer }, |
| 10125 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10126 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10127 | .dac_nids = alc883_dac_nids, |
| 10128 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10129 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10130 | .channel_mode = alc883_3ST_2ch_modes, |
| 10131 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10132 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10133 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10134 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10135 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10136 | [ALC883_LENOVO_101E_2ch] = { |
| 10137 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10138 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10139 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10140 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10141 | .adc_nids = alc883_adc_nids_alt, |
| 10142 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10143 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10144 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10145 | .channel_mode = alc883_3ST_2ch_modes, |
| 10146 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10147 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10148 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10149 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10150 | [ALC883_LENOVO_NB0763] = { |
| 10151 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10152 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10153 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10154 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10155 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10156 | .channel_mode = alc883_3ST_2ch_modes, |
| 10157 | .need_dac_fix = 1, |
| 10158 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10159 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10160 | .setup = alc883_medion_md2_setup, |
| 10161 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10162 | }, |
| 10163 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10164 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10165 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10166 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10167 | .dac_nids = alc883_dac_nids, |
| 10168 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10169 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10170 | .channel_mode = alc883_3ST_6ch_modes, |
| 10171 | .need_dac_fix = 1, |
| 10172 | .input_mux = &alc883_capture_source, |
| 10173 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10174 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10175 | }, |
| 10176 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10177 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10178 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10179 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10180 | .dac_nids = alc883_dac_nids, |
| 10181 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10182 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10183 | .channel_mode = alc883_3ST_2ch_modes, |
| 10184 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10185 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10186 | .setup = alc883_haier_w66_setup, |
| 10187 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10188 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10189 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10190 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10191 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10192 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10193 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10194 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10195 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10196 | .need_dac_fix = 1, |
| 10197 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10198 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10199 | .setup = alc888_3st_hp_setup, |
| 10200 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10201 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10202 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10203 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10204 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10205 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10206 | .dac_nids = alc883_dac_nids, |
| 10207 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10208 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10209 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10210 | .channel_mode = alc883_sixstack_modes, |
| 10211 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10212 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10213 | .setup = alc888_6st_dell_setup, |
| 10214 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10215 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10216 | [ALC883_MITAC] = { |
| 10217 | .mixers = { alc883_mitac_mixer }, |
| 10218 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10219 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10220 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10221 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10222 | .channel_mode = alc883_3ST_2ch_modes, |
| 10223 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10224 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10225 | .setup = alc883_mitac_setup, |
| 10226 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10227 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10228 | [ALC883_FUJITSU_PI2515] = { |
| 10229 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10230 | .init_verbs = { alc883_init_verbs, |
| 10231 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10232 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10233 | .dac_nids = alc883_dac_nids, |
| 10234 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10235 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10236 | .channel_mode = alc883_3ST_2ch_modes, |
| 10237 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10238 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10239 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10240 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10241 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10242 | [ALC888_FUJITSU_XA3530] = { |
| 10243 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10244 | .init_verbs = { alc883_init_verbs, |
| 10245 | alc888_fujitsu_xa3530_verbs }, |
| 10246 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10247 | .dac_nids = alc883_dac_nids, |
| 10248 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10249 | .adc_nids = alc883_adc_nids_rev, |
| 10250 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10251 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10252 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10253 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10254 | .num_mux_defs = |
| 10255 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10256 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10257 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10258 | .setup = alc888_fujitsu_xa3530_setup, |
| 10259 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10260 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10261 | [ALC888_LENOVO_SKY] = { |
| 10262 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10263 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10264 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10265 | .dac_nids = alc883_dac_nids, |
| 10266 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10267 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10268 | .channel_mode = alc883_sixstack_modes, |
| 10269 | .need_dac_fix = 1, |
| 10270 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10271 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10272 | .setup = alc888_lenovo_sky_setup, |
| 10273 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10274 | }, |
| 10275 | [ALC888_ASUS_M90V] = { |
| 10276 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10277 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10278 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10279 | .dac_nids = alc883_dac_nids, |
| 10280 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10281 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10282 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10283 | .channel_mode = alc883_3ST_6ch_modes, |
| 10284 | .need_dac_fix = 1, |
| 10285 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10286 | .unsol_event = alc_sku_unsol_event, |
| 10287 | .setup = alc883_mode2_setup, |
| 10288 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10289 | }, |
| 10290 | [ALC888_ASUS_EEE1601] = { |
| 10291 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10292 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10293 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10294 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10295 | .dac_nids = alc883_dac_nids, |
| 10296 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10297 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10298 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10299 | .channel_mode = alc883_3ST_2ch_modes, |
| 10300 | .need_dac_fix = 1, |
| 10301 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10302 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10303 | .init_hook = alc883_eee1601_inithook, |
| 10304 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10305 | [ALC1200_ASUS_P5Q] = { |
| 10306 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10307 | .init_verbs = { alc883_init_verbs }, |
| 10308 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10309 | .dac_nids = alc883_dac_nids, |
| 10310 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10311 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10312 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10313 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10314 | .channel_mode = alc883_sixstack_modes, |
| 10315 | .input_mux = &alc883_capture_source, |
| 10316 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10317 | [ALC889A_MB31] = { |
| 10318 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10319 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10320 | alc880_gpio1_init_verbs }, |
| 10321 | .adc_nids = alc883_adc_nids, |
| 10322 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10323 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10324 | .dac_nids = alc883_dac_nids, |
| 10325 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10326 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10327 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10328 | .input_mux = &alc889A_mb31_capture_source, |
| 10329 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10330 | .unsol_event = alc889A_mb31_unsol_event, |
| 10331 | .init_hook = alc889A_mb31_automute, |
| 10332 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10333 | [ALC883_SONY_VAIO_TT] = { |
| 10334 | .mixers = { alc883_vaiott_mixer }, |
| 10335 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10336 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10337 | .dac_nids = alc883_dac_nids, |
| 10338 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10339 | .channel_mode = alc883_3ST_2ch_modes, |
| 10340 | .input_mux = &alc883_capture_source, |
| 10341 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10342 | .setup = alc883_vaiott_setup, |
| 10343 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10344 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10345 | }; |
| 10346 | |
| 10347 | |
| 10348 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10349 | * Pin config fixes |
| 10350 | */ |
| 10351 | enum { |
| 10352 | PINFIX_ABIT_AW9D_MAX |
| 10353 | }; |
| 10354 | |
| 10355 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10356 | { 0x15, 0x01080104 }, /* side */ |
| 10357 | { 0x16, 0x01011012 }, /* rear */ |
| 10358 | { 0x17, 0x01016011 }, /* clfe */ |
| 10359 | { } |
| 10360 | }; |
| 10361 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10362 | static const struct alc_fixup alc882_fixups[] = { |
| 10363 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10364 | .pins = alc882_abit_aw9d_pinfix |
| 10365 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10366 | }; |
| 10367 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10368 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10369 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10370 | {} |
| 10371 | }; |
| 10372 | |
| 10373 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10374 | * BIOS auto configuration |
| 10375 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10376 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10377 | const struct auto_pin_cfg *cfg) |
| 10378 | { |
| 10379 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10380 | } |
| 10381 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10382 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10383 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10384 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10385 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10386 | int idx; |
| 10387 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10388 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10389 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10390 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10391 | if (dac == 0x25) |
| 10392 | idx = 4; |
| 10393 | else if (dac >= 0x02 && dac <= 0x05) |
| 10394 | idx = dac - 2; |
| 10395 | else |
| 10396 | return; |
| 10397 | 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] | 10398 | } |
| 10399 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10400 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10401 | { |
| 10402 | struct alc_spec *spec = codec->spec; |
| 10403 | int i; |
| 10404 | |
| 10405 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10406 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10407 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10408 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10409 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10410 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10411 | } |
| 10412 | } |
| 10413 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10414 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10415 | { |
| 10416 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10417 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10418 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10419 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10420 | if (pin) { |
| 10421 | dac = spec->multiout.hp_nid; |
| 10422 | if (!dac) |
| 10423 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10424 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10425 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10426 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10427 | if (pin) { |
| 10428 | dac = spec->multiout.extra_out_nid[0]; |
| 10429 | if (!dac) |
| 10430 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10431 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10432 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10433 | } |
| 10434 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10435 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10436 | { |
| 10437 | struct alc_spec *spec = codec->spec; |
| 10438 | int i; |
| 10439 | |
| 10440 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10441 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10442 | if (!nid) |
| 10443 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10444 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10445 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10446 | snd_hda_codec_write(codec, nid, 0, |
| 10447 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10448 | AMP_OUT_MUTE); |
| 10449 | } |
| 10450 | } |
| 10451 | |
| 10452 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10453 | { |
| 10454 | struct alc_spec *spec = codec->spec; |
| 10455 | int c; |
| 10456 | |
| 10457 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10458 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10459 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10460 | unsigned int mux_idx; |
| 10461 | const struct hda_input_mux *imux; |
| 10462 | int conns, mute, idx, item; |
| 10463 | |
| 10464 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10465 | ARRAY_SIZE(conn_list)); |
| 10466 | if (conns < 0) |
| 10467 | continue; |
| 10468 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10469 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10470 | if (!imux->num_items && mux_idx > 0) |
| 10471 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10472 | for (idx = 0; idx < conns; idx++) { |
| 10473 | /* if the current connection is the selected one, |
| 10474 | * unmute it as default - otherwise mute it |
| 10475 | */ |
| 10476 | mute = AMP_IN_MUTE(idx); |
| 10477 | for (item = 0; item < imux->num_items; item++) { |
| 10478 | if (imux->items[item].index == idx) { |
| 10479 | if (spec->cur_mux[c] == item) |
| 10480 | mute = AMP_IN_UNMUTE(idx); |
| 10481 | break; |
| 10482 | } |
| 10483 | } |
| 10484 | /* check if we have a selector or mixer |
| 10485 | * we could check for the widget type instead, but |
| 10486 | * just check for Amp-In presence (in case of mixer |
| 10487 | * without amp-in there is something wrong, this |
| 10488 | * function shouldn't be used or capsrc nid is wrong) |
| 10489 | */ |
| 10490 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10491 | snd_hda_codec_write(codec, nid, 0, |
| 10492 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10493 | mute); |
| 10494 | else if (mute != AMP_IN_MUTE(idx)) |
| 10495 | snd_hda_codec_write(codec, nid, 0, |
| 10496 | AC_VERB_SET_CONNECT_SEL, |
| 10497 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10498 | } |
| 10499 | } |
| 10500 | } |
| 10501 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10502 | /* add mic boosts if needed */ |
| 10503 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10504 | { |
| 10505 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10506 | int err; |
| 10507 | hda_nid_t nid; |
| 10508 | |
| 10509 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10510 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10511 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10512 | "Mic Boost", |
| 10513 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10514 | if (err < 0) |
| 10515 | return err; |
| 10516 | } |
| 10517 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10518 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10519 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10520 | "Front Mic Boost", |
| 10521 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10522 | if (err < 0) |
| 10523 | return err; |
| 10524 | } |
| 10525 | return 0; |
| 10526 | } |
| 10527 | |
| 10528 | /* almost identical with ALC880 parser... */ |
| 10529 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10530 | { |
| 10531 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10532 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10533 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10534 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10535 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10536 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10537 | if (err < 0) |
| 10538 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10539 | if (!spec->autocfg.line_outs) |
| 10540 | return 0; /* can't find valid BIOS pin config */ |
| 10541 | |
| 10542 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10543 | if (err < 0) |
| 10544 | return err; |
| 10545 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10546 | if (err < 0) |
| 10547 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10548 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10549 | "Headphone"); |
| 10550 | if (err < 0) |
| 10551 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10552 | err = alc880_auto_create_extra_out(spec, |
| 10553 | spec->autocfg.speaker_pins[0], |
| 10554 | "Speaker"); |
| 10555 | if (err < 0) |
| 10556 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10557 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10558 | if (err < 0) |
| 10559 | return err; |
| 10560 | |
| 10561 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10562 | |
| 10563 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10564 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10565 | hda_nid_t dig_nid; |
| 10566 | err = snd_hda_get_connections(codec, |
| 10567 | spec->autocfg.dig_out_pins[i], |
| 10568 | &dig_nid, 1); |
| 10569 | if (err < 0) |
| 10570 | continue; |
| 10571 | if (!i) |
| 10572 | spec->multiout.dig_out_nid = dig_nid; |
| 10573 | else { |
| 10574 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10575 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10576 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10577 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10578 | } |
| 10579 | } |
| 10580 | if (spec->autocfg.dig_in_pin) |
| 10581 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10582 | |
| 10583 | if (spec->kctls.list) |
| 10584 | add_mixer(spec, spec->kctls.list); |
| 10585 | |
| 10586 | add_verb(spec, alc883_auto_init_verbs); |
| 10587 | /* if ADC 0x07 is available, initialize it, too */ |
| 10588 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10589 | add_verb(spec, alc882_adc1_init_verbs); |
| 10590 | |
| 10591 | spec->num_mux_defs = 1; |
| 10592 | spec->input_mux = &spec->private_imux[0]; |
| 10593 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10594 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10595 | |
| 10596 | err = alc_auto_add_mic_boost(codec); |
| 10597 | if (err < 0) |
| 10598 | return err; |
| 10599 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10600 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10601 | } |
| 10602 | |
| 10603 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10604 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10605 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10606 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10607 | alc882_auto_init_multi_out(codec); |
| 10608 | alc882_auto_init_hp_out(codec); |
| 10609 | alc882_auto_init_analog_input(codec); |
| 10610 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10611 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10612 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10613 | } |
| 10614 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10615 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10616 | { |
| 10617 | struct alc_spec *spec; |
| 10618 | int err, board_config; |
| 10619 | |
| 10620 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10621 | if (spec == NULL) |
| 10622 | return -ENOMEM; |
| 10623 | |
| 10624 | codec->spec = spec; |
| 10625 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10626 | alc_auto_parse_customize_define(codec); |
| 10627 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10628 | switch (codec->vendor_id) { |
| 10629 | case 0x10ec0882: |
| 10630 | case 0x10ec0885: |
| 10631 | break; |
| 10632 | default: |
| 10633 | /* ALC883 and variants */ |
| 10634 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10635 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10636 | } |
| 10637 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10638 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10639 | alc882_models, |
| 10640 | alc882_cfg_tbl); |
| 10641 | |
| 10642 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10643 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10644 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10645 | |
| 10646 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10647 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10648 | codec->chip_name); |
| 10649 | board_config = ALC882_AUTO; |
| 10650 | } |
| 10651 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10652 | if (board_config == ALC882_AUTO) |
| 10653 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10654 | |
| 10655 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10656 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10657 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10658 | if (err < 0) { |
| 10659 | alc_free(codec); |
| 10660 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10661 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10662 | printk(KERN_INFO |
| 10663 | "hda_codec: Cannot set up configuration " |
| 10664 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10665 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10666 | } |
| 10667 | } |
| 10668 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10669 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10670 | if (err < 0) { |
| 10671 | alc_free(codec); |
| 10672 | return err; |
| 10673 | } |
| 10674 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10675 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10676 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10677 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10678 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10679 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10680 | /* FIXME: setup DAC5 */ |
| 10681 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10682 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10683 | |
| 10684 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10685 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10686 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10687 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10688 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10689 | spec->num_adc_nids = 0; |
| 10690 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10691 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10692 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10693 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10694 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10695 | unsigned int wcap = get_wcaps(codec, nid); |
| 10696 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10697 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10698 | if (wcap != AC_WID_AUD_IN) |
| 10699 | continue; |
| 10700 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10701 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10702 | if (err < 0) |
| 10703 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10704 | err = snd_hda_get_connections(codec, cap, items, |
| 10705 | ARRAY_SIZE(items)); |
| 10706 | if (err < 0) |
| 10707 | continue; |
| 10708 | for (j = 0; j < imux->num_items; j++) |
| 10709 | if (imux->items[j].index >= err) |
| 10710 | break; |
| 10711 | if (j < imux->num_items) |
| 10712 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10713 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10714 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10715 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10716 | spec->adc_nids = spec->private_adc_nids; |
| 10717 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10718 | } |
| 10719 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10720 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10721 | |
| 10722 | if (spec->cdefine.enable_pcbeep) |
| 10723 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10724 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10725 | if (board_config == ALC882_AUTO) |
| 10726 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10727 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10728 | spec->vmaster_nid = 0x0c; |
| 10729 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10730 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10731 | if (board_config == ALC882_AUTO) |
| 10732 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10733 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10734 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10735 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10736 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10737 | |
| 10738 | return 0; |
| 10739 | } |
| 10740 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10742 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10743 | * ALC262 support |
| 10744 | */ |
| 10745 | |
| 10746 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10747 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10748 | |
| 10749 | #define alc262_dac_nids alc260_dac_nids |
| 10750 | #define alc262_adc_nids alc882_adc_nids |
| 10751 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10752 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10753 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10754 | |
| 10755 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10756 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10757 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10758 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10759 | /* ADC0 */ |
| 10760 | 0x09 |
| 10761 | }; |
| 10762 | |
| 10763 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10764 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10765 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10766 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10767 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10769 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10770 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10771 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10772 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10774 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10775 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10777 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10778 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10780 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10781 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10782 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10783 | }; |
| 10784 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10785 | /* update HP, line and mono-out pins according to the master switch */ |
| 10786 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10787 | { |
| 10788 | struct alc_spec *spec = codec->spec; |
| 10789 | int val = spec->master_sw; |
| 10790 | |
| 10791 | /* HP & line-out */ |
| 10792 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10793 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10794 | val ? PIN_HP : 0); |
| 10795 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10796 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10797 | val ? PIN_HP : 0); |
| 10798 | /* mono (speaker) depending on the HP jack sense */ |
| 10799 | val = val && !spec->jack_present; |
| 10800 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10801 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10802 | val ? PIN_OUT : 0); |
| 10803 | } |
| 10804 | |
| 10805 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10806 | { |
| 10807 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10808 | |
| 10809 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10810 | alc262_hp_master_update(codec); |
| 10811 | } |
| 10812 | |
| 10813 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10814 | { |
| 10815 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10816 | return; |
| 10817 | alc262_hp_bpc_automute(codec); |
| 10818 | } |
| 10819 | |
| 10820 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10821 | { |
| 10822 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10823 | |
| 10824 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10825 | alc262_hp_master_update(codec); |
| 10826 | } |
| 10827 | |
| 10828 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10829 | unsigned int res) |
| 10830 | { |
| 10831 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10832 | return; |
| 10833 | alc262_hp_wildwest_automute(codec); |
| 10834 | } |
| 10835 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10836 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10837 | |
| 10838 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10839 | struct snd_ctl_elem_value *ucontrol) |
| 10840 | { |
| 10841 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10842 | struct alc_spec *spec = codec->spec; |
| 10843 | int val = !!*ucontrol->value.integer.value; |
| 10844 | |
| 10845 | if (val == spec->master_sw) |
| 10846 | return 0; |
| 10847 | spec->master_sw = val; |
| 10848 | alc262_hp_master_update(codec); |
| 10849 | return 1; |
| 10850 | } |
| 10851 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10852 | #define ALC262_HP_MASTER_SWITCH \ |
| 10853 | { \ |
| 10854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10855 | .name = "Master Playback Switch", \ |
| 10856 | .info = snd_ctl_boolean_mono_info, \ |
| 10857 | .get = alc262_hp_master_sw_get, \ |
| 10858 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10859 | }, \ |
| 10860 | { \ |
| 10861 | .iface = NID_MAPPING, \ |
| 10862 | .name = "Master Playback Switch", \ |
| 10863 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10864 | } |
| 10865 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10866 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10867 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10868 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10869 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10870 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10871 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10872 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10873 | HDA_OUTPUT), |
| 10874 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10875 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10877 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10878 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10879 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10880 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10881 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10882 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10883 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10884 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10885 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10886 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10887 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10888 | { } /* end */ |
| 10889 | }; |
| 10890 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10891 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10892 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10894 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10895 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10896 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10897 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10898 | HDA_OUTPUT), |
| 10899 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10900 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10901 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10902 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10903 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10904 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10905 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10906 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10907 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10908 | { } /* end */ |
| 10909 | }; |
| 10910 | |
| 10911 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10912 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10913 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10914 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10915 | { } /* end */ |
| 10916 | }; |
| 10917 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10918 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10919 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10920 | { |
| 10921 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10922 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10923 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10924 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10925 | } |
| 10926 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10927 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10928 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10929 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10930 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10931 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10933 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10935 | { } /* end */ |
| 10936 | }; |
| 10937 | |
| 10938 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10939 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10941 | |
| 10942 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10943 | { } |
| 10944 | }; |
| 10945 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10946 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10947 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10948 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10949 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10950 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10951 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10952 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10953 | { } /* end */ |
| 10954 | }; |
| 10955 | |
| 10956 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10957 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10958 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10961 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10962 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10964 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10966 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10967 | {} |
| 10968 | }; |
| 10969 | |
| 10970 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10971 | .num_items = 1, |
| 10972 | .items = { |
| 10973 | { "Line", 0x1 }, |
| 10974 | }, |
| 10975 | }; |
| 10976 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10977 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10978 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10979 | { |
| 10980 | struct alc_spec *spec = codec->spec; |
| 10981 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10982 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10983 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10984 | unsigned int mute; |
| 10985 | |
| 10986 | /* HP */ |
| 10987 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10988 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10989 | HDA_AMP_MUTE, mute); |
| 10990 | /* mute internal speaker per jack sense */ |
| 10991 | if (spec->jack_present) |
| 10992 | mute = HDA_AMP_MUTE; |
| 10993 | if (line_nid) |
| 10994 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10995 | HDA_AMP_MUTE, mute); |
| 10996 | if (speaker_nid && speaker_nid != line_nid) |
| 10997 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10998 | HDA_AMP_MUTE, mute); |
| 10999 | } |
| 11000 | |
| 11001 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11002 | |
| 11003 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11004 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11005 | { |
| 11006 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11007 | struct alc_spec *spec = codec->spec; |
| 11008 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11009 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11010 | if (val == spec->master_sw) |
| 11011 | return 0; |
| 11012 | spec->master_sw = val; |
| 11013 | alc262_hippo_master_update(codec); |
| 11014 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11015 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11016 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11017 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11018 | { \ |
| 11019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11020 | .name = "Master Playback Switch", \ |
| 11021 | .info = snd_ctl_boolean_mono_info, \ |
| 11022 | .get = alc262_hippo_master_sw_get, \ |
| 11023 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11024 | }, \ |
| 11025 | { \ |
| 11026 | .iface = NID_MAPPING, \ |
| 11027 | .name = "Master Playback Switch", \ |
| 11028 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11029 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11030 | } |
| 11031 | |
| 11032 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11033 | ALC262_HIPPO_MASTER_SWITCH, |
| 11034 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11035 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11036 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11037 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11038 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11039 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11040 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11041 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11042 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11043 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11044 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11045 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11046 | { } /* end */ |
| 11047 | }; |
| 11048 | |
| 11049 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11050 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11051 | ALC262_HIPPO_MASTER_SWITCH, |
| 11052 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11053 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11054 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11055 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11056 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11057 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11058 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11059 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11060 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11061 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11062 | { } /* end */ |
| 11063 | }; |
| 11064 | |
| 11065 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11066 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11067 | { |
| 11068 | struct alc_spec *spec = codec->spec; |
| 11069 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11070 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11071 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11072 | alc262_hippo_master_update(codec); |
| 11073 | } |
| 11074 | |
| 11075 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11076 | { |
| 11077 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11078 | return; |
| 11079 | alc262_hippo_automute(codec); |
| 11080 | } |
| 11081 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11082 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11083 | { |
| 11084 | struct alc_spec *spec = codec->spec; |
| 11085 | |
| 11086 | spec->autocfg.hp_pins[0] = 0x15; |
| 11087 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11088 | } |
| 11089 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11090 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11091 | { |
| 11092 | struct alc_spec *spec = codec->spec; |
| 11093 | |
| 11094 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11095 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11096 | } |
| 11097 | |
| 11098 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11099 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11100 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11101 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11103 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11104 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11105 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11106 | { } /* end */ |
| 11107 | }; |
| 11108 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11109 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11110 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11111 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11112 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11113 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11114 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11115 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11116 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11117 | { } /* end */ |
| 11118 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11119 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11120 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11121 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11122 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11123 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11124 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11125 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11126 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11129 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11130 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11131 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11132 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11133 | { } /* end */ |
| 11134 | }; |
| 11135 | |
| 11136 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11137 | /* Headphone automute */ |
| 11138 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11139 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11140 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11141 | |
| 11142 | /* P11 AUX_IN, white 4-pin connector */ |
| 11143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11144 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11145 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11146 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11147 | |
| 11148 | {} |
| 11149 | }; |
| 11150 | |
| 11151 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11152 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11153 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11154 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11155 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11156 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11157 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11158 | } |
| 11159 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11160 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11161 | #define alc262_capture_mixer alc882_capture_mixer |
| 11162 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11163 | |
| 11164 | /* |
| 11165 | * generic initialization of ADC, input mixers and output mixers |
| 11166 | */ |
| 11167 | static struct hda_verb alc262_init_verbs[] = { |
| 11168 | /* |
| 11169 | * Unmute ADC0-2 and set the default input to mic-in |
| 11170 | */ |
| 11171 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11172 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11173 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11174 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11175 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11176 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11177 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11178 | /* 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] | 11179 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11180 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11181 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11182 | */ |
| 11183 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11184 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11185 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11186 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11187 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11189 | |
| 11190 | /* |
| 11191 | * Set up output mixers (0x0c - 0x0e) |
| 11192 | */ |
| 11193 | /* set vol=0 to output mixers */ |
| 11194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11195 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11196 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11197 | /* set up input amps for analog loopback */ |
| 11198 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11201 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11202 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11203 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11204 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11205 | |
| 11206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11207 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11208 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11209 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11210 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11212 | |
| 11213 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11215 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11216 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11217 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11218 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11219 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11222 | /* FIXME: use matrix-type input source selection */ |
| 11223 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11224 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11225 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11226 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11227 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11228 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11229 | /* Input mixer2 */ |
| 11230 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11231 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11232 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11233 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11234 | /* Input mixer3 */ |
| 11235 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11236 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11237 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11239 | |
| 11240 | { } |
| 11241 | }; |
| 11242 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11243 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11244 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11245 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11246 | { } |
| 11247 | }; |
| 11248 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11249 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11250 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11251 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11252 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11253 | |
| 11254 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11255 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11256 | {} |
| 11257 | }; |
| 11258 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11259 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11261 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11262 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11263 | |
| 11264 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11266 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11267 | }; |
| 11268 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11269 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11270 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11271 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11272 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11273 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11275 | { } /* end */ |
| 11276 | }; |
| 11277 | |
| 11278 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11279 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11280 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11281 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11282 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11283 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11284 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11285 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11286 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11287 | {} |
| 11288 | }; |
| 11289 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11290 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11291 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11292 | struct alc_spec *spec = codec->spec; |
| 11293 | |
| 11294 | spec->autocfg.hp_pins[0] = 0x15; |
| 11295 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11296 | spec->ext_mic.pin = 0x18; |
| 11297 | spec->ext_mic.mux_idx = 0; |
| 11298 | spec->int_mic.pin = 0x12; |
| 11299 | spec->int_mic.mux_idx = 9; |
| 11300 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11301 | } |
| 11302 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11303 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11304 | * nec model |
| 11305 | * 0x15 = headphone |
| 11306 | * 0x16 = internal speaker |
| 11307 | * 0x18 = external mic |
| 11308 | */ |
| 11309 | |
| 11310 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11311 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11312 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11313 | |
| 11314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11316 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11317 | |
| 11318 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11319 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11320 | { } /* end */ |
| 11321 | }; |
| 11322 | |
| 11323 | static struct hda_verb alc262_nec_verbs[] = { |
| 11324 | /* Unmute Speaker */ |
| 11325 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11326 | |
| 11327 | /* Headphone */ |
| 11328 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11329 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11330 | |
| 11331 | /* External mic to headphone */ |
| 11332 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11333 | /* External mic to speaker */ |
| 11334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11335 | {} |
| 11336 | }; |
| 11337 | |
| 11338 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11339 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11340 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11341 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11342 | */ |
| 11343 | |
| 11344 | #define ALC_HP_EVENT 0x37 |
| 11345 | |
| 11346 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11347 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11348 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11349 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11350 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11351 | {} |
| 11352 | }; |
| 11353 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11354 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11355 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11356 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11357 | {} |
| 11358 | }; |
| 11359 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11360 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11361 | /* Front Mic pin: input vref at 50% */ |
| 11362 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11363 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11364 | {} |
| 11365 | }; |
| 11366 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11367 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11368 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11369 | .items = { |
| 11370 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11371 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11372 | { "CD", 0x4 }, |
| 11373 | }, |
| 11374 | }; |
| 11375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11376 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11377 | .num_items = 5, |
| 11378 | .items = { |
| 11379 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11380 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11381 | { "Line", 0x2 }, |
| 11382 | { "CD", 0x4 }, |
| 11383 | { "AUX IN", 0x6 }, |
| 11384 | }, |
| 11385 | }; |
| 11386 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11387 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11388 | .num_items = 4, |
| 11389 | .items = { |
| 11390 | { "Mic", 0x0 }, |
| 11391 | { "Front Mic", 0x2 }, |
| 11392 | { "Line", 0x1 }, |
| 11393 | { "CD", 0x4 }, |
| 11394 | }, |
| 11395 | }; |
| 11396 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11397 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11398 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11399 | { |
| 11400 | struct alc_spec *spec = codec->spec; |
| 11401 | unsigned int mute; |
| 11402 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11403 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11404 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11405 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11406 | spec->sense_updated = 1; |
| 11407 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11408 | /* unmute internal speaker only if both HPs are unplugged and |
| 11409 | * master switch is on |
| 11410 | */ |
| 11411 | if (spec->jack_present) |
| 11412 | mute = HDA_AMP_MUTE; |
| 11413 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11414 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11415 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11416 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11417 | } |
| 11418 | |
| 11419 | /* unsolicited event for HP jack sensing */ |
| 11420 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11421 | unsigned int res) |
| 11422 | { |
| 11423 | if ((res >> 26) != ALC_HP_EVENT) |
| 11424 | return; |
| 11425 | alc262_fujitsu_automute(codec, 1); |
| 11426 | } |
| 11427 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11428 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11429 | { |
| 11430 | alc262_fujitsu_automute(codec, 1); |
| 11431 | } |
| 11432 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11433 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11434 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11435 | .ops = &snd_hda_bind_vol, |
| 11436 | .values = { |
| 11437 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11438 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11439 | 0 |
| 11440 | }, |
| 11441 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11442 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11443 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11444 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11445 | { |
| 11446 | struct alc_spec *spec = codec->spec; |
| 11447 | unsigned int mute; |
| 11448 | |
| 11449 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11450 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11451 | spec->sense_updated = 1; |
| 11452 | } |
| 11453 | if (spec->jack_present) { |
| 11454 | /* mute internal speaker */ |
| 11455 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11456 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11457 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11458 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11459 | } else { |
| 11460 | /* unmute internal speaker if necessary */ |
| 11461 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11462 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11463 | HDA_AMP_MUTE, mute); |
| 11464 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11465 | HDA_AMP_MUTE, mute); |
| 11466 | } |
| 11467 | } |
| 11468 | |
| 11469 | /* unsolicited event for HP jack sensing */ |
| 11470 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11471 | unsigned int res) |
| 11472 | { |
| 11473 | if ((res >> 26) != ALC_HP_EVENT) |
| 11474 | return; |
| 11475 | alc262_lenovo_3000_automute(codec, 1); |
| 11476 | } |
| 11477 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11478 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11479 | int dir, int idx, long *valp) |
| 11480 | { |
| 11481 | int i, change = 0; |
| 11482 | |
| 11483 | for (i = 0; i < 2; i++, valp++) |
| 11484 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11485 | HDA_AMP_MUTE, |
| 11486 | *valp ? 0 : HDA_AMP_MUTE); |
| 11487 | return change; |
| 11488 | } |
| 11489 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11490 | /* bind hp and internal speaker mute (with plug check) */ |
| 11491 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11492 | struct snd_ctl_elem_value *ucontrol) |
| 11493 | { |
| 11494 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11495 | long *valp = ucontrol->value.integer.value; |
| 11496 | int change; |
| 11497 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11498 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11499 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11500 | if (change) |
| 11501 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11502 | return change; |
| 11503 | } |
| 11504 | |
| 11505 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11506 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11507 | { |
| 11508 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11509 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11510 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11511 | .info = snd_hda_mixer_amp_switch_info, |
| 11512 | .get = snd_hda_mixer_amp_switch_get, |
| 11513 | .put = alc262_fujitsu_master_sw_put, |
| 11514 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11515 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11516 | { |
| 11517 | .iface = NID_MAPPING, |
| 11518 | .name = "Master Playback Switch", |
| 11519 | .private_value = 0x1b, |
| 11520 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11521 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11522 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11523 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11526 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11527 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11528 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11529 | { } /* end */ |
| 11530 | }; |
| 11531 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11532 | /* bind hp and internal speaker mute (with plug check) */ |
| 11533 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11534 | struct snd_ctl_elem_value *ucontrol) |
| 11535 | { |
| 11536 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11537 | long *valp = ucontrol->value.integer.value; |
| 11538 | int change; |
| 11539 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11540 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11541 | if (change) |
| 11542 | alc262_lenovo_3000_automute(codec, 0); |
| 11543 | return change; |
| 11544 | } |
| 11545 | |
| 11546 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11547 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11548 | { |
| 11549 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11550 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11551 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11552 | .info = snd_hda_mixer_amp_switch_info, |
| 11553 | .get = snd_hda_mixer_amp_switch_get, |
| 11554 | .put = alc262_lenovo_3000_master_sw_put, |
| 11555 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11556 | }, |
| 11557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11558 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11559 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11562 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11563 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11564 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11565 | { } /* end */ |
| 11566 | }; |
| 11567 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11568 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11569 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11570 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11572 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11573 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11574 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11575 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11576 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11577 | { } /* end */ |
| 11578 | }; |
| 11579 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11580 | /* additional init verbs for Benq laptops */ |
| 11581 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11582 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11583 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11584 | {} |
| 11585 | }; |
| 11586 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11587 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11588 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11589 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11590 | |
| 11591 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11592 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11593 | {} |
| 11594 | }; |
| 11595 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11596 | /* Samsung Q1 Ultra Vista model setup */ |
| 11597 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11598 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11599 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11600 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11601 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11602 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11603 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11604 | { } /* end */ |
| 11605 | }; |
| 11606 | |
| 11607 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11608 | /* output mixer */ |
| 11609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11610 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11611 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11612 | /* speaker */ |
| 11613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11614 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11615 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11616 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11617 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11618 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11619 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11620 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11621 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11622 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11623 | /* internal mic */ |
| 11624 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11625 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11626 | /* ADC, choose mic */ |
| 11627 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11628 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11629 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11630 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11631 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11632 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11633 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11634 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11635 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11636 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11637 | {} |
| 11638 | }; |
| 11639 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11640 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11641 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11642 | { |
| 11643 | struct alc_spec *spec = codec->spec; |
| 11644 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11645 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11646 | mute = 0; |
| 11647 | /* auto-mute only when HP is used as HP */ |
| 11648 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11649 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11650 | if (spec->jack_present) |
| 11651 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11652 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11653 | /* mute/unmute internal speaker */ |
| 11654 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11655 | HDA_AMP_MUTE, mute); |
| 11656 | /* mute/unmute HP */ |
| 11657 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11658 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11659 | } |
| 11660 | |
| 11661 | /* unsolicited event for HP jack sensing */ |
| 11662 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11663 | unsigned int res) |
| 11664 | { |
| 11665 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11666 | return; |
| 11667 | alc262_ultra_automute(codec); |
| 11668 | } |
| 11669 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11670 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11671 | .num_items = 2, |
| 11672 | .items = { |
| 11673 | { "Mic", 0x1 }, |
| 11674 | { "Headphone", 0x7 }, |
| 11675 | }, |
| 11676 | }; |
| 11677 | |
| 11678 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11679 | struct snd_ctl_elem_value *ucontrol) |
| 11680 | { |
| 11681 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11682 | struct alc_spec *spec = codec->spec; |
| 11683 | int ret; |
| 11684 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11685 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11686 | if (!ret) |
| 11687 | return 0; |
| 11688 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11689 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11690 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11691 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11692 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11693 | return ret; |
| 11694 | } |
| 11695 | |
| 11696 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11697 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11698 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11699 | { |
| 11700 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11701 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11702 | .info = alc_mux_enum_info, |
| 11703 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11704 | .put = alc262_ultra_mux_enum_put, |
| 11705 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11706 | { |
| 11707 | .iface = NID_MAPPING, |
| 11708 | .name = "Capture Source", |
| 11709 | .private_value = 0x15, |
| 11710 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11711 | { } /* end */ |
| 11712 | }; |
| 11713 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11714 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11715 | * and thus it's bound with a different mixer. |
| 11716 | * This function returns which mixer amp should be used. |
| 11717 | */ |
| 11718 | static int alc262_check_volbit(hda_nid_t nid) |
| 11719 | { |
| 11720 | if (!nid) |
| 11721 | return 0; |
| 11722 | else if (nid == 0x16) |
| 11723 | return 2; |
| 11724 | else |
| 11725 | return 1; |
| 11726 | } |
| 11727 | |
| 11728 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11729 | const char *pfx, int *vbits) |
| 11730 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11731 | unsigned long val; |
| 11732 | int vbit; |
| 11733 | |
| 11734 | vbit = alc262_check_volbit(nid); |
| 11735 | if (!vbit) |
| 11736 | return 0; |
| 11737 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11738 | return 0; |
| 11739 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11740 | if (vbit == 2) |
| 11741 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11742 | else |
| 11743 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11744 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11745 | } |
| 11746 | |
| 11747 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11748 | const char *pfx) |
| 11749 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11750 | unsigned long val; |
| 11751 | |
| 11752 | if (!nid) |
| 11753 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11754 | if (nid == 0x16) |
| 11755 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11756 | else |
| 11757 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11758 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11759 | } |
| 11760 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11761 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11762 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11763 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11764 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11765 | const char *pfx; |
| 11766 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11767 | int err; |
| 11768 | |
| 11769 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11770 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11771 | spec->multiout.dac_nids[0] = 2; |
| 11772 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11773 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11774 | pfx = "Master"; |
| 11775 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11776 | pfx = "Speaker"; |
| 11777 | else |
| 11778 | pfx = "Front"; |
| 11779 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11780 | if (err < 0) |
| 11781 | return err; |
| 11782 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11783 | if (err < 0) |
| 11784 | return err; |
| 11785 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11786 | if (err < 0) |
| 11787 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11788 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11789 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11790 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11791 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11792 | if (vbits == 1 || vbits == 2) |
| 11793 | pfx = "Master"; /* only one mixer is used */ |
| 11794 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11795 | pfx = "Speaker"; |
| 11796 | else |
| 11797 | pfx = "Front"; |
| 11798 | vbits = 0; |
| 11799 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11800 | if (err < 0) |
| 11801 | return err; |
| 11802 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11803 | &vbits); |
| 11804 | if (err < 0) |
| 11805 | return err; |
| 11806 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11807 | &vbits); |
| 11808 | if (err < 0) |
| 11809 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11810 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11811 | } |
| 11812 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11813 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11814 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11815 | |
| 11816 | /* |
| 11817 | * generic initialization of ADC, input mixers and output mixers |
| 11818 | */ |
| 11819 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11820 | /* |
| 11821 | * Unmute ADC0-2 and set the default input to mic-in |
| 11822 | */ |
| 11823 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11825 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11826 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11827 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11828 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11829 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11830 | /* 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] | 11831 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11832 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11833 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11834 | */ |
| 11835 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11836 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11837 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11838 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11839 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11840 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11841 | |
| 11842 | /* |
| 11843 | * Set up output mixers (0x0c - 0x0f) |
| 11844 | */ |
| 11845 | /* set vol=0 to output mixers */ |
| 11846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11849 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11850 | /* set up input amps for analog loopback */ |
| 11851 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11852 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11854 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11855 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11856 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11857 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11858 | |
| 11859 | /* FIXME: use matrix-type input source selection */ |
| 11860 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11861 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11864 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11866 | /* Input mixer2 */ |
| 11867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11871 | /* Input mixer3 */ |
| 11872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11876 | |
| 11877 | { } |
| 11878 | }; |
| 11879 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11880 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11881 | /* |
| 11882 | * Unmute ADC0-2 and set the default input to mic-in |
| 11883 | */ |
| 11884 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11885 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11886 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11888 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11890 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11891 | /* 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] | 11892 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11893 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11894 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11895 | */ |
| 11896 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11897 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11900 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11904 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11905 | /* |
| 11906 | * Set up output mixers (0x0c - 0x0e) |
| 11907 | */ |
| 11908 | /* set vol=0 to output mixers */ |
| 11909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11910 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11911 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11912 | |
| 11913 | /* set up input amps for analog loopback */ |
| 11914 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11921 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11922 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11925 | |
| 11926 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11928 | |
| 11929 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11930 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11931 | |
| 11932 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11933 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11936 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11937 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11938 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11939 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11941 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11942 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11943 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11944 | |
| 11945 | |
| 11946 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11947 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11948 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11949 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11950 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11951 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11952 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11953 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11954 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11955 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11958 | /* Input mixer2 */ |
| 11959 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11960 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11961 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11962 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11968 | /* Input mixer3 */ |
| 11969 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11970 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11974 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11976 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11978 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11979 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11980 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11981 | { } |
| 11982 | }; |
| 11983 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11984 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11985 | /* |
| 11986 | * Unmute ADC0-2 and set the default input to mic-in |
| 11987 | */ |
| 11988 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11990 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11992 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11993 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11994 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11995 | /* 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] | 11996 | * mixer widget |
| 11997 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11998 | * panel mic (mic 2) |
| 11999 | */ |
| 12000 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12001 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12002 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12009 | /* |
| 12010 | * Set up output mixers (0x0c - 0x0e) |
| 12011 | */ |
| 12012 | /* set vol=0 to output mixers */ |
| 12013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12014 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12016 | |
| 12017 | /* set up input amps for analog loopback */ |
| 12018 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12023 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12025 | |
| 12026 | |
| 12027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12028 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12029 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12030 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12031 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12033 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12034 | |
| 12035 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12037 | |
| 12038 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12039 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12040 | |
| 12041 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12043 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12044 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12045 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12046 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12047 | |
| 12048 | /* FIXME: use matrix-type input source selection */ |
| 12049 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12050 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12053 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12054 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12055 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12056 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12057 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12058 | /* Input mixer2 */ |
| 12059 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12060 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12061 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12062 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12063 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12064 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12065 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12066 | /* Input mixer3 */ |
| 12067 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12068 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12069 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12070 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12071 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12072 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12074 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12075 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12076 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12077 | { } |
| 12078 | }; |
| 12079 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12080 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12081 | |
| 12082 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12083 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12084 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12085 | |
| 12086 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12087 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12089 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12090 | |
| 12091 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12092 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12093 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12094 | {} |
| 12095 | }; |
| 12096 | |
| 12097 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12098 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12099 | #define alc262_loopbacks alc880_loopbacks |
| 12100 | #endif |
| 12101 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12102 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12103 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12104 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12105 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12106 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12107 | |
| 12108 | /* |
| 12109 | * BIOS auto configuration |
| 12110 | */ |
| 12111 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12112 | { |
| 12113 | struct alc_spec *spec = codec->spec; |
| 12114 | int err; |
| 12115 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12116 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12117 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12118 | alc262_ignore); |
| 12119 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12120 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12121 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12122 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12123 | spec->multiout.max_channels = 2; |
| 12124 | spec->no_analog = 1; |
| 12125 | goto dig_only; |
| 12126 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12127 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12128 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12129 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12130 | if (err < 0) |
| 12131 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12132 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12133 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12134 | return err; |
| 12135 | |
| 12136 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12137 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12138 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12139 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12140 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12141 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12142 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12143 | if (spec->autocfg.dig_in_pin) |
| 12144 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 12145 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12146 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12147 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12148 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12149 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12150 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12151 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12152 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12153 | err = alc_auto_add_mic_boost(codec); |
| 12154 | if (err < 0) |
| 12155 | return err; |
| 12156 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12157 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12158 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12159 | return 1; |
| 12160 | } |
| 12161 | |
| 12162 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12163 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12164 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12165 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12166 | |
| 12167 | |
| 12168 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12169 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12170 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12171 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12172 | alc262_auto_init_multi_out(codec); |
| 12173 | alc262_auto_init_hp_out(codec); |
| 12174 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12175 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12176 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12177 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12178 | } |
| 12179 | |
| 12180 | /* |
| 12181 | * configuration and preset |
| 12182 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12183 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12184 | [ALC262_BASIC] = "basic", |
| 12185 | [ALC262_HIPPO] = "hippo", |
| 12186 | [ALC262_HIPPO_1] = "hippo_1", |
| 12187 | [ALC262_FUJITSU] = "fujitsu", |
| 12188 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12189 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12190 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12191 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12192 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12193 | [ALC262_BENQ_T31] = "benq-t31", |
| 12194 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12195 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12196 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12197 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12198 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12199 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12200 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12201 | [ALC262_AUTO] = "auto", |
| 12202 | }; |
| 12203 | |
| 12204 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12205 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12206 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12207 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12208 | ALC262_HP_BPC), |
| 12209 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12210 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12211 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12212 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12213 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12214 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12215 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12216 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12217 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12218 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12219 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12220 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12221 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12222 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12223 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12224 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12225 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12226 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12227 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12228 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12229 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12230 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12231 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12232 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12233 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12234 | #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] | 12235 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12236 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12237 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12238 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12239 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12240 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12241 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12242 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12243 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12244 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12245 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12246 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12247 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12248 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12249 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12250 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12251 | {} |
| 12252 | }; |
| 12253 | |
| 12254 | static struct alc_config_preset alc262_presets[] = { |
| 12255 | [ALC262_BASIC] = { |
| 12256 | .mixers = { alc262_base_mixer }, |
| 12257 | .init_verbs = { alc262_init_verbs }, |
| 12258 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12259 | .dac_nids = alc262_dac_nids, |
| 12260 | .hp_nid = 0x03, |
| 12261 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12262 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12263 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12264 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12265 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12266 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12267 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12268 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12269 | .dac_nids = alc262_dac_nids, |
| 12270 | .hp_nid = 0x03, |
| 12271 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12272 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12273 | .channel_mode = alc262_modes, |
| 12274 | .input_mux = &alc262_capture_source, |
| 12275 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12276 | .setup = alc262_hippo_setup, |
| 12277 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12278 | }, |
| 12279 | [ALC262_HIPPO_1] = { |
| 12280 | .mixers = { alc262_hippo1_mixer }, |
| 12281 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12282 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12283 | .dac_nids = alc262_dac_nids, |
| 12284 | .hp_nid = 0x02, |
| 12285 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12286 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12287 | .channel_mode = alc262_modes, |
| 12288 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12289 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12290 | .setup = alc262_hippo1_setup, |
| 12291 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12292 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12293 | [ALC262_FUJITSU] = { |
| 12294 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12295 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12296 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12297 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12298 | .dac_nids = alc262_dac_nids, |
| 12299 | .hp_nid = 0x03, |
| 12300 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12301 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12302 | .channel_mode = alc262_modes, |
| 12303 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12304 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12305 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12306 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12307 | [ALC262_HP_BPC] = { |
| 12308 | .mixers = { alc262_HP_BPC_mixer }, |
| 12309 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12310 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12311 | .dac_nids = alc262_dac_nids, |
| 12312 | .hp_nid = 0x03, |
| 12313 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12314 | .channel_mode = alc262_modes, |
| 12315 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12316 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12317 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12318 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12319 | [ALC262_HP_BPC_D7000_WF] = { |
| 12320 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12321 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12322 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12323 | .dac_nids = alc262_dac_nids, |
| 12324 | .hp_nid = 0x03, |
| 12325 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12326 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12327 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12328 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12329 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12330 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12331 | [ALC262_HP_BPC_D7000_WL] = { |
| 12332 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12333 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12334 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12335 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12336 | .dac_nids = alc262_dac_nids, |
| 12337 | .hp_nid = 0x03, |
| 12338 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12339 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12340 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12341 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12342 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12343 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12344 | [ALC262_HP_TC_T5735] = { |
| 12345 | .mixers = { alc262_hp_t5735_mixer }, |
| 12346 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12347 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12348 | .dac_nids = alc262_dac_nids, |
| 12349 | .hp_nid = 0x03, |
| 12350 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12351 | .channel_mode = alc262_modes, |
| 12352 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12353 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12354 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12355 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12356 | }, |
| 12357 | [ALC262_HP_RP5700] = { |
| 12358 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12359 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12360 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12361 | .dac_nids = alc262_dac_nids, |
| 12362 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12363 | .channel_mode = alc262_modes, |
| 12364 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12365 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12366 | [ALC262_BENQ_ED8] = { |
| 12367 | .mixers = { alc262_base_mixer }, |
| 12368 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12369 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12370 | .dac_nids = alc262_dac_nids, |
| 12371 | .hp_nid = 0x03, |
| 12372 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12373 | .channel_mode = alc262_modes, |
| 12374 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12375 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12376 | [ALC262_SONY_ASSAMD] = { |
| 12377 | .mixers = { alc262_sony_mixer }, |
| 12378 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12379 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12380 | .dac_nids = alc262_dac_nids, |
| 12381 | .hp_nid = 0x02, |
| 12382 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12383 | .channel_mode = alc262_modes, |
| 12384 | .input_mux = &alc262_capture_source, |
| 12385 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12386 | .setup = alc262_hippo_setup, |
| 12387 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12388 | }, |
| 12389 | [ALC262_BENQ_T31] = { |
| 12390 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12391 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12392 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12393 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12394 | .dac_nids = alc262_dac_nids, |
| 12395 | .hp_nid = 0x03, |
| 12396 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12397 | .channel_mode = alc262_modes, |
| 12398 | .input_mux = &alc262_capture_source, |
| 12399 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12400 | .setup = alc262_hippo_setup, |
| 12401 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12402 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12403 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12404 | .mixers = { alc262_ultra_mixer }, |
| 12405 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12406 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12407 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12408 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12409 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12410 | .channel_mode = alc262_modes, |
| 12411 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12412 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12413 | .capsrc_nids = alc262_capsrc_nids, |
| 12414 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12415 | .unsol_event = alc262_ultra_unsol_event, |
| 12416 | .init_hook = alc262_ultra_automute, |
| 12417 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12418 | [ALC262_LENOVO_3000] = { |
| 12419 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12420 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12421 | alc262_lenovo_3000_unsol_verbs, |
| 12422 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12423 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12424 | .dac_nids = alc262_dac_nids, |
| 12425 | .hp_nid = 0x03, |
| 12426 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12427 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12428 | .channel_mode = alc262_modes, |
| 12429 | .input_mux = &alc262_fujitsu_capture_source, |
| 12430 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12431 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12432 | [ALC262_NEC] = { |
| 12433 | .mixers = { alc262_nec_mixer }, |
| 12434 | .init_verbs = { alc262_nec_verbs }, |
| 12435 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12436 | .dac_nids = alc262_dac_nids, |
| 12437 | .hp_nid = 0x03, |
| 12438 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12439 | .channel_mode = alc262_modes, |
| 12440 | .input_mux = &alc262_capture_source, |
| 12441 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12442 | [ALC262_TOSHIBA_S06] = { |
| 12443 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12444 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12445 | alc262_eapd_verbs }, |
| 12446 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12447 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12448 | .dac_nids = alc262_dac_nids, |
| 12449 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12450 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12451 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12452 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12453 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12454 | .unsol_event = alc_sku_unsol_event, |
| 12455 | .setup = alc262_toshiba_s06_setup, |
| 12456 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12457 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12458 | [ALC262_TOSHIBA_RX1] = { |
| 12459 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12460 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12461 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12462 | .dac_nids = alc262_dac_nids, |
| 12463 | .hp_nid = 0x03, |
| 12464 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12465 | .channel_mode = alc262_modes, |
| 12466 | .input_mux = &alc262_capture_source, |
| 12467 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12468 | .setup = alc262_hippo_setup, |
| 12469 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12470 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12471 | [ALC262_TYAN] = { |
| 12472 | .mixers = { alc262_tyan_mixer }, |
| 12473 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12474 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12475 | .dac_nids = alc262_dac_nids, |
| 12476 | .hp_nid = 0x02, |
| 12477 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12478 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12479 | .channel_mode = alc262_modes, |
| 12480 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12481 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12482 | .setup = alc262_tyan_setup, |
| 12483 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12484 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12485 | }; |
| 12486 | |
| 12487 | static int patch_alc262(struct hda_codec *codec) |
| 12488 | { |
| 12489 | struct alc_spec *spec; |
| 12490 | int board_config; |
| 12491 | int err; |
| 12492 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12493 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12494 | if (spec == NULL) |
| 12495 | return -ENOMEM; |
| 12496 | |
| 12497 | codec->spec = spec; |
| 12498 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12499 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12500 | * under-run |
| 12501 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12502 | { |
| 12503 | int tmp; |
| 12504 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12505 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12506 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12507 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12508 | } |
| 12509 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12510 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12511 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12512 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12513 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12514 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12515 | alc262_models, |
| 12516 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12517 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12518 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12519 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12520 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12521 | board_config = ALC262_AUTO; |
| 12522 | } |
| 12523 | |
| 12524 | if (board_config == ALC262_AUTO) { |
| 12525 | /* automatic parse from the BIOS config */ |
| 12526 | err = alc262_parse_auto_config(codec); |
| 12527 | if (err < 0) { |
| 12528 | alc_free(codec); |
| 12529 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12530 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12531 | printk(KERN_INFO |
| 12532 | "hda_codec: Cannot set up configuration " |
| 12533 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12534 | board_config = ALC262_BASIC; |
| 12535 | } |
| 12536 | } |
| 12537 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12538 | if (!spec->no_analog) { |
| 12539 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12540 | if (err < 0) { |
| 12541 | alc_free(codec); |
| 12542 | return err; |
| 12543 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12544 | } |
| 12545 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12546 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12547 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12548 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12549 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12550 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12551 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12552 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12553 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12554 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12555 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12556 | int i; |
| 12557 | /* check whether the digital-mic has to be supported */ |
| 12558 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12559 | if (spec->input_mux->items[i].index >= 9) |
| 12560 | break; |
| 12561 | } |
| 12562 | if (i < spec->input_mux->num_items) { |
| 12563 | /* use only ADC0 */ |
| 12564 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12565 | spec->num_adc_nids = 1; |
| 12566 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12568 | /* all analog inputs */ |
| 12569 | /* check whether NID 0x07 is valid */ |
| 12570 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12571 | |
| 12572 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12573 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12574 | if (wcap != AC_WID_AUD_IN) { |
| 12575 | spec->adc_nids = alc262_adc_nids_alt; |
| 12576 | spec->num_adc_nids = |
| 12577 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12578 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12579 | } else { |
| 12580 | spec->adc_nids = alc262_adc_nids; |
| 12581 | spec->num_adc_nids = |
| 12582 | ARRAY_SIZE(alc262_adc_nids); |
| 12583 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12584 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12585 | } |
| 12586 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12587 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12588 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12589 | if (!spec->no_analog && spec->cdefine.enable_pcbeep) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12590 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12591 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12592 | spec->vmaster_nid = 0x0c; |
| 12593 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12594 | codec->patch_ops = alc_patch_ops; |
| 12595 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12596 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12597 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12598 | if (!spec->loopback.amplist) |
| 12599 | spec->loopback.amplist = alc262_loopbacks; |
| 12600 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12601 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12602 | return 0; |
| 12603 | } |
| 12604 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12605 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12606 | * ALC268 channel source setting (2 channel) |
| 12607 | */ |
| 12608 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12609 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12610 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12611 | static hda_nid_t alc268_dac_nids[2] = { |
| 12612 | /* front, hp */ |
| 12613 | 0x02, 0x03 |
| 12614 | }; |
| 12615 | |
| 12616 | static hda_nid_t alc268_adc_nids[2] = { |
| 12617 | /* ADC0-1 */ |
| 12618 | 0x08, 0x07 |
| 12619 | }; |
| 12620 | |
| 12621 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12622 | /* ADC0 */ |
| 12623 | 0x08 |
| 12624 | }; |
| 12625 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12626 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12627 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12628 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12629 | /* output mixer control */ |
| 12630 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12631 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12632 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12635 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12636 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12637 | { } |
| 12638 | }; |
| 12639 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12640 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12641 | /* output mixer control */ |
| 12642 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12643 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12644 | ALC262_HIPPO_MASTER_SWITCH, |
| 12645 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12646 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12647 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12648 | { } |
| 12649 | }; |
| 12650 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12651 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12652 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12653 | .ops = &snd_hda_bind_sw, |
| 12654 | .values = { |
| 12655 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12656 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12657 | 0 |
| 12658 | }, |
| 12659 | }; |
| 12660 | |
| 12661 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12662 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12663 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12664 | { } |
| 12665 | }; |
| 12666 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12667 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12668 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12669 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12670 | { } |
| 12671 | }; |
| 12672 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12673 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12674 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12675 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12676 | { } /* end */ |
| 12677 | }; |
| 12678 | |
| 12679 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12680 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12681 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12682 | .ops = &snd_hda_bind_vol, |
| 12683 | .values = { |
| 12684 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12685 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12686 | 0 |
| 12687 | }, |
| 12688 | }; |
| 12689 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12690 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12691 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12692 | { |
| 12693 | struct alc_spec *spec = codec->spec; |
| 12694 | unsigned int mute; |
| 12695 | |
| 12696 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12697 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12698 | spec->sense_updated = 1; |
| 12699 | } |
| 12700 | if (spec->jack_present) |
| 12701 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12702 | else /* unmute internal speaker if necessary */ |
| 12703 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12704 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12705 | HDA_AMP_MUTE, mute); |
| 12706 | } |
| 12707 | |
| 12708 | |
| 12709 | /* bind hp and internal speaker mute (with plug check) */ |
| 12710 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12711 | struct snd_ctl_elem_value *ucontrol) |
| 12712 | { |
| 12713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12714 | long *valp = ucontrol->value.integer.value; |
| 12715 | int change; |
| 12716 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12717 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12718 | if (change) |
| 12719 | alc268_acer_automute(codec, 0); |
| 12720 | return change; |
| 12721 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12722 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12723 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12724 | /* output mixer control */ |
| 12725 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12726 | { |
| 12727 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12728 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12729 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12730 | .info = snd_hda_mixer_amp_switch_info, |
| 12731 | .get = snd_hda_mixer_amp_switch_get, |
| 12732 | .put = alc268_acer_master_sw_put, |
| 12733 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12734 | }, |
| 12735 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12736 | { } |
| 12737 | }; |
| 12738 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12739 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12740 | /* output mixer control */ |
| 12741 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12742 | { |
| 12743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12744 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12745 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12746 | .info = snd_hda_mixer_amp_switch_info, |
| 12747 | .get = snd_hda_mixer_amp_switch_get, |
| 12748 | .put = alc268_acer_master_sw_put, |
| 12749 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12750 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12751 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12752 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12753 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12754 | { } |
| 12755 | }; |
| 12756 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12757 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12758 | /* output mixer control */ |
| 12759 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12760 | { |
| 12761 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12762 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12763 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12764 | .info = snd_hda_mixer_amp_switch_info, |
| 12765 | .get = snd_hda_mixer_amp_switch_get, |
| 12766 | .put = alc268_acer_master_sw_put, |
| 12767 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12768 | }, |
| 12769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12770 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12771 | { } |
| 12772 | }; |
| 12773 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12774 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12775 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12777 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12778 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12779 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12780 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12781 | { } |
| 12782 | }; |
| 12783 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12784 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12785 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12786 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12789 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12790 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12791 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12792 | { } |
| 12793 | }; |
| 12794 | |
| 12795 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12796 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12797 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12798 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12799 | |
| 12800 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12801 | unsigned int res) |
| 12802 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12803 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12804 | return; |
| 12805 | alc268_acer_automute(codec, 1); |
| 12806 | } |
| 12807 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12808 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12809 | { |
| 12810 | alc268_acer_automute(codec, 1); |
| 12811 | } |
| 12812 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12813 | /* toggle speaker-output according to the hp-jack state */ |
| 12814 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12815 | { |
| 12816 | unsigned int present; |
| 12817 | unsigned char bits; |
| 12818 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12819 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12820 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12821 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12822 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12823 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12824 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12825 | } |
| 12826 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12827 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12828 | unsigned int res) |
| 12829 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12830 | switch (res >> 26) { |
| 12831 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12832 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12833 | break; |
| 12834 | case ALC880_MIC_EVENT: |
| 12835 | alc_mic_automute(codec); |
| 12836 | break; |
| 12837 | } |
| 12838 | } |
| 12839 | |
| 12840 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12841 | { |
| 12842 | struct alc_spec *spec = codec->spec; |
| 12843 | spec->ext_mic.pin = 0x18; |
| 12844 | spec->ext_mic.mux_idx = 0; |
| 12845 | spec->int_mic.pin = 0x12; |
| 12846 | spec->int_mic.mux_idx = 6; |
| 12847 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12848 | } |
| 12849 | |
| 12850 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12851 | { |
| 12852 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12853 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12854 | } |
| 12855 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12856 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12857 | /* output mixer control */ |
| 12858 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12859 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12860 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12863 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12864 | { } |
| 12865 | }; |
| 12866 | |
| 12867 | static struct hda_verb alc268_dell_verbs[] = { |
| 12868 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12869 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12870 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12871 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12872 | { } |
| 12873 | }; |
| 12874 | |
| 12875 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12876 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12877 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12878 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12879 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12880 | spec->autocfg.hp_pins[0] = 0x15; |
| 12881 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12882 | spec->ext_mic.pin = 0x18; |
| 12883 | spec->ext_mic.mux_idx = 0; |
| 12884 | spec->int_mic.pin = 0x19; |
| 12885 | spec->int_mic.mux_idx = 1; |
| 12886 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12887 | } |
| 12888 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12889 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12890 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12891 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12892 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12894 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12895 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12896 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12897 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12898 | { } |
| 12899 | }; |
| 12900 | |
| 12901 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12902 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12903 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12904 | { } |
| 12905 | }; |
| 12906 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12907 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12908 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12909 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12910 | spec->autocfg.hp_pins[0] = 0x15; |
| 12911 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12912 | spec->ext_mic.pin = 0x18; |
| 12913 | spec->ext_mic.mux_idx = 0; |
| 12914 | spec->int_mic.pin = 0x19; |
| 12915 | spec->int_mic.mux_idx = 1; |
| 12916 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12917 | } |
| 12918 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12919 | /* |
| 12920 | * generic initialization of ADC, input mixers and output mixers |
| 12921 | */ |
| 12922 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12923 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12924 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12925 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12926 | |
| 12927 | /* |
| 12928 | * Set up output mixers (0x0c - 0x0e) |
| 12929 | */ |
| 12930 | /* set vol=0 to output mixers */ |
| 12931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12932 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12933 | |
| 12934 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12935 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12936 | |
| 12937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12939 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12940 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12941 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12942 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12943 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12944 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12945 | |
| 12946 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12948 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12949 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12950 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12951 | |
| 12952 | /* set PCBEEP vol = 0, mute connections */ |
| 12953 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12954 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12955 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12956 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12957 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12958 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12959 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12960 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12961 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12962 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12963 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12964 | { } |
| 12965 | }; |
| 12966 | |
| 12967 | /* |
| 12968 | * generic initialization of ADC, input mixers and output mixers |
| 12969 | */ |
| 12970 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12971 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12972 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12973 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12974 | |
| 12975 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12976 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12977 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12978 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12979 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12980 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12981 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12982 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12983 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12984 | |
| 12985 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12986 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12987 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12988 | /* set PCBEEP vol = 0, mute connections */ |
| 12989 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12990 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12991 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12992 | |
| 12993 | { } |
| 12994 | }; |
| 12995 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12996 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12997 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12998 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12999 | { } /* end */ |
| 13000 | }; |
| 13001 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13002 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13003 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13004 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13005 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13006 | { } /* end */ |
| 13007 | }; |
| 13008 | |
| 13009 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13010 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13011 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13012 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13013 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13014 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13015 | { } /* end */ |
| 13016 | }; |
| 13017 | |
| 13018 | static struct hda_input_mux alc268_capture_source = { |
| 13019 | .num_items = 4, |
| 13020 | .items = { |
| 13021 | { "Mic", 0x0 }, |
| 13022 | { "Front Mic", 0x1 }, |
| 13023 | { "Line", 0x2 }, |
| 13024 | { "CD", 0x3 }, |
| 13025 | }, |
| 13026 | }; |
| 13027 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13028 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13029 | .num_items = 3, |
| 13030 | .items = { |
| 13031 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13032 | { "Internal Mic", 0x1 }, |
| 13033 | { "Line", 0x2 }, |
| 13034 | }, |
| 13035 | }; |
| 13036 | |
| 13037 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13038 | .num_items = 3, |
| 13039 | .items = { |
| 13040 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13041 | { "Internal Mic", 0x6 }, |
| 13042 | { "Line", 0x2 }, |
| 13043 | }, |
| 13044 | }; |
| 13045 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13046 | #ifdef CONFIG_SND_DEBUG |
| 13047 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13048 | /* Volume widgets */ |
| 13049 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13050 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13051 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13052 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13053 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13054 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13055 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13056 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13057 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13058 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13059 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13060 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13061 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13062 | /* The below appears problematic on some hardwares */ |
| 13063 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13064 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13065 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13066 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13067 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13068 | |
| 13069 | /* Modes for retasking pin widgets */ |
| 13070 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13071 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13072 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13073 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13074 | |
| 13075 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13076 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13077 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13078 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13079 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13080 | |
| 13081 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13082 | * The ALC268 does not have an SPDIF input. |
| 13083 | */ |
| 13084 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13085 | |
| 13086 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13087 | * this output to turn on an external amplifier. |
| 13088 | */ |
| 13089 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13090 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13091 | |
| 13092 | { } /* end */ |
| 13093 | }; |
| 13094 | #endif |
| 13095 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13096 | /* create input playback/capture controls for the given pin */ |
| 13097 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13098 | const char *ctlname, int idx) |
| 13099 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13100 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13101 | int err; |
| 13102 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13103 | switch (nid) { |
| 13104 | case 0x14: |
| 13105 | case 0x16: |
| 13106 | dac = 0x02; |
| 13107 | break; |
| 13108 | case 0x15: |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13109 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13110 | dac = 0x03; |
| 13111 | break; |
| 13112 | default: |
| 13113 | return 0; |
| 13114 | } |
| 13115 | if (spec->multiout.dac_nids[0] != dac && |
| 13116 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13117 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13118 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13119 | HDA_OUTPUT)); |
| 13120 | if (err < 0) |
| 13121 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13122 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13123 | } |
| 13124 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13125 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13126 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13127 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13128 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13129 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13130 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13131 | if (err < 0) |
| 13132 | return err; |
| 13133 | return 0; |
| 13134 | } |
| 13135 | |
| 13136 | /* add playback controls from the parsed DAC table */ |
| 13137 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13138 | const struct auto_pin_cfg *cfg) |
| 13139 | { |
| 13140 | hda_nid_t nid; |
| 13141 | int err; |
| 13142 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13143 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13144 | |
| 13145 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13146 | if (nid) { |
| 13147 | const char *name; |
| 13148 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13149 | name = "Speaker"; |
| 13150 | else |
| 13151 | name = "Front"; |
| 13152 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13153 | if (err < 0) |
| 13154 | return err; |
| 13155 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13156 | |
| 13157 | nid = cfg->speaker_pins[0]; |
| 13158 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13159 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13160 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13161 | if (err < 0) |
| 13162 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13163 | } else { |
| 13164 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13165 | if (err < 0) |
| 13166 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13167 | } |
| 13168 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13169 | if (nid) { |
| 13170 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13171 | if (err < 0) |
| 13172 | return err; |
| 13173 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13174 | |
| 13175 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13176 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13177 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13178 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13179 | if (err < 0) |
| 13180 | return err; |
| 13181 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13182 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13183 | } |
| 13184 | |
| 13185 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13186 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13187 | const struct auto_pin_cfg *cfg) |
| 13188 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13189 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13190 | } |
| 13191 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13192 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13193 | hda_nid_t nid, int pin_type) |
| 13194 | { |
| 13195 | int idx; |
| 13196 | |
| 13197 | alc_set_pin_output(codec, nid, pin_type); |
| 13198 | if (nid == 0x14 || nid == 0x16) |
| 13199 | idx = 0; |
| 13200 | else |
| 13201 | idx = 1; |
| 13202 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13203 | } |
| 13204 | |
| 13205 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13206 | { |
| 13207 | struct alc_spec *spec = codec->spec; |
| 13208 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13209 | if (nid) { |
| 13210 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13211 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13212 | } |
| 13213 | } |
| 13214 | |
| 13215 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13216 | { |
| 13217 | struct alc_spec *spec = codec->spec; |
| 13218 | hda_nid_t pin; |
| 13219 | |
| 13220 | pin = spec->autocfg.hp_pins[0]; |
| 13221 | if (pin) |
| 13222 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13223 | pin = spec->autocfg.speaker_pins[0]; |
| 13224 | if (pin) |
| 13225 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13226 | } |
| 13227 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13228 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13229 | { |
| 13230 | struct alc_spec *spec = codec->spec; |
| 13231 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13232 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13233 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13234 | unsigned int dac_vol1, dac_vol2; |
| 13235 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13236 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13237 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13238 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13239 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13240 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13241 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13242 | AMP_IN_UNMUTE(1)); |
| 13243 | snd_hda_codec_write(codec, 0x10, 0, |
| 13244 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13245 | AMP_IN_UNMUTE(1)); |
| 13246 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13247 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13248 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13249 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13250 | snd_hda_codec_write(codec, 0x10, 0, |
| 13251 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13252 | } |
| 13253 | |
| 13254 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13255 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13256 | dac_vol2 = AMP_OUT_ZERO; |
| 13257 | else if (line_nid == 0x15) |
| 13258 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13259 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13260 | dac_vol2 = AMP_OUT_ZERO; |
| 13261 | else if (hp_nid == 0x15) |
| 13262 | dac_vol1 = AMP_OUT_ZERO; |
| 13263 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13264 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13265 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13266 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13267 | |
| 13268 | snd_hda_codec_write(codec, 0x02, 0, |
| 13269 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13270 | snd_hda_codec_write(codec, 0x03, 0, |
| 13271 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13272 | } |
| 13273 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13274 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13275 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13276 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13277 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13278 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13279 | |
| 13280 | /* |
| 13281 | * BIOS auto configuration |
| 13282 | */ |
| 13283 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13284 | { |
| 13285 | struct alc_spec *spec = codec->spec; |
| 13286 | int err; |
| 13287 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13288 | |
| 13289 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13290 | alc268_ignore); |
| 13291 | if (err < 0) |
| 13292 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13293 | if (!spec->autocfg.line_outs) { |
| 13294 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13295 | spec->multiout.max_channels = 2; |
| 13296 | spec->no_analog = 1; |
| 13297 | goto dig_only; |
| 13298 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13299 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13300 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13301 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13302 | if (err < 0) |
| 13303 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13304 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13305 | if (err < 0) |
| 13306 | return err; |
| 13307 | |
| 13308 | spec->multiout.max_channels = 2; |
| 13309 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13310 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13311 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13312 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13313 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13314 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13315 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13316 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13317 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13318 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13319 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13320 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13321 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13322 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13323 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13324 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13325 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13326 | err = alc_auto_add_mic_boost(codec); |
| 13327 | if (err < 0) |
| 13328 | return err; |
| 13329 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13330 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13331 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13332 | return 1; |
| 13333 | } |
| 13334 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13335 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13336 | |
| 13337 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13338 | static void alc268_auto_init(struct hda_codec *codec) |
| 13339 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13340 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13341 | alc268_auto_init_multi_out(codec); |
| 13342 | alc268_auto_init_hp_out(codec); |
| 13343 | alc268_auto_init_mono_speaker_out(codec); |
| 13344 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13345 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13346 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13347 | } |
| 13348 | |
| 13349 | /* |
| 13350 | * configuration and preset |
| 13351 | */ |
| 13352 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13353 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13354 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13355 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13356 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13357 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13358 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13359 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13360 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13361 | #ifdef CONFIG_SND_DEBUG |
| 13362 | [ALC268_TEST] = "test", |
| 13363 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13364 | [ALC268_AUTO] = "auto", |
| 13365 | }; |
| 13366 | |
| 13367 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13368 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13369 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13370 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13371 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13372 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13373 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13374 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13375 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13376 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13377 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13378 | /* almost compatible with toshiba but with optional digital outs; |
| 13379 | * auto-probing seems working fine |
| 13380 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13381 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13382 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13383 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13384 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13385 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13386 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13387 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13388 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13389 | {} |
| 13390 | }; |
| 13391 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13392 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13393 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13394 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13395 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13396 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13397 | ALC268_TOSHIBA), |
| 13398 | {} |
| 13399 | }; |
| 13400 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13402 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13403 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13404 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13405 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13406 | alc267_quanta_il1_verbs }, |
| 13407 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13408 | .dac_nids = alc268_dac_nids, |
| 13409 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13410 | .adc_nids = alc268_adc_nids_alt, |
| 13411 | .hp_nid = 0x03, |
| 13412 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13413 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13414 | .unsol_event = alc_sku_unsol_event, |
| 13415 | .setup = alc267_quanta_il1_setup, |
| 13416 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13417 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13418 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13419 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13420 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13421 | .init_verbs = { alc268_base_init_verbs }, |
| 13422 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13423 | .dac_nids = alc268_dac_nids, |
| 13424 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13425 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13426 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13427 | .hp_nid = 0x03, |
| 13428 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13429 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13430 | .channel_mode = alc268_modes, |
| 13431 | .input_mux = &alc268_capture_source, |
| 13432 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13433 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13434 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13435 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13436 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13437 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13438 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13439 | .dac_nids = alc268_dac_nids, |
| 13440 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13441 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13442 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13443 | .hp_nid = 0x03, |
| 13444 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13445 | .channel_mode = alc268_modes, |
| 13446 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13447 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13448 | .setup = alc268_toshiba_setup, |
| 13449 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13450 | }, |
| 13451 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13452 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13453 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13454 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13455 | alc268_acer_verbs }, |
| 13456 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13457 | .dac_nids = alc268_dac_nids, |
| 13458 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13459 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13460 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13461 | .hp_nid = 0x02, |
| 13462 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13463 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13464 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13465 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13466 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13467 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13468 | [ALC268_ACER_DMIC] = { |
| 13469 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13470 | alc268_beep_mixer }, |
| 13471 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13472 | alc268_acer_verbs }, |
| 13473 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13474 | .dac_nids = alc268_dac_nids, |
| 13475 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13476 | .adc_nids = alc268_adc_nids_alt, |
| 13477 | .capsrc_nids = alc268_capsrc_nids, |
| 13478 | .hp_nid = 0x02, |
| 13479 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13480 | .channel_mode = alc268_modes, |
| 13481 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13482 | .unsol_event = alc268_acer_unsol_event, |
| 13483 | .init_hook = alc268_acer_init_hook, |
| 13484 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13485 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13486 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13487 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13488 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13489 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13490 | alc268_acer_aspire_one_verbs }, |
| 13491 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13492 | .dac_nids = alc268_dac_nids, |
| 13493 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13494 | .adc_nids = alc268_adc_nids_alt, |
| 13495 | .capsrc_nids = alc268_capsrc_nids, |
| 13496 | .hp_nid = 0x03, |
| 13497 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13498 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13499 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13500 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13501 | .init_hook = alc268_acer_lc_init_hook, |
| 13502 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13503 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13504 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13505 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13506 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13507 | alc268_dell_verbs }, |
| 13508 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13509 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13510 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13511 | .adc_nids = alc268_adc_nids_alt, |
| 13512 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13513 | .hp_nid = 0x02, |
| 13514 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13515 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13516 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13517 | .setup = alc268_dell_setup, |
| 13518 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13519 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13520 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13521 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13522 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13523 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13524 | alc268_toshiba_verbs }, |
| 13525 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13526 | .dac_nids = alc268_dac_nids, |
| 13527 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13528 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13529 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13530 | .hp_nid = 0x03, |
| 13531 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13532 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13533 | .channel_mode = alc268_modes, |
| 13534 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13535 | .setup = alc268_toshiba_setup, |
| 13536 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13537 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13538 | #ifdef CONFIG_SND_DEBUG |
| 13539 | [ALC268_TEST] = { |
| 13540 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13541 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13542 | alc268_volume_init_verbs }, |
| 13543 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13544 | .dac_nids = alc268_dac_nids, |
| 13545 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13546 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13547 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13548 | .hp_nid = 0x03, |
| 13549 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13550 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13551 | .channel_mode = alc268_modes, |
| 13552 | .input_mux = &alc268_capture_source, |
| 13553 | }, |
| 13554 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13555 | }; |
| 13556 | |
| 13557 | static int patch_alc268(struct hda_codec *codec) |
| 13558 | { |
| 13559 | struct alc_spec *spec; |
| 13560 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13561 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13562 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13563 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13564 | if (spec == NULL) |
| 13565 | return -ENOMEM; |
| 13566 | |
| 13567 | codec->spec = spec; |
| 13568 | |
| 13569 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13570 | alc268_models, |
| 13571 | alc268_cfg_tbl); |
| 13572 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13573 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13574 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13575 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13576 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13577 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13578 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13579 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | board_config = ALC268_AUTO; |
| 13581 | } |
| 13582 | |
| 13583 | if (board_config == ALC268_AUTO) { |
| 13584 | /* automatic parse from the BIOS config */ |
| 13585 | err = alc268_parse_auto_config(codec); |
| 13586 | if (err < 0) { |
| 13587 | alc_free(codec); |
| 13588 | return err; |
| 13589 | } else if (!err) { |
| 13590 | printk(KERN_INFO |
| 13591 | "hda_codec: Cannot set up configuration " |
| 13592 | "from BIOS. Using base mode...\n"); |
| 13593 | board_config = ALC268_3ST; |
| 13594 | } |
| 13595 | } |
| 13596 | |
| 13597 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13598 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13599 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13600 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13601 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13602 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13603 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13604 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13605 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13606 | has_beep = 0; |
| 13607 | for (i = 0; i < spec->num_mixers; i++) { |
| 13608 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13609 | has_beep = 1; |
| 13610 | break; |
| 13611 | } |
| 13612 | } |
| 13613 | |
| 13614 | if (has_beep) { |
| 13615 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13616 | if (err < 0) { |
| 13617 | alc_free(codec); |
| 13618 | return err; |
| 13619 | } |
| 13620 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13621 | /* override the amp caps for beep generator */ |
| 13622 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13623 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13624 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13625 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13626 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13627 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13628 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13629 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13630 | /* check whether NID 0x07 is valid */ |
| 13631 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13632 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13633 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13634 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13635 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13636 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13637 | if (spec->auto_mic || |
| 13638 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13639 | spec->adc_nids = alc268_adc_nids_alt; |
| 13640 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13641 | if (spec->auto_mic) |
| 13642 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13643 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13644 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13645 | else |
| 13646 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13647 | } else { |
| 13648 | spec->adc_nids = alc268_adc_nids; |
| 13649 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13650 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13651 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13652 | /* set default input source */ |
| 13653 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13654 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13655 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13656 | i < spec->num_mux_defs ? |
| 13657 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13658 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13659 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13660 | |
| 13661 | spec->vmaster_nid = 0x02; |
| 13662 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13663 | codec->patch_ops = alc_patch_ops; |
| 13664 | if (board_config == ALC268_AUTO) |
| 13665 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13666 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13667 | return 0; |
| 13668 | } |
| 13669 | |
| 13670 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13671 | * ALC269 channel source setting (2 channel) |
| 13672 | */ |
| 13673 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13674 | |
| 13675 | #define alc269_dac_nids alc260_dac_nids |
| 13676 | |
| 13677 | static hda_nid_t alc269_adc_nids[1] = { |
| 13678 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13679 | 0x08, |
| 13680 | }; |
| 13681 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13682 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13683 | 0x23, |
| 13684 | }; |
| 13685 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13686 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13687 | /* ADC1 */ |
| 13688 | 0x09, |
| 13689 | }; |
| 13690 | |
| 13691 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13692 | 0x22, |
| 13693 | }; |
| 13694 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13695 | static hda_nid_t alc269_adc_candidates[] = { |
| 13696 | 0x08, 0x09, 0x07, |
| 13697 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13698 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13699 | #define alc269_modes alc260_modes |
| 13700 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13701 | |
| 13702 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13703 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13704 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13709 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13710 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13711 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13712 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13713 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13714 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13715 | { } /* end */ |
| 13716 | }; |
| 13717 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13718 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13719 | /* output mixer control */ |
| 13720 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13721 | { |
| 13722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13723 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13724 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13725 | .info = snd_hda_mixer_amp_switch_info, |
| 13726 | .get = snd_hda_mixer_amp_switch_get, |
| 13727 | .put = alc268_acer_master_sw_put, |
| 13728 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13729 | }, |
| 13730 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13731 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13733 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13734 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13735 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13736 | { } |
| 13737 | }; |
| 13738 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13739 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13740 | /* output mixer control */ |
| 13741 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13742 | { |
| 13743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13744 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13745 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13746 | .info = snd_hda_mixer_amp_switch_info, |
| 13747 | .get = snd_hda_mixer_amp_switch_get, |
| 13748 | .put = alc268_acer_master_sw_put, |
| 13749 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13750 | }, |
| 13751 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13752 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13753 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13754 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13755 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13756 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13757 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13758 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13759 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13760 | { } |
| 13761 | }; |
| 13762 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13763 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13764 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13765 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13767 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13768 | { } /* end */ |
| 13769 | }; |
| 13770 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13771 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13772 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13773 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13775 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13776 | { } /* end */ |
| 13777 | }; |
| 13778 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13779 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13780 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13781 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13782 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13783 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13784 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13785 | { } /* end */ |
| 13786 | }; |
| 13787 | |
| 13788 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13789 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13790 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13791 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13792 | { } /* end */ |
| 13793 | }; |
| 13794 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13795 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13796 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13797 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13799 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13800 | { } /* end */ |
| 13801 | }; |
| 13802 | |
| 13803 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13804 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13805 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13806 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13807 | { } /* end */ |
| 13808 | }; |
| 13809 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13810 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13811 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13812 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13813 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13814 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13815 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13817 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13818 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13819 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13820 | { } |
| 13821 | }; |
| 13822 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13823 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13824 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13825 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13826 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13828 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13829 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13831 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13832 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13833 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13834 | { } |
| 13835 | }; |
| 13836 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13837 | /* toggle speaker-output according to the hp-jack state */ |
| 13838 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13839 | { |
| 13840 | unsigned int present; |
| 13841 | unsigned char bits; |
| 13842 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13843 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13844 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13845 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13846 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13847 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13848 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13849 | |
| 13850 | snd_hda_codec_write(codec, 0x20, 0, |
| 13851 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13852 | snd_hda_codec_write(codec, 0x20, 0, |
| 13853 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13854 | |
| 13855 | snd_hda_codec_write(codec, 0x20, 0, |
| 13856 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13857 | snd_hda_codec_write(codec, 0x20, 0, |
| 13858 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13859 | } |
| 13860 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13861 | /* toggle speaker-output according to the hp-jacks state */ |
| 13862 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13863 | { |
| 13864 | unsigned int present; |
| 13865 | unsigned char bits; |
| 13866 | |
| 13867 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13868 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13869 | |
| 13870 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13871 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13872 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13873 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13874 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13875 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13876 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13877 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13878 | |
| 13879 | snd_hda_codec_write(codec, 0x20, 0, |
| 13880 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13881 | snd_hda_codec_write(codec, 0x20, 0, |
| 13882 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13883 | |
| 13884 | snd_hda_codec_write(codec, 0x20, 0, |
| 13885 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13886 | snd_hda_codec_write(codec, 0x20, 0, |
| 13887 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13888 | } |
| 13889 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13890 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13891 | { |
| 13892 | unsigned int present_laptop; |
| 13893 | unsigned int present_dock; |
| 13894 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13895 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13896 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13897 | |
| 13898 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13899 | if (present_dock) |
| 13900 | snd_hda_codec_write(codec, 0x23, 0, |
| 13901 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13902 | if (present_laptop) |
| 13903 | snd_hda_codec_write(codec, 0x23, 0, |
| 13904 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13905 | if (!present_dock && !present_laptop) |
| 13906 | snd_hda_codec_write(codec, 0x23, 0, |
| 13907 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13908 | } |
| 13909 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13910 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13911 | unsigned int res) |
| 13912 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13913 | switch (res >> 26) { |
| 13914 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13915 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13916 | break; |
| 13917 | case ALC880_MIC_EVENT: |
| 13918 | alc_mic_automute(codec); |
| 13919 | break; |
| 13920 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13921 | } |
| 13922 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13923 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13924 | unsigned int res) |
| 13925 | { |
| 13926 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13927 | alc269_lifebook_speaker_automute(codec); |
| 13928 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13929 | alc269_lifebook_mic_autoswitch(codec); |
| 13930 | } |
| 13931 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13932 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13933 | { |
| 13934 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13935 | spec->autocfg.hp_pins[0] = 0x15; |
| 13936 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13937 | spec->ext_mic.pin = 0x18; |
| 13938 | spec->ext_mic.mux_idx = 0; |
| 13939 | spec->int_mic.pin = 0x19; |
| 13940 | spec->int_mic.mux_idx = 1; |
| 13941 | spec->auto_mic = 1; |
| 13942 | } |
| 13943 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13944 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13945 | { |
| 13946 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13947 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13948 | } |
| 13949 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13950 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13951 | { |
| 13952 | alc269_lifebook_speaker_automute(codec); |
| 13953 | alc269_lifebook_mic_autoswitch(codec); |
| 13954 | } |
| 13955 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13956 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13957 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13958 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13959 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13960 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13961 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13962 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13963 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13964 | {} |
| 13965 | }; |
| 13966 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13967 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13968 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13969 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13970 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13972 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13973 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13974 | {} |
| 13975 | }; |
| 13976 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13977 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13978 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13979 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13980 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13981 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13982 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13983 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13984 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13985 | {} |
| 13986 | }; |
| 13987 | |
| 13988 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13989 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13990 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13991 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13992 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13993 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13994 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13995 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13996 | {} |
| 13997 | }; |
| 13998 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13999 | /* toggle speaker-output according to the hp-jack state */ |
| 14000 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14001 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14002 | struct alc_spec *spec = codec->spec; |
| 14003 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14004 | unsigned int present; |
| 14005 | unsigned char bits; |
| 14006 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14007 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14008 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14009 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14010 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14011 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14012 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14013 | } |
| 14014 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14015 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14016 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14017 | unsigned int res) |
| 14018 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14019 | switch (res >> 26) { |
| 14020 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14021 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14022 | break; |
| 14023 | case ALC880_MIC_EVENT: |
| 14024 | alc_mic_automute(codec); |
| 14025 | break; |
| 14026 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14027 | } |
| 14028 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14029 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14030 | { |
| 14031 | struct alc_spec *spec = codec->spec; |
| 14032 | spec->autocfg.hp_pins[0] = 0x15; |
| 14033 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14034 | spec->ext_mic.pin = 0x18; |
| 14035 | spec->ext_mic.mux_idx = 0; |
| 14036 | spec->int_mic.pin = 0x19; |
| 14037 | spec->int_mic.mux_idx = 1; |
| 14038 | spec->auto_mic = 1; |
| 14039 | } |
| 14040 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14041 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14042 | { |
| 14043 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14044 | spec->autocfg.hp_pins[0] = 0x15; |
| 14045 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14046 | spec->ext_mic.pin = 0x18; |
| 14047 | spec->ext_mic.mux_idx = 0; |
| 14048 | spec->int_mic.pin = 0x12; |
| 14049 | spec->int_mic.mux_idx = 5; |
| 14050 | spec->auto_mic = 1; |
| 14051 | } |
| 14052 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14053 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14054 | { |
| 14055 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14056 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14057 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14058 | spec->ext_mic.pin = 0x18; |
| 14059 | spec->ext_mic.mux_idx = 0; |
| 14060 | spec->int_mic.pin = 0x19; |
| 14061 | spec->int_mic.mux_idx = 1; |
| 14062 | spec->auto_mic = 1; |
| 14063 | } |
| 14064 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14065 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14066 | { |
| 14067 | struct alc_spec *spec = codec->spec; |
| 14068 | spec->autocfg.hp_pins[0] = 0x21; |
| 14069 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14070 | spec->ext_mic.pin = 0x18; |
| 14071 | spec->ext_mic.mux_idx = 0; |
| 14072 | spec->int_mic.pin = 0x12; |
| 14073 | spec->int_mic.mux_idx = 6; |
| 14074 | spec->auto_mic = 1; |
| 14075 | } |
| 14076 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14077 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14078 | { |
| 14079 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14080 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14081 | } |
| 14082 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14083 | /* |
| 14084 | * generic initialization of ADC, input mixers and output mixers |
| 14085 | */ |
| 14086 | static struct hda_verb alc269_init_verbs[] = { |
| 14087 | /* |
| 14088 | * Unmute ADC0 and set the default input to mic-in |
| 14089 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14091 | |
| 14092 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14093 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14094 | */ |
| 14095 | /* set vol=0 to output mixers */ |
| 14096 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14098 | |
| 14099 | /* set up input amps for analog loopback */ |
| 14100 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14107 | |
| 14108 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14110 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14111 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14112 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14113 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14115 | |
| 14116 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14118 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14119 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14120 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14121 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14122 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14123 | |
| 14124 | /* set EAPD */ |
| 14125 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14126 | { } |
| 14127 | }; |
| 14128 | |
| 14129 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14130 | /* |
| 14131 | * Unmute ADC0 and set the default input to mic-in |
| 14132 | */ |
| 14133 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14134 | |
| 14135 | /* |
| 14136 | * Set up output mixers (0x02 - 0x03) |
| 14137 | */ |
| 14138 | /* set vol=0 to output mixers */ |
| 14139 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14140 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14141 | |
| 14142 | /* set up input amps for analog loopback */ |
| 14143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14147 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14148 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14149 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14150 | |
| 14151 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14152 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14153 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14155 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14156 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14158 | |
| 14159 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14160 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14161 | |
| 14162 | /* FIXME: use Mux-type input source selection */ |
| 14163 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14164 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14165 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14166 | |
| 14167 | /* set EAPD */ |
| 14168 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14169 | { } |
| 14170 | }; |
| 14171 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14172 | #define alc269_auto_create_multi_out_ctls \ |
| 14173 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14174 | #define alc269_auto_create_input_ctls \ |
| 14175 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14176 | |
| 14177 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14178 | #define alc269_loopbacks alc880_loopbacks |
| 14179 | #endif |
| 14180 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14181 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14182 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14183 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14184 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14185 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14186 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14187 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14188 | .substreams = 1, |
| 14189 | .channels_min = 2, |
| 14190 | .channels_max = 8, |
| 14191 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14192 | /* NID is set in alc_build_pcms */ |
| 14193 | .ops = { |
| 14194 | .open = alc880_playback_pcm_open, |
| 14195 | .prepare = alc880_playback_pcm_prepare, |
| 14196 | .cleanup = alc880_playback_pcm_cleanup |
| 14197 | }, |
| 14198 | }; |
| 14199 | |
| 14200 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14201 | .substreams = 1, |
| 14202 | .channels_min = 2, |
| 14203 | .channels_max = 2, |
| 14204 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14205 | /* NID is set in alc_build_pcms */ |
| 14206 | }; |
| 14207 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14208 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14209 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14210 | { |
| 14211 | switch (codec->subsystem_id) { |
| 14212 | case 0x103c1586: |
| 14213 | return 1; |
| 14214 | } |
| 14215 | return 0; |
| 14216 | } |
| 14217 | |
| 14218 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14219 | { |
| 14220 | /* update mute-LED according to the speaker mute state */ |
| 14221 | if (nid == 0x01 || nid == 0x14) { |
| 14222 | int pinval; |
| 14223 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14224 | HDA_AMP_MUTE) |
| 14225 | pinval = 0x24; |
| 14226 | else |
| 14227 | pinval = 0x20; |
| 14228 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14229 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14230 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14231 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14232 | } |
| 14233 | return alc_check_power_status(codec, nid); |
| 14234 | } |
| 14235 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14236 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 14237 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14238 | { |
| 14239 | struct alc_spec *spec = codec->spec; |
| 14240 | |
| 14241 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14242 | return 0; |
| 14243 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14244 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14245 | if (spec->ext_mic.pin <= 0x12) { |
| 14246 | spec->private_adc_nids[0] = 0x08; |
| 14247 | spec->private_adc_nids[1] = 0x11; |
| 14248 | spec->private_capsrc_nids[0] = 0x23; |
| 14249 | spec->private_capsrc_nids[1] = 0x22; |
| 14250 | } else { |
| 14251 | spec->private_adc_nids[0] = 0x11; |
| 14252 | spec->private_adc_nids[1] = 0x08; |
| 14253 | spec->private_capsrc_nids[0] = 0x22; |
| 14254 | spec->private_capsrc_nids[1] = 0x23; |
| 14255 | } |
| 14256 | spec->adc_nids = spec->private_adc_nids; |
| 14257 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14258 | spec->num_adc_nids = 2; |
| 14259 | spec->dual_adc_switch = 1; |
| 14260 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14261 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14262 | return 1; |
| 14263 | } |
| 14264 | return 0; |
| 14265 | } |
| 14266 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14267 | /* |
| 14268 | * BIOS auto configuration |
| 14269 | */ |
| 14270 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14271 | { |
| 14272 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14273 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14274 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14275 | |
| 14276 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14277 | alc269_ignore); |
| 14278 | if (err < 0) |
| 14279 | return err; |
| 14280 | |
| 14281 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14282 | if (err < 0) |
| 14283 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14284 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14285 | if (err < 0) |
| 14286 | return err; |
| 14287 | |
| 14288 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14289 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14290 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14291 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14292 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14293 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14294 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14295 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14296 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14297 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14298 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14299 | } else { |
| 14300 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14301 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14302 | } |
| 14303 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14304 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14305 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 14306 | |
| 14307 | if (!alc275_setup_dual_adc(codec)) |
| 14308 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14309 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14310 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14311 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 14312 | if (!spec->dual_adc_switch) |
| 14313 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14314 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14315 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14316 | |
| 14317 | err = alc_auto_add_mic_boost(codec); |
| 14318 | if (err < 0) |
| 14319 | return err; |
| 14320 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14321 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14322 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14323 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14324 | return 1; |
| 14325 | } |
| 14326 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14327 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14328 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14329 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14330 | |
| 14331 | |
| 14332 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14333 | static void alc269_auto_init(struct hda_codec *codec) |
| 14334 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14335 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14336 | alc269_auto_init_multi_out(codec); |
| 14337 | alc269_auto_init_hp_out(codec); |
| 14338 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14339 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14340 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14341 | } |
| 14342 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14343 | enum { |
| 14344 | ALC269_FIXUP_SONY_VAIO, |
| 14345 | }; |
| 14346 | |
Tobias Klauser | fbc2566 | 2010-05-20 10:40:55 +0200 | [diff] [blame] | 14347 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14348 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14349 | {} |
| 14350 | }; |
| 14351 | |
| 14352 | static const struct alc_fixup alc269_fixups[] = { |
| 14353 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14354 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14355 | }, |
| 14356 | }; |
| 14357 | |
| 14358 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14359 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14360 | {} |
| 14361 | }; |
| 14362 | |
| 14363 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14364 | /* |
| 14365 | * configuration and preset |
| 14366 | */ |
| 14367 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14368 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14369 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14370 | [ALC269_AMIC] = "laptop-amic", |
| 14371 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14372 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14373 | [ALC269_LIFEBOOK] = "lifebook", |
| 14374 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14375 | }; |
| 14376 | |
| 14377 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14378 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14379 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14380 | ALC269_AMIC), |
| 14381 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14382 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14383 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14384 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14385 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14386 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14387 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14388 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14389 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14390 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14391 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14392 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14393 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14394 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14395 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14396 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14397 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14398 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14399 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14400 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14401 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14402 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14403 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14404 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14405 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14406 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14407 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14408 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14409 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14410 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14411 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14412 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14413 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14414 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14415 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14416 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14417 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14418 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14419 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14420 | ALC269_DMIC), |
| 14421 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14422 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14423 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14424 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14425 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14426 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14427 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14428 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14429 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14430 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14431 | {} |
| 14432 | }; |
| 14433 | |
| 14434 | static struct alc_config_preset alc269_presets[] = { |
| 14435 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14436 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14437 | .init_verbs = { alc269_init_verbs }, |
| 14438 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14439 | .dac_nids = alc269_dac_nids, |
| 14440 | .hp_nid = 0x03, |
| 14441 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14442 | .channel_mode = alc269_modes, |
| 14443 | .input_mux = &alc269_capture_source, |
| 14444 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14445 | [ALC269_QUANTA_FL1] = { |
| 14446 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14447 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14448 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14449 | .dac_nids = alc269_dac_nids, |
| 14450 | .hp_nid = 0x03, |
| 14451 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14452 | .channel_mode = alc269_modes, |
| 14453 | .input_mux = &alc269_capture_source, |
| 14454 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14455 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14456 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14457 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14458 | [ALC269_AMIC] = { |
| 14459 | .mixers = { alc269_laptop_mixer }, |
| 14460 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14461 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14462 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14463 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14464 | .dac_nids = alc269_dac_nids, |
| 14465 | .hp_nid = 0x03, |
| 14466 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14467 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14468 | .unsol_event = alc269_laptop_unsol_event, |
| 14469 | .setup = alc269_laptop_amic_setup, |
| 14470 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14471 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14472 | [ALC269_DMIC] = { |
| 14473 | .mixers = { alc269_laptop_mixer }, |
| 14474 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14475 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14476 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14477 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14478 | .dac_nids = alc269_dac_nids, |
| 14479 | .hp_nid = 0x03, |
| 14480 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14481 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14482 | .unsol_event = alc269_laptop_unsol_event, |
| 14483 | .setup = alc269_laptop_dmic_setup, |
| 14484 | .init_hook = alc269_laptop_inithook, |
| 14485 | }, |
| 14486 | [ALC269VB_AMIC] = { |
| 14487 | .mixers = { alc269vb_laptop_mixer }, |
| 14488 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14489 | .init_verbs = { alc269vb_init_verbs, |
| 14490 | alc269vb_laptop_amic_init_verbs }, |
| 14491 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14492 | .dac_nids = alc269_dac_nids, |
| 14493 | .hp_nid = 0x03, |
| 14494 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14495 | .channel_mode = alc269_modes, |
| 14496 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14497 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14498 | .init_hook = alc269_laptop_inithook, |
| 14499 | }, |
| 14500 | [ALC269VB_DMIC] = { |
| 14501 | .mixers = { alc269vb_laptop_mixer }, |
| 14502 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14503 | .init_verbs = { alc269vb_init_verbs, |
| 14504 | alc269vb_laptop_dmic_init_verbs }, |
| 14505 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14506 | .dac_nids = alc269_dac_nids, |
| 14507 | .hp_nid = 0x03, |
| 14508 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14509 | .channel_mode = alc269_modes, |
| 14510 | .unsol_event = alc269_laptop_unsol_event, |
| 14511 | .setup = alc269vb_laptop_dmic_setup, |
| 14512 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14513 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14514 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14515 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14516 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14517 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14518 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14519 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14520 | .dac_nids = alc269_dac_nids, |
| 14521 | .hp_nid = 0x03, |
| 14522 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14523 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14524 | .unsol_event = alc269_laptop_unsol_event, |
| 14525 | .setup = alc269_laptop_dmic_setup, |
| 14526 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14527 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14528 | [ALC269_LIFEBOOK] = { |
| 14529 | .mixers = { alc269_lifebook_mixer }, |
| 14530 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14531 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14532 | .dac_nids = alc269_dac_nids, |
| 14533 | .hp_nid = 0x03, |
| 14534 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14535 | .channel_mode = alc269_modes, |
| 14536 | .input_mux = &alc269_capture_source, |
| 14537 | .unsol_event = alc269_lifebook_unsol_event, |
| 14538 | .init_hook = alc269_lifebook_init_hook, |
| 14539 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14540 | }; |
| 14541 | |
| 14542 | static int patch_alc269(struct hda_codec *codec) |
| 14543 | { |
| 14544 | struct alc_spec *spec; |
| 14545 | int board_config; |
| 14546 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14547 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14548 | |
| 14549 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14550 | if (spec == NULL) |
| 14551 | return -ENOMEM; |
| 14552 | |
| 14553 | codec->spec = spec; |
| 14554 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14555 | alc_auto_parse_customize_define(codec); |
| 14556 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14557 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14558 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14559 | spec->cdefine.platform_type == 1) |
| 14560 | alc_codec_rename(codec, "ALC271X"); |
| 14561 | else |
| 14562 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14563 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14564 | } else |
| 14565 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14566 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14567 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14568 | alc269_models, |
| 14569 | alc269_cfg_tbl); |
| 14570 | |
| 14571 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14572 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14573 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14574 | board_config = ALC269_AUTO; |
| 14575 | } |
| 14576 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14577 | if (board_config == ALC269_AUTO) |
| 14578 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14579 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14580 | if (board_config == ALC269_AUTO) { |
| 14581 | /* automatic parse from the BIOS config */ |
| 14582 | err = alc269_parse_auto_config(codec); |
| 14583 | if (err < 0) { |
| 14584 | alc_free(codec); |
| 14585 | return err; |
| 14586 | } else if (!err) { |
| 14587 | printk(KERN_INFO |
| 14588 | "hda_codec: Cannot set up configuration " |
| 14589 | "from BIOS. Using base mode...\n"); |
| 14590 | board_config = ALC269_BASIC; |
| 14591 | } |
| 14592 | } |
| 14593 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14594 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14595 | if (err < 0) { |
| 14596 | alc_free(codec); |
| 14597 | return err; |
| 14598 | } |
| 14599 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14600 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14601 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14602 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14603 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14604 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14605 | * fix the sample rate of analog I/O to 44.1kHz |
| 14606 | */ |
| 14607 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14608 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame^] | 14609 | } else if (spec->dual_adc_switch) { |
| 14610 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14611 | /* switch ADC dynamically */ |
| 14612 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14613 | } else { |
| 14614 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14615 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14616 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14617 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14618 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14619 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14620 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14621 | if (!is_alc269vb) { |
| 14622 | spec->adc_nids = alc269_adc_nids; |
| 14623 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14624 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14625 | } else { |
| 14626 | spec->adc_nids = alc269vb_adc_nids; |
| 14627 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14628 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14629 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14630 | } |
| 14631 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14632 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14633 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14634 | if (spec->cdefine.enable_pcbeep) |
| 14635 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14636 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14637 | if (board_config == ALC269_AUTO) |
| 14638 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14639 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14640 | spec->vmaster_nid = 0x02; |
| 14641 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14642 | codec->patch_ops = alc_patch_ops; |
| 14643 | if (board_config == ALC269_AUTO) |
| 14644 | spec->init_hook = alc269_auto_init; |
| 14645 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14646 | if (!spec->loopback.amplist) |
| 14647 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14648 | if (alc269_mic2_for_mute_led(codec)) |
| 14649 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14650 | #endif |
| 14651 | |
| 14652 | return 0; |
| 14653 | } |
| 14654 | |
| 14655 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14656 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14657 | */ |
| 14658 | |
| 14659 | /* |
| 14660 | * set the path ways for 2 channel output |
| 14661 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14662 | */ |
| 14663 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14664 | /* set pin widget 1Ah (line in) for input */ |
| 14665 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14666 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14667 | * the vref |
| 14668 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14669 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14670 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14671 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14672 | #if 0 |
| 14673 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14674 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14675 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14676 | { } /* end */ |
| 14677 | }; |
| 14678 | /* |
| 14679 | * 6ch mode |
| 14680 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14681 | */ |
| 14682 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14683 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14684 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14685 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14686 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14687 | |
| 14688 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14689 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14690 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14691 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14692 | #if 0 |
| 14693 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14694 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14695 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14696 | { } /* end */ |
| 14697 | }; |
| 14698 | |
| 14699 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14700 | { 2, alc861_threestack_ch2_init }, |
| 14701 | { 6, alc861_threestack_ch6_init }, |
| 14702 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14703 | /* Set mic1 as input and unmute the mixer */ |
| 14704 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14705 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14706 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14707 | { } /* end */ |
| 14708 | }; |
| 14709 | /* Set mic1 as output and mute mixer */ |
| 14710 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14711 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14712 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14713 | { } /* end */ |
| 14714 | }; |
| 14715 | |
| 14716 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14717 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14718 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14719 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14720 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14721 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14722 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14723 | /* set pin widget 1Ah (line in) for input */ |
| 14724 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14725 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14726 | * the vref |
| 14727 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14728 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14729 | |
| 14730 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14731 | #if 0 |
| 14732 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14733 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14734 | #endif |
| 14735 | { } /* end */ |
| 14736 | }; |
| 14737 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14738 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14739 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14740 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14741 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14742 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14743 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14744 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14745 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14746 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14747 | |
| 14748 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14749 | #if 0 |
| 14750 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14751 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14752 | #endif |
| 14753 | { } /* end */ |
| 14754 | }; |
| 14755 | |
| 14756 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14757 | { 2, alc861_asus_ch2_init }, |
| 14758 | { 6, alc861_asus_ch6_init }, |
| 14759 | }; |
| 14760 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14761 | /* patch-ALC861 */ |
| 14762 | |
| 14763 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14764 | /* output mixer control */ |
| 14765 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14766 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14767 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14768 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14769 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14770 | |
| 14771 | /*Input mixer control */ |
| 14772 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14773 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14774 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14775 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14776 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14777 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14778 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14780 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14783 | { } /* end */ |
| 14784 | }; |
| 14785 | |
| 14786 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14787 | /* output mixer control */ |
| 14788 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14789 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14790 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14791 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14792 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14793 | |
| 14794 | /* Input mixer control */ |
| 14795 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14796 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14797 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14798 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14800 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14802 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14803 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14804 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14805 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14806 | { |
| 14807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14808 | .name = "Channel Mode", |
| 14809 | .info = alc_ch_mode_info, |
| 14810 | .get = alc_ch_mode_get, |
| 14811 | .put = alc_ch_mode_put, |
| 14812 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14813 | }, |
| 14814 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14815 | }; |
| 14816 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14817 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14818 | /* output mixer control */ |
| 14819 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14820 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14822 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14823 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14824 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14825 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14826 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14827 | /* output mixer control */ |
| 14828 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14829 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14830 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14831 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14832 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14833 | |
| 14834 | /* Input mixer control */ |
| 14835 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14836 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14837 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14838 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14839 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14840 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14843 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14844 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14845 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14846 | { |
| 14847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14848 | .name = "Channel Mode", |
| 14849 | .info = alc_ch_mode_info, |
| 14850 | .get = alc_ch_mode_get, |
| 14851 | .put = alc_ch_mode_put, |
| 14852 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14853 | }, |
| 14854 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14855 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14856 | |
| 14857 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14858 | /* output mixer control */ |
| 14859 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14860 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14861 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14862 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14863 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14864 | |
| 14865 | /* Input mixer control */ |
| 14866 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14867 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14869 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14871 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14873 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14874 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14875 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14876 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14877 | { |
| 14878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14879 | .name = "Channel Mode", |
| 14880 | .info = alc_ch_mode_info, |
| 14881 | .get = alc_ch_mode_get, |
| 14882 | .put = alc_ch_mode_put, |
| 14883 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14884 | }, |
| 14885 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14886 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14887 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14888 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14889 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14890 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14891 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14892 | { } |
| 14893 | }; |
| 14894 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14895 | /* |
| 14896 | * generic initialization of ADC, input mixers and output mixers |
| 14897 | */ |
| 14898 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14899 | /* |
| 14900 | * Unmute ADC0 and set the default input to mic-in |
| 14901 | */ |
| 14902 | /* port-A for surround (rear panel) */ |
| 14903 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14904 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14905 | /* port-B for mic-in (rear panel) with vref */ |
| 14906 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14907 | /* port-C for line-in (rear panel) */ |
| 14908 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14909 | /* port-D for Front */ |
| 14910 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14911 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14912 | /* port-E for HP out (front panel) */ |
| 14913 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14914 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14915 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14916 | /* port-F for mic-in (front panel) with vref */ |
| 14917 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14918 | /* port-G for CLFE (rear panel) */ |
| 14919 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14920 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14921 | /* port-H for side (rear panel) */ |
| 14922 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14923 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14924 | /* CD-in */ |
| 14925 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14926 | /* route front mic to ADC1*/ |
| 14927 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14928 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14929 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14930 | /* Unmute DAC0~3 & spdif out*/ |
| 14931 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14932 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14933 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14934 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14935 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14936 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14937 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14938 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14939 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14940 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14941 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14942 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14943 | /* Unmute Stereo Mixer 15 */ |
| 14944 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14945 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14946 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14947 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14948 | |
| 14949 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14950 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14951 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14952 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14953 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14954 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14955 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14956 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14957 | /* hp used DAC 3 (Front) */ |
| 14958 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14960 | |
| 14961 | { } |
| 14962 | }; |
| 14963 | |
| 14964 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14965 | /* |
| 14966 | * Unmute ADC0 and set the default input to mic-in |
| 14967 | */ |
| 14968 | /* port-A for surround (rear panel) */ |
| 14969 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14970 | /* port-B for mic-in (rear panel) with vref */ |
| 14971 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14972 | /* port-C for line-in (rear panel) */ |
| 14973 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14974 | /* port-D for Front */ |
| 14975 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14976 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14977 | /* port-E for HP out (front panel) */ |
| 14978 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14979 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14980 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14981 | /* port-F for mic-in (front panel) with vref */ |
| 14982 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14983 | /* port-G for CLFE (rear panel) */ |
| 14984 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14985 | /* port-H for side (rear panel) */ |
| 14986 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14987 | /* CD-in */ |
| 14988 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14989 | /* route front mic to ADC1*/ |
| 14990 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14992 | /* Unmute DAC0~3 & spdif out*/ |
| 14993 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14994 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14995 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14996 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14997 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14998 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14999 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15000 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15001 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15002 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15003 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15004 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15005 | /* Unmute Stereo Mixer 15 */ |
| 15006 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15007 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15010 | |
| 15011 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15012 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15013 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15014 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15015 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15016 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15018 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15019 | /* hp used DAC 3 (Front) */ |
| 15020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15021 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15022 | { } |
| 15023 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15024 | |
| 15025 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15026 | /* |
| 15027 | * Unmute ADC0 and set the default input to mic-in |
| 15028 | */ |
| 15029 | /* port-A for surround (rear panel) */ |
| 15030 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15031 | /* port-B for mic-in (rear panel) with vref */ |
| 15032 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15033 | /* port-C for line-in (rear panel) */ |
| 15034 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15035 | /* port-D for Front */ |
| 15036 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15037 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15038 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15039 | /* this has to be set to VREF80 */ |
| 15040 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15041 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15042 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15043 | /* port-F for mic-in (front panel) with vref */ |
| 15044 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15045 | /* port-G for CLFE (rear panel) */ |
| 15046 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15047 | /* port-H for side (rear panel) */ |
| 15048 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15049 | /* CD-in */ |
| 15050 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15051 | /* route front mic to ADC1*/ |
| 15052 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15053 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15054 | /* Unmute DAC0~3 & spdif out*/ |
| 15055 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15056 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15057 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15058 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15060 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15061 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15062 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15063 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15064 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15065 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15066 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15067 | /* Unmute Stereo Mixer 15 */ |
| 15068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15072 | |
| 15073 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15074 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15075 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15076 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15077 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15079 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15081 | /* hp used DAC 3 (Front) */ |
| 15082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15084 | { } |
| 15085 | }; |
| 15086 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15087 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15088 | /* |
| 15089 | * Unmute ADC0 and set the default input to mic-in |
| 15090 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15091 | /* port-A for surround (rear panel) |
| 15092 | * according to codec#0 this is the HP jack |
| 15093 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15094 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15095 | /* route front PCM to HP */ |
| 15096 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15097 | /* port-B for mic-in (rear panel) with vref */ |
| 15098 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15099 | /* port-C for line-in (rear panel) */ |
| 15100 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15101 | /* port-D for Front */ |
| 15102 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15103 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15104 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15105 | /* this has to be set to VREF80 */ |
| 15106 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15107 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15108 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15109 | /* port-F for mic-in (front panel) with vref */ |
| 15110 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15111 | /* port-G for CLFE (rear panel) */ |
| 15112 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15113 | /* port-H for side (rear panel) */ |
| 15114 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15115 | /* CD-in */ |
| 15116 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15117 | /* route front mic to ADC1*/ |
| 15118 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15119 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15120 | /* Unmute DAC0~3 & spdif out*/ |
| 15121 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15122 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15123 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15124 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15126 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15127 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15128 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15129 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15130 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15131 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15132 | /* Unmute Stereo Mixer 15 */ |
| 15133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15135 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15136 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15137 | |
| 15138 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15139 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15140 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15141 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15142 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15143 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15144 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15145 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15146 | /* hp used DAC 3 (Front) */ |
| 15147 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15149 | { } |
| 15150 | }; |
| 15151 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15152 | /* additional init verbs for ASUS laptops */ |
| 15153 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15154 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15155 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15156 | { } |
| 15157 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15158 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15159 | /* |
| 15160 | * generic initialization of ADC, input mixers and output mixers |
| 15161 | */ |
| 15162 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15163 | /* |
| 15164 | * Unmute ADC0 and set the default input to mic-in |
| 15165 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15166 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15167 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15168 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15169 | /* Unmute DAC0~3 & spdif out*/ |
| 15170 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15171 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15172 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15173 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15174 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15175 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15176 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15177 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15178 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15179 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15180 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15182 | /* Unmute Stereo Mixer 15 */ |
| 15183 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15184 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15185 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15186 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15187 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15188 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15189 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15190 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15191 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15192 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15193 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15194 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15195 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15196 | |
| 15197 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15198 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15199 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15200 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15201 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15202 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15203 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15204 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15205 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15206 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15207 | |
| 15208 | { } |
| 15209 | }; |
| 15210 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15211 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15212 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15213 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15214 | { } |
| 15215 | }; |
| 15216 | |
| 15217 | /* toggle speaker-output according to the hp-jack state */ |
| 15218 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15219 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15220 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15221 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15222 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15223 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15224 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15225 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15226 | } |
| 15227 | |
| 15228 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15229 | unsigned int res) |
| 15230 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15231 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15232 | alc861_toshiba_automute(codec); |
| 15233 | } |
| 15234 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15235 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15236 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15237 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15238 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15239 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15240 | |
| 15241 | |
| 15242 | #define ALC861_DIGOUT_NID 0x07 |
| 15243 | |
| 15244 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15245 | { 8, NULL } |
| 15246 | }; |
| 15247 | |
| 15248 | static hda_nid_t alc861_dac_nids[4] = { |
| 15249 | /* front, surround, clfe, side */ |
| 15250 | 0x03, 0x06, 0x05, 0x04 |
| 15251 | }; |
| 15252 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15253 | static hda_nid_t alc660_dac_nids[3] = { |
| 15254 | /* front, clfe, surround */ |
| 15255 | 0x03, 0x05, 0x06 |
| 15256 | }; |
| 15257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15258 | static hda_nid_t alc861_adc_nids[1] = { |
| 15259 | /* ADC0-2 */ |
| 15260 | 0x08, |
| 15261 | }; |
| 15262 | |
| 15263 | static struct hda_input_mux alc861_capture_source = { |
| 15264 | .num_items = 5, |
| 15265 | .items = { |
| 15266 | { "Mic", 0x0 }, |
| 15267 | { "Front Mic", 0x3 }, |
| 15268 | { "Line", 0x1 }, |
| 15269 | { "CD", 0x4 }, |
| 15270 | { "Mixer", 0x5 }, |
| 15271 | }, |
| 15272 | }; |
| 15273 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15274 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15275 | { |
| 15276 | struct alc_spec *spec = codec->spec; |
| 15277 | hda_nid_t mix, srcs[5]; |
| 15278 | int i, j, num; |
| 15279 | |
| 15280 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15281 | return 0; |
| 15282 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15283 | if (num < 0) |
| 15284 | return 0; |
| 15285 | for (i = 0; i < num; i++) { |
| 15286 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15287 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15288 | if (type != AC_WID_AUD_OUT) |
| 15289 | continue; |
| 15290 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15291 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15292 | break; |
| 15293 | if (j >= spec->multiout.num_dacs) |
| 15294 | return srcs[i]; |
| 15295 | } |
| 15296 | return 0; |
| 15297 | } |
| 15298 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15299 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15300 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15301 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15302 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15303 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15304 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15305 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15306 | |
| 15307 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15308 | for (i = 0; i < cfg->line_outs; i++) { |
| 15309 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15310 | dac = alc861_look_for_dac(codec, nid); |
| 15311 | if (!dac) |
| 15312 | continue; |
| 15313 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15314 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15315 | return 0; |
| 15316 | } |
| 15317 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15318 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15319 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15320 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15321 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15322 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15323 | } |
| 15324 | |
| 15325 | /* add playback controls from the parsed DAC table */ |
| 15326 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15327 | const struct auto_pin_cfg *cfg) |
| 15328 | { |
| 15329 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15330 | static const char *chname[4] = { |
| 15331 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15332 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15333 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15334 | int i, err; |
| 15335 | |
| 15336 | if (cfg->line_outs == 1) { |
| 15337 | const char *pfx = NULL; |
| 15338 | if (!cfg->hp_outs) |
| 15339 | pfx = "Master"; |
| 15340 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15341 | pfx = "Speaker"; |
| 15342 | if (pfx) { |
| 15343 | nid = spec->multiout.dac_nids[0]; |
| 15344 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15345 | } |
| 15346 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15347 | |
| 15348 | for (i = 0; i < cfg->line_outs; i++) { |
| 15349 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15350 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15351 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15352 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15353 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15354 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15355 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15356 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15357 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15358 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15359 | return err; |
| 15360 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15361 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15362 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15363 | return err; |
| 15364 | } |
| 15365 | } |
| 15366 | return 0; |
| 15367 | } |
| 15368 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15369 | 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] | 15370 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15371 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15372 | int err; |
| 15373 | hda_nid_t nid; |
| 15374 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15375 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15376 | return 0; |
| 15377 | |
| 15378 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15379 | nid = alc861_look_for_dac(codec, pin); |
| 15380 | if (nid) { |
| 15381 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15382 | if (err < 0) |
| 15383 | return err; |
| 15384 | spec->multiout.hp_nid = nid; |
| 15385 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15386 | } |
| 15387 | return 0; |
| 15388 | } |
| 15389 | |
| 15390 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15391 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15392 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15393 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15394 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15395 | } |
| 15396 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15397 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15398 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15399 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15400 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15401 | hda_nid_t mix, srcs[5]; |
| 15402 | int i, num; |
| 15403 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15404 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15405 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15406 | 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] | 15407 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15408 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15409 | return; |
| 15410 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15411 | if (num < 0) |
| 15412 | return; |
| 15413 | for (i = 0; i < num; i++) { |
| 15414 | unsigned int mute; |
| 15415 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15416 | mute = AMP_IN_UNMUTE(i); |
| 15417 | else |
| 15418 | mute = AMP_IN_MUTE(i); |
| 15419 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15420 | mute); |
| 15421 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15422 | } |
| 15423 | |
| 15424 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15425 | { |
| 15426 | struct alc_spec *spec = codec->spec; |
| 15427 | int i; |
| 15428 | |
| 15429 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15430 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15431 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15432 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15433 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15434 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15435 | } |
| 15436 | } |
| 15437 | |
| 15438 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15439 | { |
| 15440 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15441 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15442 | if (spec->autocfg.hp_outs) |
| 15443 | alc861_auto_set_output_and_unmute(codec, |
| 15444 | spec->autocfg.hp_pins[0], |
| 15445 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15446 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15447 | if (spec->autocfg.speaker_outs) |
| 15448 | alc861_auto_set_output_and_unmute(codec, |
| 15449 | spec->autocfg.speaker_pins[0], |
| 15450 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15451 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15452 | } |
| 15453 | |
| 15454 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15455 | { |
| 15456 | struct alc_spec *spec = codec->spec; |
| 15457 | int i; |
| 15458 | |
| 15459 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15460 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15461 | if (nid >= 0x0c && nid <= 0x11) |
| 15462 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15463 | } |
| 15464 | } |
| 15465 | |
| 15466 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15467 | /* return 1 if successful, 0 if the proper config is not found, |
| 15468 | * or a negative error code |
| 15469 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15470 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15471 | { |
| 15472 | struct alc_spec *spec = codec->spec; |
| 15473 | int err; |
| 15474 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15475 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15476 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15477 | alc861_ignore); |
| 15478 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15479 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15480 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15481 | return 0; /* can't find valid BIOS pin config */ |
| 15482 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15483 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15484 | if (err < 0) |
| 15485 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15486 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15487 | if (err < 0) |
| 15488 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15489 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15490 | if (err < 0) |
| 15491 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15492 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15493 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15494 | return err; |
| 15495 | |
| 15496 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15497 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15498 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15499 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15500 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15501 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15502 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15503 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15504 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15505 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15506 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15507 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15508 | |
| 15509 | spec->adc_nids = alc861_adc_nids; |
| 15510 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15511 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15512 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15513 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15514 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15515 | return 1; |
| 15516 | } |
| 15517 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15518 | /* additional initialization for auto-configuration model */ |
| 15519 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15520 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15521 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15522 | alc861_auto_init_multi_out(codec); |
| 15523 | alc861_auto_init_hp_out(codec); |
| 15524 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15525 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15526 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15527 | } |
| 15528 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15529 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15530 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15531 | { 0x15, HDA_INPUT, 0 }, |
| 15532 | { 0x15, HDA_INPUT, 1 }, |
| 15533 | { 0x15, HDA_INPUT, 2 }, |
| 15534 | { 0x15, HDA_INPUT, 3 }, |
| 15535 | { } /* end */ |
| 15536 | }; |
| 15537 | #endif |
| 15538 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15539 | |
| 15540 | /* |
| 15541 | * configuration and preset |
| 15542 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15543 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15544 | [ALC861_3ST] = "3stack", |
| 15545 | [ALC660_3ST] = "3stack-660", |
| 15546 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15547 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15548 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15549 | [ALC861_TOSHIBA] = "toshiba", |
| 15550 | [ALC861_ASUS] = "asus", |
| 15551 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15552 | [ALC861_AUTO] = "auto", |
| 15553 | }; |
| 15554 | |
| 15555 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15556 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15557 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15558 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15559 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15560 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15561 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15562 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15563 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15564 | * Any other models that need this preset? |
| 15565 | */ |
| 15566 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15567 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15568 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15569 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15570 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15571 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15572 | /* FIXME: the below seems conflict */ |
| 15573 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15574 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15575 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15576 | {} |
| 15577 | }; |
| 15578 | |
| 15579 | static struct alc_config_preset alc861_presets[] = { |
| 15580 | [ALC861_3ST] = { |
| 15581 | .mixers = { alc861_3ST_mixer }, |
| 15582 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15583 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15584 | .dac_nids = alc861_dac_nids, |
| 15585 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15586 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15587 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15588 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15589 | .adc_nids = alc861_adc_nids, |
| 15590 | .input_mux = &alc861_capture_source, |
| 15591 | }, |
| 15592 | [ALC861_3ST_DIG] = { |
| 15593 | .mixers = { alc861_base_mixer }, |
| 15594 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15595 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15596 | .dac_nids = alc861_dac_nids, |
| 15597 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15598 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15599 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15600 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15601 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15602 | .adc_nids = alc861_adc_nids, |
| 15603 | .input_mux = &alc861_capture_source, |
| 15604 | }, |
| 15605 | [ALC861_6ST_DIG] = { |
| 15606 | .mixers = { alc861_base_mixer }, |
| 15607 | .init_verbs = { alc861_base_init_verbs }, |
| 15608 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15609 | .dac_nids = alc861_dac_nids, |
| 15610 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15611 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15612 | .channel_mode = alc861_8ch_modes, |
| 15613 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15614 | .adc_nids = alc861_adc_nids, |
| 15615 | .input_mux = &alc861_capture_source, |
| 15616 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15617 | [ALC660_3ST] = { |
| 15618 | .mixers = { alc861_3ST_mixer }, |
| 15619 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15620 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15621 | .dac_nids = alc660_dac_nids, |
| 15622 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15623 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15624 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15625 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15626 | .adc_nids = alc861_adc_nids, |
| 15627 | .input_mux = &alc861_capture_source, |
| 15628 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15629 | [ALC861_UNIWILL_M31] = { |
| 15630 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15631 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15632 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15633 | .dac_nids = alc861_dac_nids, |
| 15634 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15635 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15636 | .channel_mode = alc861_uniwill_m31_modes, |
| 15637 | .need_dac_fix = 1, |
| 15638 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15639 | .adc_nids = alc861_adc_nids, |
| 15640 | .input_mux = &alc861_capture_source, |
| 15641 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15642 | [ALC861_TOSHIBA] = { |
| 15643 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15644 | .init_verbs = { alc861_base_init_verbs, |
| 15645 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15646 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15647 | .dac_nids = alc861_dac_nids, |
| 15648 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15649 | .channel_mode = alc883_3ST_2ch_modes, |
| 15650 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15651 | .adc_nids = alc861_adc_nids, |
| 15652 | .input_mux = &alc861_capture_source, |
| 15653 | .unsol_event = alc861_toshiba_unsol_event, |
| 15654 | .init_hook = alc861_toshiba_automute, |
| 15655 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15656 | [ALC861_ASUS] = { |
| 15657 | .mixers = { alc861_asus_mixer }, |
| 15658 | .init_verbs = { alc861_asus_init_verbs }, |
| 15659 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15660 | .dac_nids = alc861_dac_nids, |
| 15661 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15662 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15663 | .channel_mode = alc861_asus_modes, |
| 15664 | .need_dac_fix = 1, |
| 15665 | .hp_nid = 0x06, |
| 15666 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15667 | .adc_nids = alc861_adc_nids, |
| 15668 | .input_mux = &alc861_capture_source, |
| 15669 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15670 | [ALC861_ASUS_LAPTOP] = { |
| 15671 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15672 | .init_verbs = { alc861_asus_init_verbs, |
| 15673 | alc861_asus_laptop_init_verbs }, |
| 15674 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15675 | .dac_nids = alc861_dac_nids, |
| 15676 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15677 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15678 | .channel_mode = alc883_3ST_2ch_modes, |
| 15679 | .need_dac_fix = 1, |
| 15680 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15681 | .adc_nids = alc861_adc_nids, |
| 15682 | .input_mux = &alc861_capture_source, |
| 15683 | }, |
| 15684 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15685 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15686 | /* Pin config fixes */ |
| 15687 | enum { |
| 15688 | PINFIX_FSC_AMILO_PI1505, |
| 15689 | }; |
| 15690 | |
| 15691 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15692 | { 0x0b, 0x0221101f }, /* HP */ |
| 15693 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15694 | { } |
| 15695 | }; |
| 15696 | |
| 15697 | static const struct alc_fixup alc861_fixups[] = { |
| 15698 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15699 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15700 | }, |
| 15701 | }; |
| 15702 | |
| 15703 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15704 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15705 | {} |
| 15706 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15707 | |
| 15708 | static int patch_alc861(struct hda_codec *codec) |
| 15709 | { |
| 15710 | struct alc_spec *spec; |
| 15711 | int board_config; |
| 15712 | int err; |
| 15713 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15714 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15715 | if (spec == NULL) |
| 15716 | return -ENOMEM; |
| 15717 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15718 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15719 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15720 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15721 | alc861_models, |
| 15722 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15723 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15724 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15725 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15726 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15727 | board_config = ALC861_AUTO; |
| 15728 | } |
| 15729 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15730 | if (board_config == ALC861_AUTO) |
| 15731 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15733 | if (board_config == ALC861_AUTO) { |
| 15734 | /* automatic parse from the BIOS config */ |
| 15735 | err = alc861_parse_auto_config(codec); |
| 15736 | if (err < 0) { |
| 15737 | alc_free(codec); |
| 15738 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15739 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15740 | printk(KERN_INFO |
| 15741 | "hda_codec: Cannot set up configuration " |
| 15742 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15743 | board_config = ALC861_3ST_DIG; |
| 15744 | } |
| 15745 | } |
| 15746 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15747 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15748 | if (err < 0) { |
| 15749 | alc_free(codec); |
| 15750 | return err; |
| 15751 | } |
| 15752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15753 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15754 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15755 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15756 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15757 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15758 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15759 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15760 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15761 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15762 | if (!spec->cap_mixer) |
| 15763 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15764 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15765 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15766 | spec->vmaster_nid = 0x03; |
| 15767 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15768 | if (board_config == ALC861_AUTO) |
| 15769 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15771 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15772 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15773 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15774 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15775 | spec->power_hook = alc_power_eapd; |
| 15776 | #endif |
| 15777 | } |
| 15778 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15779 | if (!spec->loopback.amplist) |
| 15780 | spec->loopback.amplist = alc861_loopbacks; |
| 15781 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15783 | return 0; |
| 15784 | } |
| 15785 | |
| 15786 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15787 | * ALC861-VD support |
| 15788 | * |
| 15789 | * Based on ALC882 |
| 15790 | * |
| 15791 | * In addition, an independent DAC |
| 15792 | */ |
| 15793 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15794 | |
| 15795 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15796 | /* front, surr, clfe, side surr */ |
| 15797 | 0x02, 0x03, 0x04, 0x05 |
| 15798 | }; |
| 15799 | |
| 15800 | /* dac_nids for ALC660vd are in a different order - according to |
| 15801 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15802 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15803 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15804 | * - and it is the same as in 861vd. |
| 15805 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15806 | */ |
| 15807 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15808 | /* front, rear, clfe, rear_surr */ |
| 15809 | 0x02, 0x04, 0x03 |
| 15810 | }; |
| 15811 | |
| 15812 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15813 | /* ADC0 */ |
| 15814 | 0x09, |
| 15815 | }; |
| 15816 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15817 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15818 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15819 | /* input MUX */ |
| 15820 | /* FIXME: should be a matrix-type input source selection */ |
| 15821 | static struct hda_input_mux alc861vd_capture_source = { |
| 15822 | .num_items = 4, |
| 15823 | .items = { |
| 15824 | { "Mic", 0x0 }, |
| 15825 | { "Front Mic", 0x1 }, |
| 15826 | { "Line", 0x2 }, |
| 15827 | { "CD", 0x4 }, |
| 15828 | }, |
| 15829 | }; |
| 15830 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15831 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15832 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15833 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15834 | { "Ext Mic", 0x0 }, |
| 15835 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15836 | }, |
| 15837 | }; |
| 15838 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15839 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15840 | .num_items = 2, |
| 15841 | .items = { |
| 15842 | { "Front Mic", 0x0 }, |
| 15843 | { "ATAPI Mic", 0x1 }, |
| 15844 | }, |
| 15845 | }; |
| 15846 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15847 | /* |
| 15848 | * 2ch mode |
| 15849 | */ |
| 15850 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15851 | { 2, NULL } |
| 15852 | }; |
| 15853 | |
| 15854 | /* |
| 15855 | * 6ch mode |
| 15856 | */ |
| 15857 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15858 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15859 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15860 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15861 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15862 | { } /* end */ |
| 15863 | }; |
| 15864 | |
| 15865 | /* |
| 15866 | * 8ch mode |
| 15867 | */ |
| 15868 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15869 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15870 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15871 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15872 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15873 | { } /* end */ |
| 15874 | }; |
| 15875 | |
| 15876 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15877 | { 6, alc861vd_6stack_ch6_init }, |
| 15878 | { 8, alc861vd_6stack_ch8_init }, |
| 15879 | }; |
| 15880 | |
| 15881 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15882 | { |
| 15883 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15884 | .name = "Channel Mode", |
| 15885 | .info = alc_ch_mode_info, |
| 15886 | .get = alc_ch_mode_get, |
| 15887 | .put = alc_ch_mode_put, |
| 15888 | }, |
| 15889 | { } /* end */ |
| 15890 | }; |
| 15891 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15892 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15893 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15894 | */ |
| 15895 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15897 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15898 | |
| 15899 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15900 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15901 | |
| 15902 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15903 | HDA_OUTPUT), |
| 15904 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15905 | HDA_OUTPUT), |
| 15906 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15907 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15908 | |
| 15909 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15910 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15911 | |
| 15912 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15913 | |
| 15914 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15915 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15917 | |
| 15918 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15919 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15920 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15921 | |
| 15922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15923 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15924 | |
| 15925 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15926 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15927 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15928 | { } /* end */ |
| 15929 | }; |
| 15930 | |
| 15931 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15932 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15933 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15934 | |
| 15935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15936 | |
| 15937 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15940 | |
| 15941 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15942 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15943 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15944 | |
| 15945 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15946 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15947 | |
| 15948 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15949 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15950 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15951 | { } /* end */ |
| 15952 | }; |
| 15953 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15954 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15956 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15957 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15958 | |
| 15959 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15960 | |
| 15961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15962 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15964 | |
| 15965 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15966 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15967 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15968 | |
| 15969 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15970 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15971 | |
| 15972 | { } /* end */ |
| 15973 | }; |
| 15974 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15975 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15976 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15977 | */ |
| 15978 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15979 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15980 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15981 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15982 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15983 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15984 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15985 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15986 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15987 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15988 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15989 | { } /* end */ |
| 15990 | }; |
| 15991 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15992 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15993 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15994 | */ |
| 15995 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15998 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15999 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16000 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16001 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16002 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16003 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16004 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16005 | { } /* end */ |
| 16006 | }; |
| 16007 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16008 | /* |
| 16009 | * generic initialization of ADC, input mixers and output mixers |
| 16010 | */ |
| 16011 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16012 | /* |
| 16013 | * Unmute ADC0 and set the default input to mic-in |
| 16014 | */ |
| 16015 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16016 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16017 | |
| 16018 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16019 | * the analog-loopback mixer widget |
| 16020 | */ |
| 16021 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16027 | |
| 16028 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16030 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16031 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16032 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16033 | |
| 16034 | /* |
| 16035 | * Set up output mixers (0x02 - 0x05) |
| 16036 | */ |
| 16037 | /* set vol=0 to output mixers */ |
| 16038 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16039 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16040 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16041 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16042 | |
| 16043 | /* set up input amps for analog loopback */ |
| 16044 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16051 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16052 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16053 | |
| 16054 | { } |
| 16055 | }; |
| 16056 | |
| 16057 | /* |
| 16058 | * 3-stack pin configuration: |
| 16059 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16060 | */ |
| 16061 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16062 | /* |
| 16063 | * Set pin mode and muting |
| 16064 | */ |
| 16065 | /* set front pin widgets 0x14 for output */ |
| 16066 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16067 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16068 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16069 | |
| 16070 | /* Mic (rear) pin: input vref at 80% */ |
| 16071 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16072 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16073 | /* Front Mic pin: input vref at 80% */ |
| 16074 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16075 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16076 | /* Line In pin: input */ |
| 16077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16078 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16079 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16080 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16081 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16082 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16083 | /* CD pin widget for input */ |
| 16084 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16085 | |
| 16086 | { } |
| 16087 | }; |
| 16088 | |
| 16089 | /* |
| 16090 | * 6-stack pin configuration: |
| 16091 | */ |
| 16092 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16093 | /* |
| 16094 | * Set pin mode and muting |
| 16095 | */ |
| 16096 | /* set front pin widgets 0x14 for output */ |
| 16097 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16098 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16099 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16100 | |
| 16101 | /* Rear Pin: output 1 (0x0d) */ |
| 16102 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16103 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16104 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16105 | /* CLFE Pin: output 2 (0x0e) */ |
| 16106 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16107 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16108 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16109 | /* Side Pin: output 3 (0x0f) */ |
| 16110 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16111 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16112 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16113 | |
| 16114 | /* Mic (rear) pin: input vref at 80% */ |
| 16115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16116 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16117 | /* Front Mic pin: input vref at 80% */ |
| 16118 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16119 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16120 | /* Line In pin: input */ |
| 16121 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16122 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16123 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16124 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16125 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16126 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16127 | /* CD pin widget for input */ |
| 16128 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16129 | |
| 16130 | { } |
| 16131 | }; |
| 16132 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16133 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16134 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16135 | { } |
| 16136 | }; |
| 16137 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16138 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16139 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16140 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16141 | { } |
| 16142 | }; |
| 16143 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16144 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16146 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16147 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16148 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16149 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16150 | {} |
| 16151 | }; |
| 16152 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16153 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16154 | { |
| 16155 | unsigned int present; |
| 16156 | unsigned char bits; |
| 16157 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16158 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16159 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16160 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16161 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16162 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16163 | } |
| 16164 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16165 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16166 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16167 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16168 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16169 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16170 | } |
| 16171 | |
| 16172 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16173 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16174 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16175 | alc861vd_lenovo_mic_automute(codec); |
| 16176 | } |
| 16177 | |
| 16178 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16179 | unsigned int res) |
| 16180 | { |
| 16181 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16182 | case ALC880_MIC_EVENT: |
| 16183 | alc861vd_lenovo_mic_automute(codec); |
| 16184 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16185 | default: |
| 16186 | alc_automute_amp_unsol_event(codec, res); |
| 16187 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16188 | } |
| 16189 | } |
| 16190 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16191 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16192 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16193 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16194 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16195 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16196 | |
| 16197 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16199 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16200 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16201 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16202 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16203 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16204 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16205 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16209 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16210 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16211 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16212 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16213 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16214 | |
| 16215 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16216 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16217 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16218 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16219 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16220 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16221 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16222 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16223 | |
| 16224 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16225 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16226 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16227 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16228 | |
| 16229 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16230 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16232 | |
| 16233 | { } /* end */ |
| 16234 | }; |
| 16235 | |
| 16236 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16237 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16238 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16239 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16240 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16241 | spec->autocfg.hp_pins[0] = 0x15; |
| 16242 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16243 | } |
| 16244 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16245 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16246 | #define alc861vd_loopbacks alc880_loopbacks |
| 16247 | #endif |
| 16248 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16249 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16250 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16251 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16252 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16253 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16254 | |
| 16255 | /* |
| 16256 | * configuration and preset |
| 16257 | */ |
| 16258 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16259 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16260 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16261 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16262 | [ALC861VD_3ST] = "3stack", |
| 16263 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16264 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16265 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16266 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16267 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16268 | [ALC861VD_AUTO] = "auto", |
| 16269 | }; |
| 16270 | |
| 16271 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16272 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16273 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16274 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16275 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16276 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16277 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16278 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16279 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16280 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16281 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16282 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16283 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16284 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16285 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16286 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16287 | {} |
| 16288 | }; |
| 16289 | |
| 16290 | static struct alc_config_preset alc861vd_presets[] = { |
| 16291 | [ALC660VD_3ST] = { |
| 16292 | .mixers = { alc861vd_3st_mixer }, |
| 16293 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16294 | alc861vd_3stack_init_verbs }, |
| 16295 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16296 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16297 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16298 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16299 | .input_mux = &alc861vd_capture_source, |
| 16300 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16301 | [ALC660VD_3ST_DIG] = { |
| 16302 | .mixers = { alc861vd_3st_mixer }, |
| 16303 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16304 | alc861vd_3stack_init_verbs }, |
| 16305 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16306 | .dac_nids = alc660vd_dac_nids, |
| 16307 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16308 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16309 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16310 | .input_mux = &alc861vd_capture_source, |
| 16311 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16312 | [ALC861VD_3ST] = { |
| 16313 | .mixers = { alc861vd_3st_mixer }, |
| 16314 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16315 | alc861vd_3stack_init_verbs }, |
| 16316 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16317 | .dac_nids = alc861vd_dac_nids, |
| 16318 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16319 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16320 | .input_mux = &alc861vd_capture_source, |
| 16321 | }, |
| 16322 | [ALC861VD_3ST_DIG] = { |
| 16323 | .mixers = { alc861vd_3st_mixer }, |
| 16324 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16325 | alc861vd_3stack_init_verbs }, |
| 16326 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16327 | .dac_nids = alc861vd_dac_nids, |
| 16328 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16329 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16330 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16331 | .input_mux = &alc861vd_capture_source, |
| 16332 | }, |
| 16333 | [ALC861VD_6ST_DIG] = { |
| 16334 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16335 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16336 | alc861vd_6stack_init_verbs }, |
| 16337 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16338 | .dac_nids = alc861vd_dac_nids, |
| 16339 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16340 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16341 | .channel_mode = alc861vd_6stack_modes, |
| 16342 | .input_mux = &alc861vd_capture_source, |
| 16343 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16344 | [ALC861VD_LENOVO] = { |
| 16345 | .mixers = { alc861vd_lenovo_mixer }, |
| 16346 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16347 | alc861vd_3stack_init_verbs, |
| 16348 | alc861vd_eapd_verbs, |
| 16349 | alc861vd_lenovo_unsol_verbs }, |
| 16350 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16351 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16352 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16353 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16354 | .input_mux = &alc861vd_capture_source, |
| 16355 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16356 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16357 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16358 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16359 | [ALC861VD_DALLAS] = { |
| 16360 | .mixers = { alc861vd_dallas_mixer }, |
| 16361 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16362 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16363 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16364 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16365 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16366 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16367 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16368 | .setup = alc861vd_dallas_setup, |
| 16369 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16370 | }, |
| 16371 | [ALC861VD_HP] = { |
| 16372 | .mixers = { alc861vd_hp_mixer }, |
| 16373 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16374 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16375 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16376 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16377 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16378 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16379 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16380 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16381 | .setup = alc861vd_dallas_setup, |
| 16382 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16383 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16384 | [ALC660VD_ASUS_V1S] = { |
| 16385 | .mixers = { alc861vd_lenovo_mixer }, |
| 16386 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16387 | alc861vd_3stack_init_verbs, |
| 16388 | alc861vd_eapd_verbs, |
| 16389 | alc861vd_lenovo_unsol_verbs }, |
| 16390 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16391 | .dac_nids = alc660vd_dac_nids, |
| 16392 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16393 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16394 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16395 | .input_mux = &alc861vd_capture_source, |
| 16396 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16397 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16398 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16399 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16400 | }; |
| 16401 | |
| 16402 | /* |
| 16403 | * BIOS auto configuration |
| 16404 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16405 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16406 | const struct auto_pin_cfg *cfg) |
| 16407 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16408 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16409 | } |
| 16410 | |
| 16411 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16412 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16413 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16414 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16415 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16416 | } |
| 16417 | |
| 16418 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16419 | { |
| 16420 | struct alc_spec *spec = codec->spec; |
| 16421 | int i; |
| 16422 | |
| 16423 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16424 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16425 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16426 | if (nid) |
| 16427 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16428 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16429 | } |
| 16430 | } |
| 16431 | |
| 16432 | |
| 16433 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16434 | { |
| 16435 | struct alc_spec *spec = codec->spec; |
| 16436 | hda_nid_t pin; |
| 16437 | |
| 16438 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16439 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16440 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16441 | pin = spec->autocfg.speaker_pins[0]; |
| 16442 | if (pin) |
| 16443 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16444 | } |
| 16445 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16446 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16447 | |
| 16448 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16449 | { |
| 16450 | struct alc_spec *spec = codec->spec; |
| 16451 | int i; |
| 16452 | |
| 16453 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16454 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16455 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16456 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16457 | if (nid != ALC861VD_PIN_CD_NID && |
| 16458 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16459 | snd_hda_codec_write(codec, nid, 0, |
| 16460 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16461 | AMP_OUT_MUTE); |
| 16462 | } |
| 16463 | } |
| 16464 | } |
| 16465 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16466 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16467 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16468 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16469 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16470 | |
| 16471 | /* add playback controls from the parsed DAC table */ |
| 16472 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16473 | * different NIDs for mute/unmute switch and volume control */ |
| 16474 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16475 | const struct auto_pin_cfg *cfg) |
| 16476 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16477 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16478 | hda_nid_t nid_v, nid_s; |
| 16479 | int i, err; |
| 16480 | |
| 16481 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16482 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16483 | continue; |
| 16484 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16485 | alc880_dac_to_idx( |
| 16486 | spec->multiout.dac_nids[i])); |
| 16487 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16488 | alc880_dac_to_idx( |
| 16489 | spec->multiout.dac_nids[i])); |
| 16490 | |
| 16491 | if (i == 2) { |
| 16492 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16493 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16494 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16495 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16496 | HDA_OUTPUT)); |
| 16497 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16498 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16499 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16500 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16501 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16502 | HDA_OUTPUT)); |
| 16503 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16504 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16505 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16506 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16507 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16508 | HDA_INPUT)); |
| 16509 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16510 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16511 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16512 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16513 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16514 | HDA_INPUT)); |
| 16515 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16516 | return err; |
| 16517 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16518 | const char *pfx; |
| 16519 | if (cfg->line_outs == 1 && |
| 16520 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16521 | if (!cfg->hp_pins) |
| 16522 | pfx = "Speaker"; |
| 16523 | else |
| 16524 | pfx = "PCM"; |
| 16525 | } else |
| 16526 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16527 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16528 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16529 | HDA_OUTPUT)); |
| 16530 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16531 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16532 | if (cfg->line_outs == 1 && |
| 16533 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16534 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16535 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16536 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16537 | HDA_INPUT)); |
| 16538 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16539 | return err; |
| 16540 | } |
| 16541 | } |
| 16542 | return 0; |
| 16543 | } |
| 16544 | |
| 16545 | /* add playback controls for speaker and HP outputs */ |
| 16546 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16547 | * different NIDs for mute/unmute switch and volume control */ |
| 16548 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16549 | hda_nid_t pin, const char *pfx) |
| 16550 | { |
| 16551 | hda_nid_t nid_v, nid_s; |
| 16552 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16553 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16554 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16555 | return 0; |
| 16556 | |
| 16557 | if (alc880_is_fixed_pin(pin)) { |
| 16558 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16559 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16560 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16561 | spec->multiout.hp_nid = nid_v; |
| 16562 | else |
| 16563 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16564 | /* control HP volume/switch on the output mixer amp */ |
| 16565 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16566 | alc880_fixed_pin_idx(pin)); |
| 16567 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16568 | alc880_fixed_pin_idx(pin)); |
| 16569 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16570 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16571 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16572 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16573 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16574 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16575 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16576 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16577 | return err; |
| 16578 | } else if (alc880_is_multi_pin(pin)) { |
| 16579 | /* set manual connection */ |
| 16580 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16581 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16582 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16583 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16584 | return err; |
| 16585 | } |
| 16586 | return 0; |
| 16587 | } |
| 16588 | |
| 16589 | /* parse the BIOS configuration and set up the alc_spec |
| 16590 | * return 1 if successful, 0 if the proper config is not found, |
| 16591 | * or a negative error code |
| 16592 | * Based on ALC880 version - had to change it to override |
| 16593 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16594 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16595 | { |
| 16596 | struct alc_spec *spec = codec->spec; |
| 16597 | int err; |
| 16598 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16599 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16600 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16601 | alc861vd_ignore); |
| 16602 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16603 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16604 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16605 | return 0; /* can't find valid BIOS pin config */ |
| 16606 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16607 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16608 | if (err < 0) |
| 16609 | return err; |
| 16610 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16611 | if (err < 0) |
| 16612 | return err; |
| 16613 | err = alc861vd_auto_create_extra_out(spec, |
| 16614 | spec->autocfg.speaker_pins[0], |
| 16615 | "Speaker"); |
| 16616 | if (err < 0) |
| 16617 | return err; |
| 16618 | err = alc861vd_auto_create_extra_out(spec, |
| 16619 | spec->autocfg.hp_pins[0], |
| 16620 | "Headphone"); |
| 16621 | if (err < 0) |
| 16622 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16623 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16624 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16625 | return err; |
| 16626 | |
| 16627 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16628 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16629 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16630 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16631 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16632 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16633 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16634 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16635 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16636 | |
| 16637 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16638 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16639 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16640 | err = alc_auto_add_mic_boost(codec); |
| 16641 | if (err < 0) |
| 16642 | return err; |
| 16643 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16644 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16645 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16646 | return 1; |
| 16647 | } |
| 16648 | |
| 16649 | /* additional initialization for auto-configuration model */ |
| 16650 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16651 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16652 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16653 | alc861vd_auto_init_multi_out(codec); |
| 16654 | alc861vd_auto_init_hp_out(codec); |
| 16655 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16656 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16657 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16658 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16659 | } |
| 16660 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16661 | enum { |
| 16662 | ALC660VD_FIX_ASUS_GPIO1 |
| 16663 | }; |
| 16664 | |
| 16665 | /* reset GPIO1 */ |
| 16666 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16667 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16668 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16669 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16670 | { } |
| 16671 | }; |
| 16672 | |
| 16673 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16674 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16675 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16676 | }, |
| 16677 | }; |
| 16678 | |
| 16679 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16680 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16681 | {} |
| 16682 | }; |
| 16683 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16684 | static int patch_alc861vd(struct hda_codec *codec) |
| 16685 | { |
| 16686 | struct alc_spec *spec; |
| 16687 | int err, board_config; |
| 16688 | |
| 16689 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16690 | if (spec == NULL) |
| 16691 | return -ENOMEM; |
| 16692 | |
| 16693 | codec->spec = spec; |
| 16694 | |
| 16695 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16696 | alc861vd_models, |
| 16697 | alc861vd_cfg_tbl); |
| 16698 | |
| 16699 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16700 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16701 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16702 | board_config = ALC861VD_AUTO; |
| 16703 | } |
| 16704 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16705 | if (board_config == ALC861VD_AUTO) |
| 16706 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16707 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16708 | if (board_config == ALC861VD_AUTO) { |
| 16709 | /* automatic parse from the BIOS config */ |
| 16710 | err = alc861vd_parse_auto_config(codec); |
| 16711 | if (err < 0) { |
| 16712 | alc_free(codec); |
| 16713 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16714 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16715 | printk(KERN_INFO |
| 16716 | "hda_codec: Cannot set up configuration " |
| 16717 | "from BIOS. Using base mode...\n"); |
| 16718 | board_config = ALC861VD_3ST; |
| 16719 | } |
| 16720 | } |
| 16721 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16722 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16723 | if (err < 0) { |
| 16724 | alc_free(codec); |
| 16725 | return err; |
| 16726 | } |
| 16727 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16728 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16729 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16730 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16731 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16732 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16733 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16734 | } |
| 16735 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16736 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16737 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16738 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16739 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16740 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16741 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16742 | if (!spec->adc_nids) { |
| 16743 | spec->adc_nids = alc861vd_adc_nids; |
| 16744 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16745 | } |
| 16746 | if (!spec->capsrc_nids) |
| 16747 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16748 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16749 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16750 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16751 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16752 | spec->vmaster_nid = 0x02; |
| 16753 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16754 | if (board_config == ALC861VD_AUTO) |
| 16755 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16756 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16757 | codec->patch_ops = alc_patch_ops; |
| 16758 | |
| 16759 | if (board_config == ALC861VD_AUTO) |
| 16760 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16761 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16762 | if (!spec->loopback.amplist) |
| 16763 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16764 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16765 | |
| 16766 | return 0; |
| 16767 | } |
| 16768 | |
| 16769 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16770 | * ALC662 support |
| 16771 | * |
| 16772 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16773 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16774 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16775 | * 6-channel independent captures. |
| 16776 | * |
| 16777 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16778 | * driver yet). |
| 16779 | */ |
| 16780 | #define ALC662_DIGOUT_NID 0x06 |
| 16781 | #define ALC662_DIGIN_NID 0x0a |
| 16782 | |
| 16783 | static hda_nid_t alc662_dac_nids[4] = { |
| 16784 | /* front, rear, clfe, rear_surr */ |
| 16785 | 0x02, 0x03, 0x04 |
| 16786 | }; |
| 16787 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16788 | static hda_nid_t alc272_dac_nids[2] = { |
| 16789 | 0x02, 0x03 |
| 16790 | }; |
| 16791 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16792 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16793 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16794 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16795 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16796 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16797 | static hda_nid_t alc272_adc_nids[1] = { |
| 16798 | /* ADC1-2 */ |
| 16799 | 0x08, |
| 16800 | }; |
| 16801 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16802 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16803 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16804 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16805 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16806 | /* input MUX */ |
| 16807 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16808 | static struct hda_input_mux alc662_capture_source = { |
| 16809 | .num_items = 4, |
| 16810 | .items = { |
| 16811 | { "Mic", 0x0 }, |
| 16812 | { "Front Mic", 0x1 }, |
| 16813 | { "Line", 0x2 }, |
| 16814 | { "CD", 0x4 }, |
| 16815 | }, |
| 16816 | }; |
| 16817 | |
| 16818 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16819 | .num_items = 2, |
| 16820 | .items = { |
| 16821 | { "Mic", 0x1 }, |
| 16822 | { "Line", 0x2 }, |
| 16823 | }, |
| 16824 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16825 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16826 | static struct hda_input_mux alc663_capture_source = { |
| 16827 | .num_items = 3, |
| 16828 | .items = { |
| 16829 | { "Mic", 0x0 }, |
| 16830 | { "Front Mic", 0x1 }, |
| 16831 | { "Line", 0x2 }, |
| 16832 | }, |
| 16833 | }; |
| 16834 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16835 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16836 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16837 | .num_items = 16, |
| 16838 | .items = { |
| 16839 | { "Autoselect Mic", 0x0 }, |
| 16840 | { "Internal Mic", 0x1 }, |
| 16841 | { "In-0x02", 0x2 }, |
| 16842 | { "In-0x03", 0x3 }, |
| 16843 | { "In-0x04", 0x4 }, |
| 16844 | { "In-0x05", 0x5 }, |
| 16845 | { "In-0x06", 0x6 }, |
| 16846 | { "In-0x07", 0x7 }, |
| 16847 | { "In-0x08", 0x8 }, |
| 16848 | { "In-0x09", 0x9 }, |
| 16849 | { "In-0x0a", 0x0a }, |
| 16850 | { "In-0x0b", 0x0b }, |
| 16851 | { "In-0x0c", 0x0c }, |
| 16852 | { "In-0x0d", 0x0d }, |
| 16853 | { "In-0x0e", 0x0e }, |
| 16854 | { "In-0x0f", 0x0f }, |
| 16855 | }, |
| 16856 | }; |
| 16857 | #endif |
| 16858 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16859 | /* |
| 16860 | * 2ch mode |
| 16861 | */ |
| 16862 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16863 | { 2, NULL } |
| 16864 | }; |
| 16865 | |
| 16866 | /* |
| 16867 | * 2ch mode |
| 16868 | */ |
| 16869 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16870 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16871 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16872 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16873 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16874 | { } /* end */ |
| 16875 | }; |
| 16876 | |
| 16877 | /* |
| 16878 | * 6ch mode |
| 16879 | */ |
| 16880 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16881 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16882 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16883 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16884 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16885 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16886 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16887 | { } /* end */ |
| 16888 | }; |
| 16889 | |
| 16890 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16891 | { 2, alc662_3ST_ch2_init }, |
| 16892 | { 6, alc662_3ST_ch6_init }, |
| 16893 | }; |
| 16894 | |
| 16895 | /* |
| 16896 | * 2ch mode |
| 16897 | */ |
| 16898 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16899 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16900 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16901 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16902 | { } /* end */ |
| 16903 | }; |
| 16904 | |
| 16905 | /* |
| 16906 | * 6ch mode |
| 16907 | */ |
| 16908 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16909 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16910 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16911 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16912 | { } /* end */ |
| 16913 | }; |
| 16914 | |
| 16915 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16916 | { 2, alc662_sixstack_ch6_init }, |
| 16917 | { 6, alc662_sixstack_ch8_init }, |
| 16918 | }; |
| 16919 | |
| 16920 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16921 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16922 | */ |
| 16923 | |
| 16924 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16925 | /* output mixer control */ |
| 16926 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16927 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16928 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16929 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16930 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16931 | 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] | 16932 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16933 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16934 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16935 | |
| 16936 | /*Input mixer control */ |
| 16937 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16938 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16939 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16940 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16942 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16943 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16944 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | { } /* end */ |
| 16946 | }; |
| 16947 | |
| 16948 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16950 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16951 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16952 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16953 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16954 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16955 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16956 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16957 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16958 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16959 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16960 | { } /* end */ |
| 16961 | }; |
| 16962 | |
| 16963 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16964 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16965 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16966 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16967 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16968 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16969 | 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] | 16970 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16971 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16972 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16973 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16974 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16975 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16976 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16977 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16978 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16979 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16981 | { } /* end */ |
| 16982 | }; |
| 16983 | |
| 16984 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16985 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16986 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16987 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16988 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16989 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16990 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16991 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16994 | { } /* end */ |
| 16995 | }; |
| 16996 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16997 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16998 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16999 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17000 | |
| 17001 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17002 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17003 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17004 | |
| 17005 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17006 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17007 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17008 | { } /* end */ |
| 17009 | }; |
| 17010 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17011 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17012 | ALC262_HIPPO_MASTER_SWITCH, |
| 17013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17014 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17015 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17016 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17017 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17019 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17022 | { } /* end */ |
| 17023 | }; |
| 17024 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17025 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17026 | .ops = &snd_hda_bind_vol, |
| 17027 | .values = { |
| 17028 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17029 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17030 | 0 |
| 17031 | }, |
| 17032 | }; |
| 17033 | |
| 17034 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17035 | .ops = &snd_hda_bind_sw, |
| 17036 | .values = { |
| 17037 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17038 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17039 | 0 |
| 17040 | }, |
| 17041 | }; |
| 17042 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17043 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17044 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17045 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17046 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17047 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17048 | { } /* end */ |
| 17049 | }; |
| 17050 | |
| 17051 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17052 | .ops = &snd_hda_bind_sw, |
| 17053 | .values = { |
| 17054 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17055 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17056 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17057 | 0 |
| 17058 | }, |
| 17059 | }; |
| 17060 | |
| 17061 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17062 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17063 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17066 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17067 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17068 | |
| 17069 | { } /* end */ |
| 17070 | }; |
| 17071 | |
| 17072 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17073 | .ops = &snd_hda_bind_sw, |
| 17074 | .values = { |
| 17075 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17076 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17077 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17078 | 0 |
| 17079 | }, |
| 17080 | }; |
| 17081 | |
| 17082 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17083 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17084 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17085 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17086 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17087 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17088 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17089 | { } /* end */ |
| 17090 | }; |
| 17091 | |
| 17092 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17093 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17094 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17097 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17098 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17099 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17100 | { } /* end */ |
| 17101 | }; |
| 17102 | |
| 17103 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17104 | .ops = &snd_hda_bind_vol, |
| 17105 | .values = { |
| 17106 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17107 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17108 | 0 |
| 17109 | }, |
| 17110 | }; |
| 17111 | |
| 17112 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17113 | .ops = &snd_hda_bind_sw, |
| 17114 | .values = { |
| 17115 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17116 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17117 | 0 |
| 17118 | }, |
| 17119 | }; |
| 17120 | |
| 17121 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17122 | HDA_BIND_VOL("Master Playback Volume", |
| 17123 | &alc663_asus_two_bind_master_vol), |
| 17124 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17125 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17126 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17128 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17129 | { } /* end */ |
| 17130 | }; |
| 17131 | |
| 17132 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17133 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17134 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17135 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17137 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17138 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17139 | { } /* end */ |
| 17140 | }; |
| 17141 | |
| 17142 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17143 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17144 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17145 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17146 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17147 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17148 | |
| 17149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17151 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17152 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17153 | { } /* end */ |
| 17154 | }; |
| 17155 | |
| 17156 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17157 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17158 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17160 | |
| 17161 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17162 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17163 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17164 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17165 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17166 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17167 | { } /* end */ |
| 17168 | }; |
| 17169 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17170 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17171 | .ops = &snd_hda_bind_sw, |
| 17172 | .values = { |
| 17173 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17174 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17175 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17176 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17177 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17178 | 0 |
| 17179 | }, |
| 17180 | }; |
| 17181 | |
| 17182 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17183 | .ops = &snd_hda_bind_sw, |
| 17184 | .values = { |
| 17185 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17186 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17187 | 0 |
| 17188 | }, |
| 17189 | }; |
| 17190 | |
| 17191 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17192 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17193 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17194 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17195 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17196 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17197 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17198 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17199 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17200 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17201 | { } /* end */ |
| 17202 | }; |
| 17203 | |
| 17204 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17205 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17206 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17207 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17208 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17209 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17212 | { } /* end */ |
| 17213 | }; |
| 17214 | |
| 17215 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17216 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17217 | { |
| 17218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17219 | .name = "Channel Mode", |
| 17220 | .info = alc_ch_mode_info, |
| 17221 | .get = alc_ch_mode_get, |
| 17222 | .put = alc_ch_mode_put, |
| 17223 | }, |
| 17224 | { } /* end */ |
| 17225 | }; |
| 17226 | |
| 17227 | static struct hda_verb alc662_init_verbs[] = { |
| 17228 | /* ADC: mute amp left and right */ |
| 17229 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17230 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17231 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17232 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17233 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17234 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17235 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17236 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17237 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17238 | |
| 17239 | /* Front Pin: output 0 (0x0c) */ |
| 17240 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17241 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17242 | |
| 17243 | /* Rear Pin: output 1 (0x0d) */ |
| 17244 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17245 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17246 | |
| 17247 | /* CLFE Pin: output 2 (0x0e) */ |
| 17248 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17249 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17250 | |
| 17251 | /* Mic (rear) pin: input vref at 80% */ |
| 17252 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17253 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17254 | /* Front Mic pin: input vref at 80% */ |
| 17255 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17256 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17257 | /* Line In pin: input */ |
| 17258 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17259 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17260 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17261 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17262 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17263 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17264 | /* CD pin widget for input */ |
| 17265 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17266 | |
| 17267 | /* FIXME: use matrix-type input source selection */ |
| 17268 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17269 | /* Input mixer */ |
| 17270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17271 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17272 | |
| 17273 | /* always trun on EAPD */ |
| 17274 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17275 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17276 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17277 | { } |
| 17278 | }; |
| 17279 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17280 | static struct hda_verb alc663_init_verbs[] = { |
| 17281 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17282 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17283 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17284 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17285 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17286 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17287 | { } |
| 17288 | }; |
| 17289 | |
| 17290 | static struct hda_verb alc272_init_verbs[] = { |
| 17291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17292 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17293 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17294 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17295 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17296 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17297 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17298 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17299 | { } |
| 17300 | }; |
| 17301 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17302 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17303 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17304 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17305 | {} |
| 17306 | }; |
| 17307 | |
| 17308 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17309 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17310 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17311 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17312 | }; |
| 17313 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17314 | /* Set Unsolicited Event*/ |
| 17315 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17316 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17317 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17318 | {} |
| 17319 | }; |
| 17320 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17321 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17322 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17323 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17324 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17325 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17326 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17327 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17328 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17329 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17330 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17331 | {} |
| 17332 | }; |
| 17333 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17334 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17335 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17336 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17337 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17339 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17340 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17341 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17342 | {} |
| 17343 | }; |
| 17344 | |
| 17345 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17346 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17347 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17348 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17349 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17350 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17351 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17352 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17353 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17354 | {} |
| 17355 | }; |
| 17356 | |
| 17357 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17358 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17359 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17360 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17361 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17363 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17364 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17365 | {} |
| 17366 | }; |
| 17367 | |
| 17368 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17369 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17370 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17371 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17372 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17373 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17374 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17375 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17376 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17378 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17379 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17380 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17381 | {} |
| 17382 | }; |
| 17383 | |
| 17384 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17385 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17386 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17387 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17388 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17389 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17390 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17391 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17392 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17393 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17394 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17395 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17396 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17397 | {} |
| 17398 | }; |
| 17399 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17400 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17401 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17402 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17403 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17404 | |
| 17405 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17406 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17407 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17408 | |
| 17409 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17410 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17411 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17412 | {} |
| 17413 | }; |
| 17414 | |
| 17415 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17416 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17417 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17418 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17419 | |
| 17420 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17421 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17422 | {} |
| 17423 | }; |
| 17424 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17425 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17426 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17428 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17429 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17430 | {} |
| 17431 | }; |
| 17432 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17433 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17434 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17435 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17436 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17437 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17438 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17439 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17440 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17441 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17442 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17443 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17444 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17445 | {} |
| 17446 | }; |
| 17447 | |
| 17448 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17449 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17450 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17451 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17452 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17453 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17454 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17455 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17456 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17457 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17458 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17459 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17460 | {} |
| 17461 | }; |
| 17462 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17463 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17464 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17465 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17466 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17467 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17468 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17469 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17470 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17471 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17472 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17473 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17474 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17476 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17477 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17478 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17479 | {} |
| 17480 | }; |
| 17481 | |
| 17482 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17483 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17484 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17485 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17486 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17487 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17488 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17489 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17490 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17491 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17492 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17493 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17496 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17497 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17498 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17499 | {} |
| 17500 | }; |
| 17501 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17502 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17503 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17504 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17505 | { } /* end */ |
| 17506 | }; |
| 17507 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17508 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17509 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17510 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17511 | { } /* end */ |
| 17512 | }; |
| 17513 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17514 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17515 | { |
| 17516 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17517 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17518 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17519 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17520 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17521 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17522 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17523 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17524 | } |
| 17525 | |
| 17526 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17527 | { |
| 17528 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17529 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17530 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17531 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17532 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17533 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17534 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17535 | HDA_AMP_MUTE, bits); |
| 17536 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17537 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17538 | } |
| 17539 | |
| 17540 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17541 | unsigned int res) |
| 17542 | { |
| 17543 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17544 | alc662_lenovo_101e_all_automute(codec); |
| 17545 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17546 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17547 | } |
| 17548 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17549 | /* unsolicited event for HP jack sensing */ |
| 17550 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17551 | unsigned int res) |
| 17552 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17553 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17554 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17555 | else |
| 17556 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17557 | } |
| 17558 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17559 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17560 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17561 | struct alc_spec *spec = codec->spec; |
| 17562 | |
| 17563 | alc262_hippo1_setup(codec); |
| 17564 | spec->ext_mic.pin = 0x18; |
| 17565 | spec->ext_mic.mux_idx = 0; |
| 17566 | spec->int_mic.pin = 0x19; |
| 17567 | spec->int_mic.mux_idx = 1; |
| 17568 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17569 | } |
| 17570 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17571 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17572 | { |
| 17573 | alc262_hippo_automute(codec); |
| 17574 | alc_mic_automute(codec); |
| 17575 | } |
| 17576 | |
| 17577 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17578 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17579 | struct alc_spec *spec = codec->spec; |
| 17580 | |
| 17581 | spec->autocfg.hp_pins[0] = 0x14; |
| 17582 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17583 | } |
| 17584 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17585 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17586 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17587 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17588 | { |
| 17589 | unsigned int present; |
| 17590 | unsigned char bits; |
| 17591 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17592 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17593 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17594 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17595 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17596 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17597 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17598 | } |
| 17599 | |
| 17600 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17601 | { |
| 17602 | unsigned int present; |
| 17603 | unsigned char bits; |
| 17604 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17605 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17606 | bits = present ? HDA_AMP_MUTE : 0; |
| 17607 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17608 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17609 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17610 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17611 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17612 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17613 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17614 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17615 | } |
| 17616 | |
| 17617 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17618 | { |
| 17619 | unsigned int present; |
| 17620 | unsigned char bits; |
| 17621 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17622 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17623 | bits = present ? HDA_AMP_MUTE : 0; |
| 17624 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17625 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17626 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17627 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17628 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17629 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17630 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17631 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17632 | } |
| 17633 | |
| 17634 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17635 | { |
| 17636 | unsigned int present; |
| 17637 | unsigned char bits; |
| 17638 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17639 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17640 | bits = present ? 0 : PIN_OUT; |
| 17641 | snd_hda_codec_write(codec, 0x14, 0, |
| 17642 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17643 | } |
| 17644 | |
| 17645 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17646 | { |
| 17647 | unsigned int present1, present2; |
| 17648 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17649 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17650 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17651 | |
| 17652 | if (present1 || present2) { |
| 17653 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17654 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17655 | } else { |
| 17656 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17657 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17658 | } |
| 17659 | } |
| 17660 | |
| 17661 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17662 | { |
| 17663 | unsigned int present1, present2; |
| 17664 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17665 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17666 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17667 | |
| 17668 | if (present1 || present2) { |
| 17669 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17670 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17671 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17672 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17673 | } else { |
| 17674 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17675 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17676 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17677 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17678 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17679 | } |
| 17680 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17681 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17682 | { |
| 17683 | unsigned int present1, present2; |
| 17684 | |
| 17685 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17686 | AC_VERB_GET_PIN_SENSE, 0) |
| 17687 | & AC_PINSENSE_PRESENCE; |
| 17688 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17689 | AC_VERB_GET_PIN_SENSE, 0) |
| 17690 | & AC_PINSENSE_PRESENCE; |
| 17691 | |
| 17692 | if (present1 || present2) { |
| 17693 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17694 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17695 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17696 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17697 | } else { |
| 17698 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17699 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17700 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17701 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17702 | } |
| 17703 | } |
| 17704 | |
| 17705 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17706 | { |
| 17707 | unsigned int present1, present2; |
| 17708 | |
| 17709 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17710 | AC_VERB_GET_PIN_SENSE, 0) |
| 17711 | & AC_PINSENSE_PRESENCE; |
| 17712 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17713 | AC_VERB_GET_PIN_SENSE, 0) |
| 17714 | & AC_PINSENSE_PRESENCE; |
| 17715 | |
| 17716 | if (present1 || present2) { |
| 17717 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17718 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17719 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17720 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17721 | } else { |
| 17722 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17723 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17724 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17725 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17726 | } |
| 17727 | } |
| 17728 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17729 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17730 | unsigned int res) |
| 17731 | { |
| 17732 | switch (res >> 26) { |
| 17733 | case ALC880_HP_EVENT: |
| 17734 | alc663_m51va_speaker_automute(codec); |
| 17735 | break; |
| 17736 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17737 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17738 | break; |
| 17739 | } |
| 17740 | } |
| 17741 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17742 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17743 | { |
| 17744 | struct alc_spec *spec = codec->spec; |
| 17745 | spec->ext_mic.pin = 0x18; |
| 17746 | spec->ext_mic.mux_idx = 0; |
| 17747 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17748 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17749 | spec->auto_mic = 1; |
| 17750 | } |
| 17751 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17752 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17753 | { |
| 17754 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17755 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17756 | } |
| 17757 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17758 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17759 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17760 | |
| 17761 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17762 | { |
| 17763 | struct alc_spec *spec = codec->spec; |
| 17764 | spec->ext_mic.pin = 0x18; |
| 17765 | spec->ext_mic.mux_idx = 0; |
| 17766 | spec->int_mic.pin = 0x19; |
| 17767 | spec->int_mic.mux_idx = 1; |
| 17768 | spec->auto_mic = 1; |
| 17769 | } |
| 17770 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17771 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17772 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17773 | /* ***************** Mode2 ******************************/ |
| 17774 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17775 | unsigned int res) |
| 17776 | { |
| 17777 | switch (res >> 26) { |
| 17778 | case ALC880_HP_EVENT: |
| 17779 | alc662_f5z_speaker_automute(codec); |
| 17780 | break; |
| 17781 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17782 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17783 | break; |
| 17784 | } |
| 17785 | } |
| 17786 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17787 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17788 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17789 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17790 | { |
| 17791 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17792 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17793 | } |
| 17794 | /* ***************** Mode3 ******************************/ |
| 17795 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17796 | unsigned int res) |
| 17797 | { |
| 17798 | switch (res >> 26) { |
| 17799 | case ALC880_HP_EVENT: |
| 17800 | alc663_two_hp_m1_speaker_automute(codec); |
| 17801 | break; |
| 17802 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17803 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17804 | break; |
| 17805 | } |
| 17806 | } |
| 17807 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17808 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17809 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17810 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17811 | { |
| 17812 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17813 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17814 | } |
| 17815 | /* ***************** Mode4 ******************************/ |
| 17816 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17817 | unsigned int res) |
| 17818 | { |
| 17819 | switch (res >> 26) { |
| 17820 | case ALC880_HP_EVENT: |
| 17821 | alc663_21jd_two_speaker_automute(codec); |
| 17822 | break; |
| 17823 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17824 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17825 | break; |
| 17826 | } |
| 17827 | } |
| 17828 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17829 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17830 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17831 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17832 | { |
| 17833 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17834 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17835 | } |
| 17836 | /* ***************** Mode5 ******************************/ |
| 17837 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17838 | unsigned int res) |
| 17839 | { |
| 17840 | switch (res >> 26) { |
| 17841 | case ALC880_HP_EVENT: |
| 17842 | alc663_15jd_two_speaker_automute(codec); |
| 17843 | break; |
| 17844 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17845 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17846 | break; |
| 17847 | } |
| 17848 | } |
| 17849 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17850 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17851 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17852 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17853 | { |
| 17854 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17855 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17856 | } |
| 17857 | /* ***************** Mode6 ******************************/ |
| 17858 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17859 | unsigned int res) |
| 17860 | { |
| 17861 | switch (res >> 26) { |
| 17862 | case ALC880_HP_EVENT: |
| 17863 | alc663_two_hp_m2_speaker_automute(codec); |
| 17864 | break; |
| 17865 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17866 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17867 | break; |
| 17868 | } |
| 17869 | } |
| 17870 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17871 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17872 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17873 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17874 | { |
| 17875 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17876 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17877 | } |
| 17878 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17879 | /* ***************** Mode7 ******************************/ |
| 17880 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17881 | unsigned int res) |
| 17882 | { |
| 17883 | switch (res >> 26) { |
| 17884 | case ALC880_HP_EVENT: |
| 17885 | alc663_two_hp_m7_speaker_automute(codec); |
| 17886 | break; |
| 17887 | case ALC880_MIC_EVENT: |
| 17888 | alc_mic_automute(codec); |
| 17889 | break; |
| 17890 | } |
| 17891 | } |
| 17892 | |
| 17893 | #define alc663_mode7_setup alc663_mode1_setup |
| 17894 | |
| 17895 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17896 | { |
| 17897 | alc663_two_hp_m7_speaker_automute(codec); |
| 17898 | alc_mic_automute(codec); |
| 17899 | } |
| 17900 | |
| 17901 | /* ***************** Mode8 ******************************/ |
| 17902 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17903 | unsigned int res) |
| 17904 | { |
| 17905 | switch (res >> 26) { |
| 17906 | case ALC880_HP_EVENT: |
| 17907 | alc663_two_hp_m8_speaker_automute(codec); |
| 17908 | break; |
| 17909 | case ALC880_MIC_EVENT: |
| 17910 | alc_mic_automute(codec); |
| 17911 | break; |
| 17912 | } |
| 17913 | } |
| 17914 | |
| 17915 | #define alc663_mode8_setup alc663_m51va_setup |
| 17916 | |
| 17917 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17918 | { |
| 17919 | alc663_two_hp_m8_speaker_automute(codec); |
| 17920 | alc_mic_automute(codec); |
| 17921 | } |
| 17922 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17923 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17924 | { |
| 17925 | unsigned int present; |
| 17926 | unsigned char bits; |
| 17927 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17928 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17929 | bits = present ? HDA_AMP_MUTE : 0; |
| 17930 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17931 | HDA_AMP_MUTE, bits); |
| 17932 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17933 | HDA_AMP_MUTE, bits); |
| 17934 | } |
| 17935 | |
| 17936 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17937 | { |
| 17938 | unsigned int present; |
| 17939 | unsigned char bits; |
| 17940 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17941 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17942 | bits = present ? HDA_AMP_MUTE : 0; |
| 17943 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17944 | HDA_AMP_MUTE, bits); |
| 17945 | } |
| 17946 | |
| 17947 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17948 | unsigned int res) |
| 17949 | { |
| 17950 | switch (res >> 26) { |
| 17951 | case ALC880_HP_EVENT: |
| 17952 | alc663_g71v_hp_automute(codec); |
| 17953 | break; |
| 17954 | case ALC880_FRONT_EVENT: |
| 17955 | alc663_g71v_front_automute(codec); |
| 17956 | break; |
| 17957 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17958 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17959 | break; |
| 17960 | } |
| 17961 | } |
| 17962 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17963 | #define alc663_g71v_setup alc663_m51va_setup |
| 17964 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17965 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17966 | { |
| 17967 | alc663_g71v_front_automute(codec); |
| 17968 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17969 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17970 | } |
| 17971 | |
| 17972 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17973 | unsigned int res) |
| 17974 | { |
| 17975 | switch (res >> 26) { |
| 17976 | case ALC880_HP_EVENT: |
| 17977 | alc663_m51va_speaker_automute(codec); |
| 17978 | break; |
| 17979 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17980 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17981 | break; |
| 17982 | } |
| 17983 | } |
| 17984 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17985 | #define alc663_g50v_setup alc663_m51va_setup |
| 17986 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17987 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17988 | { |
| 17989 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17990 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17991 | } |
| 17992 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17993 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17994 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17995 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17996 | |
| 17997 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17998 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17999 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18000 | |
| 18001 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18002 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18003 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18004 | { } /* end */ |
| 18005 | }; |
| 18006 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18007 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18008 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18009 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18010 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18011 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18013 | |
| 18014 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18015 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18016 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18017 | |
| 18018 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18019 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18020 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18021 | { } /* end */ |
| 18022 | }; |
| 18023 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18024 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18025 | #define alc662_loopbacks alc880_loopbacks |
| 18026 | #endif |
| 18027 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18028 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18029 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18030 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18031 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18032 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18033 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18034 | |
| 18035 | /* |
| 18036 | * configuration and preset |
| 18037 | */ |
| 18038 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18039 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18040 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18041 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18042 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18043 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18044 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18045 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18046 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18047 | [ALC663_ASUS_M51VA] = "m51va", |
| 18048 | [ALC663_ASUS_G71V] = "g71v", |
| 18049 | [ALC663_ASUS_H13] = "h13", |
| 18050 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18051 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18052 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18053 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18054 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18055 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18056 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18057 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18058 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18059 | [ALC272_DELL] = "dell", |
| 18060 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18061 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18062 | [ALC662_AUTO] = "auto", |
| 18063 | }; |
| 18064 | |
| 18065 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18066 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18067 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18068 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18069 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18070 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18071 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18072 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18073 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18074 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18075 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18076 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18077 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18078 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18079 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18080 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18081 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18082 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18083 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18084 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18085 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18086 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18087 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18088 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18089 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18090 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18091 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18092 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18093 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18094 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18095 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18096 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18097 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18098 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18099 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18100 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18101 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18102 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18103 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18104 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18105 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18106 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18107 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18108 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18109 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18110 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18111 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18112 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18113 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18114 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18115 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18116 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18117 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18118 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18119 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18120 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18121 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18122 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18123 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18124 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18125 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18126 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18127 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18128 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18129 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18130 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18131 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18132 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18133 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18134 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18135 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18136 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18137 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18138 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18139 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18140 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18141 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18142 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18143 | {} |
| 18144 | }; |
| 18145 | |
| 18146 | static struct alc_config_preset alc662_presets[] = { |
| 18147 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18148 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18149 | .init_verbs = { alc662_init_verbs }, |
| 18150 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18151 | .dac_nids = alc662_dac_nids, |
| 18152 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18153 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18154 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18155 | .channel_mode = alc662_3ST_2ch_modes, |
| 18156 | .input_mux = &alc662_capture_source, |
| 18157 | }, |
| 18158 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18159 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18160 | .init_verbs = { alc662_init_verbs }, |
| 18161 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18162 | .dac_nids = alc662_dac_nids, |
| 18163 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18164 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18165 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18166 | .channel_mode = alc662_3ST_6ch_modes, |
| 18167 | .need_dac_fix = 1, |
| 18168 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18169 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18170 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18171 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18172 | .init_verbs = { alc662_init_verbs }, |
| 18173 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18174 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18175 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18176 | .channel_mode = alc662_3ST_6ch_modes, |
| 18177 | .need_dac_fix = 1, |
| 18178 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18179 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18180 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18181 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18182 | .init_verbs = { alc662_init_verbs }, |
| 18183 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18184 | .dac_nids = alc662_dac_nids, |
| 18185 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18186 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18187 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18188 | .channel_mode = alc662_5stack_modes, |
| 18189 | .input_mux = &alc662_capture_source, |
| 18190 | }, |
| 18191 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18192 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18193 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18194 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18195 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18196 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18197 | .channel_mode = alc662_3ST_2ch_modes, |
| 18198 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18199 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18200 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18201 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18202 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18203 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18204 | .init_verbs = { alc662_init_verbs, |
| 18205 | alc662_eeepc_sue_init_verbs }, |
| 18206 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18207 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18208 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18209 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18210 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18211 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18212 | .init_hook = alc662_eeepc_inithook, |
| 18213 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18214 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18215 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18216 | alc662_chmode_mixer }, |
| 18217 | .init_verbs = { alc662_init_verbs, |
| 18218 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18219 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18220 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18221 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18222 | .channel_mode = alc662_3ST_6ch_modes, |
| 18223 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18224 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18225 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18226 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18227 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18228 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18229 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18230 | .init_verbs = { alc662_init_verbs, |
| 18231 | alc662_ecs_init_verbs }, |
| 18232 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18233 | .dac_nids = alc662_dac_nids, |
| 18234 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18235 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18236 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18237 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18238 | .init_hook = alc662_eeepc_inithook, |
| 18239 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18240 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18241 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18242 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18243 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18244 | .dac_nids = alc662_dac_nids, |
| 18245 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18246 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18247 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18248 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18249 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18250 | .init_hook = alc663_m51va_inithook, |
| 18251 | }, |
| 18252 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18253 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18254 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18255 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18256 | .dac_nids = alc662_dac_nids, |
| 18257 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18258 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18259 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18260 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18261 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18262 | .init_hook = alc663_g71v_inithook, |
| 18263 | }, |
| 18264 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18265 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18266 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18267 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18268 | .dac_nids = alc662_dac_nids, |
| 18269 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18270 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18271 | .unsol_event = alc663_m51va_unsol_event, |
| 18272 | .init_hook = alc663_m51va_inithook, |
| 18273 | }, |
| 18274 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18275 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18276 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18277 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18278 | .dac_nids = alc662_dac_nids, |
| 18279 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18280 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18281 | .channel_mode = alc662_3ST_6ch_modes, |
| 18282 | .input_mux = &alc663_capture_source, |
| 18283 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18284 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18285 | .init_hook = alc663_g50v_inithook, |
| 18286 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18287 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18288 | .mixers = { alc663_m51va_mixer }, |
| 18289 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18290 | .init_verbs = { alc662_init_verbs, |
| 18291 | alc663_21jd_amic_init_verbs }, |
| 18292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18293 | .hp_nid = 0x03, |
| 18294 | .dac_nids = alc662_dac_nids, |
| 18295 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18296 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18297 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18298 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18299 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18300 | .init_hook = alc663_mode1_inithook, |
| 18301 | }, |
| 18302 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18303 | .mixers = { alc662_1bjd_mixer }, |
| 18304 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18305 | .init_verbs = { alc662_init_verbs, |
| 18306 | alc662_1bjd_amic_init_verbs }, |
| 18307 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18308 | .dac_nids = alc662_dac_nids, |
| 18309 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18310 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18311 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18312 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18313 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18314 | .init_hook = alc662_mode2_inithook, |
| 18315 | }, |
| 18316 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18317 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18318 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18319 | .init_verbs = { alc662_init_verbs, |
| 18320 | alc663_two_hp_amic_m1_init_verbs }, |
| 18321 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18322 | .hp_nid = 0x03, |
| 18323 | .dac_nids = alc662_dac_nids, |
| 18324 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18325 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18326 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18327 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18328 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18329 | .init_hook = alc663_mode3_inithook, |
| 18330 | }, |
| 18331 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18332 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18333 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18334 | .init_verbs = { alc662_init_verbs, |
| 18335 | alc663_21jd_amic_init_verbs}, |
| 18336 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18337 | .hp_nid = 0x03, |
| 18338 | .dac_nids = alc662_dac_nids, |
| 18339 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18340 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18341 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18342 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18343 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18344 | .init_hook = alc663_mode4_inithook, |
| 18345 | }, |
| 18346 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18347 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18348 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18349 | .init_verbs = { alc662_init_verbs, |
| 18350 | alc663_15jd_amic_init_verbs }, |
| 18351 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18352 | .hp_nid = 0x03, |
| 18353 | .dac_nids = alc662_dac_nids, |
| 18354 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18355 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18356 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18357 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18358 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18359 | .init_hook = alc663_mode5_inithook, |
| 18360 | }, |
| 18361 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18362 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18363 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18364 | .init_verbs = { alc662_init_verbs, |
| 18365 | alc663_two_hp_amic_m2_init_verbs }, |
| 18366 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18367 | .hp_nid = 0x03, |
| 18368 | .dac_nids = alc662_dac_nids, |
| 18369 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18370 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18371 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18372 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18373 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18374 | .init_hook = alc663_mode6_inithook, |
| 18375 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18376 | [ALC663_ASUS_MODE7] = { |
| 18377 | .mixers = { alc663_mode7_mixer }, |
| 18378 | .cap_mixer = alc662_auto_capture_mixer, |
| 18379 | .init_verbs = { alc662_init_verbs, |
| 18380 | alc663_mode7_init_verbs }, |
| 18381 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18382 | .hp_nid = 0x03, |
| 18383 | .dac_nids = alc662_dac_nids, |
| 18384 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18385 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18386 | .channel_mode = alc662_3ST_2ch_modes, |
| 18387 | .unsol_event = alc663_mode7_unsol_event, |
| 18388 | .setup = alc663_mode7_setup, |
| 18389 | .init_hook = alc663_mode7_inithook, |
| 18390 | }, |
| 18391 | [ALC663_ASUS_MODE8] = { |
| 18392 | .mixers = { alc663_mode8_mixer }, |
| 18393 | .cap_mixer = alc662_auto_capture_mixer, |
| 18394 | .init_verbs = { alc662_init_verbs, |
| 18395 | alc663_mode8_init_verbs }, |
| 18396 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18397 | .hp_nid = 0x03, |
| 18398 | .dac_nids = alc662_dac_nids, |
| 18399 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18400 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18401 | .channel_mode = alc662_3ST_2ch_modes, |
| 18402 | .unsol_event = alc663_mode8_unsol_event, |
| 18403 | .setup = alc663_mode8_setup, |
| 18404 | .init_hook = alc663_mode8_inithook, |
| 18405 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18406 | [ALC272_DELL] = { |
| 18407 | .mixers = { alc663_m51va_mixer }, |
| 18408 | .cap_mixer = alc272_auto_capture_mixer, |
| 18409 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18410 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18411 | .dac_nids = alc662_dac_nids, |
| 18412 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18413 | .adc_nids = alc272_adc_nids, |
| 18414 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18415 | .capsrc_nids = alc272_capsrc_nids, |
| 18416 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18417 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18418 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18419 | .init_hook = alc663_m51va_inithook, |
| 18420 | }, |
| 18421 | [ALC272_DELL_ZM1] = { |
| 18422 | .mixers = { alc663_m51va_mixer }, |
| 18423 | .cap_mixer = alc662_auto_capture_mixer, |
| 18424 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18425 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18426 | .dac_nids = alc662_dac_nids, |
| 18427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18428 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18429 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18430 | .capsrc_nids = alc662_capsrc_nids, |
| 18431 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18432 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18433 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18434 | .init_hook = alc663_m51va_inithook, |
| 18435 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18436 | [ALC272_SAMSUNG_NC10] = { |
| 18437 | .mixers = { alc272_nc10_mixer }, |
| 18438 | .init_verbs = { alc662_init_verbs, |
| 18439 | alc663_21jd_amic_init_verbs }, |
| 18440 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18441 | .dac_nids = alc272_dac_nids, |
| 18442 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18443 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18444 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18445 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18446 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18447 | .init_hook = alc663_mode4_inithook, |
| 18448 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18449 | }; |
| 18450 | |
| 18451 | |
| 18452 | /* |
| 18453 | * BIOS auto configuration |
| 18454 | */ |
| 18455 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18456 | /* convert from MIX nid to DAC */ |
| 18457 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18458 | { |
| 18459 | if (nid == 0x0f) |
| 18460 | return 0x02; |
| 18461 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18462 | return nid - 0x0c + 0x02; |
| 18463 | else |
| 18464 | return 0; |
| 18465 | } |
| 18466 | |
| 18467 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18468 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18469 | hda_nid_t dac) |
| 18470 | { |
| 18471 | hda_nid_t mix[4]; |
| 18472 | int i, num; |
| 18473 | |
| 18474 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18475 | for (i = 0; i < num; i++) { |
| 18476 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18477 | return mix[i]; |
| 18478 | } |
| 18479 | return 0; |
| 18480 | } |
| 18481 | |
| 18482 | /* look for an empty DAC slot */ |
| 18483 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18484 | { |
| 18485 | struct alc_spec *spec = codec->spec; |
| 18486 | hda_nid_t srcs[5]; |
| 18487 | int i, j, num; |
| 18488 | |
| 18489 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18490 | if (num < 0) |
| 18491 | return 0; |
| 18492 | for (i = 0; i < num; i++) { |
| 18493 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18494 | if (!nid) |
| 18495 | continue; |
| 18496 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18497 | if (spec->multiout.dac_nids[j] == nid) |
| 18498 | break; |
| 18499 | if (j >= spec->multiout.num_dacs) |
| 18500 | return nid; |
| 18501 | } |
| 18502 | return 0; |
| 18503 | } |
| 18504 | |
| 18505 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18506 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18507 | const struct auto_pin_cfg *cfg) |
| 18508 | { |
| 18509 | struct alc_spec *spec = codec->spec; |
| 18510 | int i; |
| 18511 | hda_nid_t dac; |
| 18512 | |
| 18513 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18514 | for (i = 0; i < cfg->line_outs; i++) { |
| 18515 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18516 | if (!dac) |
| 18517 | continue; |
| 18518 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18519 | } |
| 18520 | return 0; |
| 18521 | } |
| 18522 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18523 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18524 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18525 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18526 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18527 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18528 | } |
| 18529 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18530 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18531 | hda_nid_t nid, unsigned int chs) |
| 18532 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18533 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18534 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18535 | } |
| 18536 | |
| 18537 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18538 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18539 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18540 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18541 | |
| 18542 | /* add playback controls from the parsed DAC table */ |
| 18543 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18544 | const struct auto_pin_cfg *cfg) |
| 18545 | { |
| 18546 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18547 | static const char *chname[4] = { |
| 18548 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18549 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18550 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18551 | int i, err; |
| 18552 | |
| 18553 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18554 | nid = spec->multiout.dac_nids[i]; |
| 18555 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18556 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18557 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18558 | if (!mix) |
| 18559 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18560 | if (i == 2) { |
| 18561 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18562 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18563 | if (err < 0) |
| 18564 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18565 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18566 | if (err < 0) |
| 18567 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18568 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18569 | if (err < 0) |
| 18570 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18571 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18572 | if (err < 0) |
| 18573 | return err; |
| 18574 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18575 | const char *pfx; |
| 18576 | if (cfg->line_outs == 1 && |
| 18577 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18578 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18579 | pfx = "Speaker"; |
| 18580 | else |
| 18581 | pfx = "PCM"; |
| 18582 | } else |
| 18583 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18584 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18585 | if (err < 0) |
| 18586 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18587 | if (cfg->line_outs == 1 && |
| 18588 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18589 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18590 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18591 | if (err < 0) |
| 18592 | return err; |
| 18593 | } |
| 18594 | } |
| 18595 | return 0; |
| 18596 | } |
| 18597 | |
| 18598 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18599 | /* return DAC nid if any new DAC is assigned */ |
| 18600 | 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] | 18601 | const char *pfx) |
| 18602 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18603 | struct alc_spec *spec = codec->spec; |
| 18604 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18605 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18606 | |
| 18607 | if (!pin) |
| 18608 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18609 | nid = alc662_look_for_dac(codec, pin); |
| 18610 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18611 | /* the corresponding DAC is already occupied */ |
| 18612 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18613 | return 0; /* no way */ |
| 18614 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18615 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18616 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18617 | } |
| 18618 | |
| 18619 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18620 | if (!mix) |
| 18621 | return 0; |
| 18622 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18623 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18624 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18625 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18626 | if (err < 0) |
| 18627 | return err; |
| 18628 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18629 | } |
| 18630 | |
| 18631 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18632 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18633 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18634 | |
| 18635 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18636 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18637 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18638 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18639 | int i, num; |
| 18640 | hda_nid_t srcs[4]; |
| 18641 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18642 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18643 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18644 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18645 | if (num <= 1) |
| 18646 | return; |
| 18647 | for (i = 0; i < num; i++) { |
| 18648 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18649 | continue; |
| 18650 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18651 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18652 | } |
| 18653 | } |
| 18654 | |
| 18655 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18656 | { |
| 18657 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18658 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18659 | int i; |
| 18660 | |
| 18661 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18662 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18663 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18664 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18665 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18666 | } |
| 18667 | } |
| 18668 | |
| 18669 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18670 | { |
| 18671 | struct alc_spec *spec = codec->spec; |
| 18672 | hda_nid_t pin; |
| 18673 | |
| 18674 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18675 | if (pin) |
| 18676 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18677 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18678 | pin = spec->autocfg.speaker_pins[0]; |
| 18679 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18680 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18681 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18682 | } |
| 18683 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18684 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18685 | |
| 18686 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18687 | { |
| 18688 | struct alc_spec *spec = codec->spec; |
| 18689 | int i; |
| 18690 | |
| 18691 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18692 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18693 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18694 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18695 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18696 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18697 | snd_hda_codec_write(codec, nid, 0, |
| 18698 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18699 | AMP_OUT_MUTE); |
| 18700 | } |
| 18701 | } |
| 18702 | } |
| 18703 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18704 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18705 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18706 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18707 | { |
| 18708 | struct alc_spec *spec = codec->spec; |
| 18709 | int err; |
| 18710 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18711 | |
| 18712 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18713 | alc662_ignore); |
| 18714 | if (err < 0) |
| 18715 | return err; |
| 18716 | if (!spec->autocfg.line_outs) |
| 18717 | return 0; /* can't find valid BIOS pin config */ |
| 18718 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18719 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18720 | if (err < 0) |
| 18721 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18722 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18723 | if (err < 0) |
| 18724 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18725 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18726 | spec->autocfg.speaker_pins[0], |
| 18727 | "Speaker"); |
| 18728 | if (err < 0) |
| 18729 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18730 | if (err) |
| 18731 | spec->multiout.extra_out_nid[0] = err; |
| 18732 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18733 | "Headphone"); |
| 18734 | if (err < 0) |
| 18735 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18736 | if (err) |
| 18737 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18738 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18739 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18740 | return err; |
| 18741 | |
| 18742 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18743 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18744 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18745 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18746 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18747 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18748 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18749 | |
| 18750 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18751 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18752 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18753 | add_verb(spec, alc662_init_verbs); |
| 18754 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18755 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18756 | add_verb(spec, alc663_init_verbs); |
| 18757 | |
| 18758 | if (codec->vendor_id == 0x10ec0272) |
| 18759 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18760 | |
| 18761 | err = alc_auto_add_mic_boost(codec); |
| 18762 | if (err < 0) |
| 18763 | return err; |
| 18764 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18765 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18766 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18767 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18768 | else |
| 18769 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18770 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18771 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18772 | } |
| 18773 | |
| 18774 | /* additional initialization for auto-configuration model */ |
| 18775 | static void alc662_auto_init(struct hda_codec *codec) |
| 18776 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18777 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18778 | alc662_auto_init_multi_out(codec); |
| 18779 | alc662_auto_init_hp_out(codec); |
| 18780 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18781 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18782 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18783 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18784 | } |
| 18785 | |
| 18786 | static int patch_alc662(struct hda_codec *codec) |
| 18787 | { |
| 18788 | struct alc_spec *spec; |
| 18789 | int err, board_config; |
| 18790 | |
| 18791 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18792 | if (!spec) |
| 18793 | return -ENOMEM; |
| 18794 | |
| 18795 | codec->spec = spec; |
| 18796 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18797 | alc_auto_parse_customize_define(codec); |
| 18798 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18799 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18800 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18801 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18802 | alc_codec_rename(codec, "ALC661"); |
| 18803 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18804 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18805 | spec->cdefine.platform_type == 1) |
| 18806 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18807 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18808 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18809 | alc662_models, |
| 18810 | alc662_cfg_tbl); |
| 18811 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18812 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18813 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18814 | board_config = ALC662_AUTO; |
| 18815 | } |
| 18816 | |
| 18817 | if (board_config == ALC662_AUTO) { |
| 18818 | /* automatic parse from the BIOS config */ |
| 18819 | err = alc662_parse_auto_config(codec); |
| 18820 | if (err < 0) { |
| 18821 | alc_free(codec); |
| 18822 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18823 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18824 | printk(KERN_INFO |
| 18825 | "hda_codec: Cannot set up configuration " |
| 18826 | "from BIOS. Using base mode...\n"); |
| 18827 | board_config = ALC662_3ST_2ch_DIG; |
| 18828 | } |
| 18829 | } |
| 18830 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18831 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18832 | if (err < 0) { |
| 18833 | alc_free(codec); |
| 18834 | return err; |
| 18835 | } |
| 18836 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18837 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18838 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18839 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18840 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18841 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18842 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18843 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18844 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18845 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18846 | if (!spec->adc_nids) { |
| 18847 | spec->adc_nids = alc662_adc_nids; |
| 18848 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18849 | } |
| 18850 | if (!spec->capsrc_nids) |
| 18851 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18852 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18853 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18854 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18855 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18856 | if (spec->cdefine.enable_pcbeep) { |
| 18857 | switch (codec->vendor_id) { |
| 18858 | case 0x10ec0662: |
| 18859 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18860 | break; |
| 18861 | case 0x10ec0272: |
| 18862 | case 0x10ec0663: |
| 18863 | case 0x10ec0665: |
| 18864 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18865 | break; |
| 18866 | case 0x10ec0273: |
| 18867 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18868 | break; |
| 18869 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18870 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18871 | spec->vmaster_nid = 0x02; |
| 18872 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18873 | codec->patch_ops = alc_patch_ops; |
| 18874 | if (board_config == ALC662_AUTO) |
| 18875 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18876 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18877 | if (!spec->loopback.amplist) |
| 18878 | spec->loopback.amplist = alc662_loopbacks; |
| 18879 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18880 | |
| 18881 | return 0; |
| 18882 | } |
| 18883 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18884 | static int patch_alc888(struct hda_codec *codec) |
| 18885 | { |
| 18886 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18887 | kfree(codec->chip_name); |
| 18888 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18889 | if (!codec->chip_name) { |
| 18890 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18891 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18892 | } |
| 18893 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18894 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18895 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18896 | } |
| 18897 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18898 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18899 | * ALC680 support |
| 18900 | */ |
| 18901 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 18902 | #define alc680_modes alc260_modes |
| 18903 | |
| 18904 | static hda_nid_t alc680_dac_nids[3] = { |
| 18905 | /* Lout1, Lout2, hp */ |
| 18906 | 0x02, 0x03, 0x04 |
| 18907 | }; |
| 18908 | |
| 18909 | static hda_nid_t alc680_adc_nids[3] = { |
| 18910 | /* ADC0-2 */ |
| 18911 | /* DMIC, MIC, Line-in*/ |
| 18912 | 0x07, 0x08, 0x09 |
| 18913 | }; |
| 18914 | |
| 18915 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 18916 | /* output mixer control */ |
| 18917 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 18918 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18919 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 18920 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 18921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 18922 | { } |
| 18923 | }; |
| 18924 | |
| 18925 | static struct snd_kcontrol_new alc680_capture_mixer[] = { |
| 18926 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 18927 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 18928 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 18929 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 18930 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 18931 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 18932 | { } /* end */ |
| 18933 | }; |
| 18934 | |
| 18935 | /* |
| 18936 | * generic initialization of ADC, input mixers and output mixers |
| 18937 | */ |
| 18938 | static struct hda_verb alc680_init_verbs[] = { |
| 18939 | /* Unmute DAC0-1 and set vol = 0 */ |
| 18940 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18941 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18942 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18943 | |
| 18944 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 18945 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 18946 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 18947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 18948 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 18949 | |
| 18950 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18951 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18952 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18953 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18954 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18955 | { } |
| 18956 | }; |
| 18957 | |
| 18958 | /* create input playback/capture controls for the given pin */ |
| 18959 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 18960 | const char *ctlname, int idx) |
| 18961 | { |
| 18962 | hda_nid_t dac; |
| 18963 | int err; |
| 18964 | |
| 18965 | switch (nid) { |
| 18966 | case 0x14: |
| 18967 | dac = 0x02; |
| 18968 | break; |
| 18969 | case 0x15: |
| 18970 | dac = 0x03; |
| 18971 | break; |
| 18972 | case 0x16: |
| 18973 | dac = 0x04; |
| 18974 | break; |
| 18975 | default: |
| 18976 | return 0; |
| 18977 | } |
| 18978 | if (spec->multiout.dac_nids[0] != dac && |
| 18979 | spec->multiout.dac_nids[1] != dac) { |
| 18980 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 18981 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 18982 | HDA_OUTPUT)); |
| 18983 | if (err < 0) |
| 18984 | return err; |
| 18985 | |
| 18986 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 18987 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 18988 | |
| 18989 | if (err < 0) |
| 18990 | return err; |
| 18991 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18992 | } |
| 18993 | |
| 18994 | return 0; |
| 18995 | } |
| 18996 | |
| 18997 | /* add playback controls from the parsed DAC table */ |
| 18998 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 18999 | const struct auto_pin_cfg *cfg) |
| 19000 | { |
| 19001 | hda_nid_t nid; |
| 19002 | int err; |
| 19003 | |
| 19004 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19005 | |
| 19006 | nid = cfg->line_out_pins[0]; |
| 19007 | if (nid) { |
| 19008 | const char *name; |
| 19009 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19010 | name = "Speaker"; |
| 19011 | else |
| 19012 | name = "Front"; |
| 19013 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19014 | if (err < 0) |
| 19015 | return err; |
| 19016 | } |
| 19017 | |
| 19018 | nid = cfg->speaker_pins[0]; |
| 19019 | if (nid) { |
| 19020 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19021 | if (err < 0) |
| 19022 | return err; |
| 19023 | } |
| 19024 | nid = cfg->hp_pins[0]; |
| 19025 | if (nid) { |
| 19026 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19027 | if (err < 0) |
| 19028 | return err; |
| 19029 | } |
| 19030 | |
| 19031 | return 0; |
| 19032 | } |
| 19033 | |
| 19034 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19035 | hda_nid_t nid, int pin_type) |
| 19036 | { |
| 19037 | alc_set_pin_output(codec, nid, pin_type); |
| 19038 | } |
| 19039 | |
| 19040 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19041 | { |
| 19042 | struct alc_spec *spec = codec->spec; |
| 19043 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19044 | if (nid) { |
| 19045 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19046 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19047 | } |
| 19048 | } |
| 19049 | |
| 19050 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19051 | { |
| 19052 | struct alc_spec *spec = codec->spec; |
| 19053 | hda_nid_t pin; |
| 19054 | |
| 19055 | pin = spec->autocfg.hp_pins[0]; |
| 19056 | if (pin) |
| 19057 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19058 | pin = spec->autocfg.speaker_pins[0]; |
| 19059 | if (pin) |
| 19060 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19061 | } |
| 19062 | |
| 19063 | /* pcm configuration: identical with ALC880 */ |
| 19064 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19065 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19066 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19067 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
| 19068 | |
| 19069 | static struct hda_input_mux alc680_capture_source = { |
| 19070 | .num_items = 1, |
| 19071 | .items = { |
| 19072 | { "Mic", 0x0 }, |
| 19073 | }, |
| 19074 | }; |
| 19075 | |
| 19076 | /* |
| 19077 | * BIOS auto configuration |
| 19078 | */ |
| 19079 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19080 | { |
| 19081 | struct alc_spec *spec = codec->spec; |
| 19082 | int err; |
| 19083 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19084 | |
| 19085 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19086 | alc680_ignore); |
| 19087 | if (err < 0) |
| 19088 | return err; |
| 19089 | if (!spec->autocfg.line_outs) { |
| 19090 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19091 | spec->multiout.max_channels = 2; |
| 19092 | spec->no_analog = 1; |
| 19093 | goto dig_only; |
| 19094 | } |
| 19095 | return 0; /* can't find valid BIOS pin config */ |
| 19096 | } |
| 19097 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19098 | if (err < 0) |
| 19099 | return err; |
| 19100 | |
| 19101 | spec->multiout.max_channels = 2; |
| 19102 | |
| 19103 | dig_only: |
| 19104 | /* digital only support output */ |
| 19105 | if (spec->autocfg.dig_outs) { |
| 19106 | spec->multiout.dig_out_nid = ALC680_DIGOUT_NID; |
| 19107 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 19108 | } |
| 19109 | if (spec->kctls.list) |
| 19110 | add_mixer(spec, spec->kctls.list); |
| 19111 | |
| 19112 | add_verb(spec, alc680_init_verbs); |
| 19113 | spec->num_mux_defs = 1; |
| 19114 | spec->input_mux = &alc680_capture_source; |
| 19115 | |
| 19116 | err = alc_auto_add_mic_boost(codec); |
| 19117 | if (err < 0) |
| 19118 | return err; |
| 19119 | |
| 19120 | return 1; |
| 19121 | } |
| 19122 | |
| 19123 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19124 | |
| 19125 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19126 | static void alc680_auto_init(struct hda_codec *codec) |
| 19127 | { |
| 19128 | struct alc_spec *spec = codec->spec; |
| 19129 | alc680_auto_init_multi_out(codec); |
| 19130 | alc680_auto_init_hp_out(codec); |
| 19131 | alc680_auto_init_analog_input(codec); |
| 19132 | if (spec->unsol_event) |
| 19133 | alc_inithook(codec); |
| 19134 | } |
| 19135 | |
| 19136 | /* |
| 19137 | * configuration and preset |
| 19138 | */ |
| 19139 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19140 | [ALC680_BASE] = "base", |
| 19141 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19142 | }; |
| 19143 | |
| 19144 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19145 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19146 | {} |
| 19147 | }; |
| 19148 | |
| 19149 | static struct alc_config_preset alc680_presets[] = { |
| 19150 | [ALC680_BASE] = { |
| 19151 | .mixers = { alc680_base_mixer }, |
| 19152 | .cap_mixer = alc680_capture_mixer, |
| 19153 | .init_verbs = { alc680_init_verbs }, |
| 19154 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19155 | .dac_nids = alc680_dac_nids, |
| 19156 | .num_adc_nids = ARRAY_SIZE(alc680_adc_nids), |
| 19157 | .adc_nids = alc680_adc_nids, |
| 19158 | .hp_nid = 0x04, |
| 19159 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19160 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19161 | .channel_mode = alc680_modes, |
| 19162 | .input_mux = &alc680_capture_source, |
| 19163 | }, |
| 19164 | }; |
| 19165 | |
| 19166 | static int patch_alc680(struct hda_codec *codec) |
| 19167 | { |
| 19168 | struct alc_spec *spec; |
| 19169 | int board_config; |
| 19170 | int err; |
| 19171 | |
| 19172 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19173 | if (spec == NULL) |
| 19174 | return -ENOMEM; |
| 19175 | |
| 19176 | codec->spec = spec; |
| 19177 | |
| 19178 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19179 | alc680_models, |
| 19180 | alc680_cfg_tbl); |
| 19181 | |
| 19182 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19183 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19184 | codec->chip_name); |
| 19185 | board_config = ALC680_AUTO; |
| 19186 | } |
| 19187 | |
| 19188 | if (board_config == ALC680_AUTO) { |
| 19189 | /* automatic parse from the BIOS config */ |
| 19190 | err = alc680_parse_auto_config(codec); |
| 19191 | if (err < 0) { |
| 19192 | alc_free(codec); |
| 19193 | return err; |
| 19194 | } else if (!err) { |
| 19195 | printk(KERN_INFO |
| 19196 | "hda_codec: Cannot set up configuration " |
| 19197 | "from BIOS. Using base mode...\n"); |
| 19198 | board_config = ALC680_BASE; |
| 19199 | } |
| 19200 | } |
| 19201 | |
| 19202 | if (board_config != ALC680_AUTO) |
| 19203 | setup_preset(codec, &alc680_presets[board_config]); |
| 19204 | |
| 19205 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
| 19206 | spec->stream_analog_capture = &alc680_pcm_analog_capture; |
| 19207 | spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture; |
| 19208 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
| 19209 | |
| 19210 | if (!spec->adc_nids) { |
| 19211 | spec->adc_nids = alc680_adc_nids; |
| 19212 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19213 | } |
| 19214 | |
| 19215 | if (!spec->cap_mixer) |
| 19216 | set_capture_mixer(codec); |
| 19217 | |
| 19218 | spec->vmaster_nid = 0x02; |
| 19219 | |
| 19220 | codec->patch_ops = alc_patch_ops; |
| 19221 | if (board_config == ALC680_AUTO) |
| 19222 | spec->init_hook = alc680_auto_init; |
| 19223 | |
| 19224 | return 0; |
| 19225 | } |
| 19226 | |
| 19227 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19228 | * patch entries |
| 19229 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19230 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19231 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19232 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19233 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19234 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19235 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19236 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19237 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19238 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19239 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19240 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19241 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19242 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19243 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19244 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19245 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19246 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19247 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19248 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19249 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19250 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19251 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19252 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19253 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19254 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19255 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19256 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19257 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19258 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19259 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19260 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19261 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19262 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19263 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19264 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19265 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19266 | {} /* terminator */ |
| 19267 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19268 | |
| 19269 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19270 | |
| 19271 | MODULE_LICENSE("GPL"); |
| 19272 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19273 | |
| 19274 | static struct hda_codec_preset_list realtek_list = { |
| 19275 | .preset = snd_hda_preset_realtek, |
| 19276 | .owner = THIS_MODULE, |
| 19277 | }; |
| 19278 | |
| 19279 | static int __init patch_realtek_init(void) |
| 19280 | { |
| 19281 | return snd_hda_add_codec_preset(&realtek_list); |
| 19282 | } |
| 19283 | |
| 19284 | static void __exit patch_realtek_exit(void) |
| 19285 | { |
| 19286 | snd_hda_delete_codec_preset(&realtek_list); |
| 19287 | } |
| 19288 | |
| 19289 | module_init(patch_realtek_init) |
| 19290 | module_exit(patch_realtek_exit) |