Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 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 | 7cf51e4 | 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 | bab282b | 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 | 4953550 | 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 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 259 | /* for GPIO Poll */ |
| 260 | #define GPIO_MASK 0x03 |
| 261 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 262 | /* extra amp-initialization sequence types */ |
| 263 | enum { |
| 264 | ALC_INIT_NONE, |
| 265 | ALC_INIT_DEFAULT, |
| 266 | ALC_INIT_GPIO1, |
| 267 | ALC_INIT_GPIO2, |
| 268 | ALC_INIT_GPIO3, |
| 269 | }; |
| 270 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 271 | struct alc_mic_route { |
| 272 | hda_nid_t pin; |
| 273 | unsigned char mux_idx; |
| 274 | unsigned char amix_idx; |
| 275 | }; |
| 276 | |
| 277 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 278 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 279 | struct alc_customize_define { |
| 280 | unsigned int sku_cfg; |
| 281 | unsigned char port_connectivity; |
| 282 | unsigned char check_sum; |
| 283 | unsigned char customization; |
| 284 | unsigned char external_amp; |
| 285 | unsigned int enable_pcbeep:1; |
| 286 | unsigned int platform_type:1; |
| 287 | unsigned int swap:1; |
| 288 | unsigned int override:1; |
| 289 | }; |
| 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | struct alc_spec { |
| 292 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 293 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 295 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 296 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 298 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 299 | * don't forget NULL |
| 300 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 301 | */ |
| 302 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 304 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | struct hda_pcm_stream *stream_analog_playback; |
| 306 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 307 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 308 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 310 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | struct hda_pcm_stream *stream_digital_playback; |
| 312 | struct hda_pcm_stream *stream_digital_capture; |
| 313 | |
| 314 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 315 | struct hda_multi_out multiout; /* playback set-up |
| 316 | * max_channels, dacs must be set |
| 317 | * dig_out_nid and hp_nid are optional |
| 318 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 319 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 320 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 321 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* capture */ |
| 324 | unsigned int num_adc_nids; |
| 325 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 326 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 327 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
| 329 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 330 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | const struct hda_input_mux *input_mux; |
| 332 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 333 | struct alc_mic_route ext_mic; |
| 334 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | |
| 336 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 337 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 339 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 340 | int const_channel_count; |
| 341 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | |
| 343 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 344 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 345 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 346 | /* dynamic controls, init_verbs and input_mux */ |
| 347 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 348 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 349 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 350 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 351 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 352 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 353 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 354 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 355 | /* hooks */ |
| 356 | void (*init_hook)(struct hda_codec *codec); |
| 357 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 358 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 359 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 360 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 361 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 362 | /* for pin sensing */ |
| 363 | unsigned int sense_updated: 1; |
| 364 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 365 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 366 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 367 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 368 | /* other flags */ |
| 369 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 370 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 371 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 372 | /* for virtual master */ |
| 373 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 374 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 375 | struct hda_loopback_check loopback; |
| 376 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 377 | |
| 378 | /* for PLL fix */ |
| 379 | hda_nid_t pll_nid; |
| 380 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 381 | }; |
| 382 | |
| 383 | /* |
| 384 | * configuration template - to be copied to the spec instance |
| 385 | */ |
| 386 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 387 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 388 | * with spec |
| 389 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 390 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 391 | const struct hda_verb *init_verbs[5]; |
| 392 | unsigned int num_dacs; |
| 393 | hda_nid_t *dac_nids; |
| 394 | hda_nid_t dig_out_nid; /* optional */ |
| 395 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 396 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 397 | unsigned int num_adc_nids; |
| 398 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 399 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 400 | hda_nid_t dig_in_nid; |
| 401 | unsigned int num_channel_mode; |
| 402 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 403 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 404 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 405 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 406 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 407 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 408 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 409 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 410 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 411 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 412 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 413 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | }; |
| 415 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | |
| 417 | /* |
| 418 | * input MUX handling |
| 419 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 420 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 422 | { |
| 423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 424 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 425 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 426 | if (mux_idx >= spec->num_mux_defs) |
| 427 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 428 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 429 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | } |
| 432 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 433 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 434 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | { |
| 436 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 437 | struct alc_spec *spec = codec->spec; |
| 438 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 439 | |
| 440 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 441 | return 0; |
| 442 | } |
| 443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 444 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 445 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
| 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 448 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 449 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 451 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 452 | hda_nid_t nid = spec->capsrc_nids ? |
| 453 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 454 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 456 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 457 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 458 | if (!imux->num_items && mux_idx > 0) |
| 459 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 460 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 461 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 462 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 463 | /* Matrix-mixer style (e.g. ALC882) */ |
| 464 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 465 | unsigned int i, idx; |
| 466 | |
| 467 | idx = ucontrol->value.enumerated.item[0]; |
| 468 | if (idx >= imux->num_items) |
| 469 | idx = imux->num_items - 1; |
| 470 | if (*cur_val == idx) |
| 471 | return 0; |
| 472 | for (i = 0; i < imux->num_items; i++) { |
| 473 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 474 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 475 | imux->items[i].index, |
| 476 | HDA_AMP_MUTE, v); |
| 477 | } |
| 478 | *cur_val = idx; |
| 479 | return 1; |
| 480 | } else { |
| 481 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 482 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 483 | &spec->cur_mux[adc_idx]); |
| 484 | } |
| 485 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 486 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | /* |
| 488 | * channel mode setting |
| 489 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 490 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 491 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | { |
| 493 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 494 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 495 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 496 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | } |
| 498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 499 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 500 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | { |
| 502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 503 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 504 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 505 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 506 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 507 | } |
| 508 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 509 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 510 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | { |
| 512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 513 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 514 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 515 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 516 | &spec->ext_channel_count); |
| 517 | if (err >= 0 && !spec->const_channel_count) { |
| 518 | spec->multiout.max_channels = spec->ext_channel_count; |
| 519 | if (spec->need_dac_fix) |
| 520 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 521 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 522 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 526 | * 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] | 527 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | * being part of a format specifier. Maximum allowed length of a value is |
| 529 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 530 | * |
| 531 | * Note: some retasking pin complexes seem to ignore requests for input |
| 532 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 533 | * are requested. Therefore order this list so that this behaviour will not |
| 534 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 535 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 536 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 539 | "Mic 50pc bias", "Mic 80pc bias", |
| 540 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 541 | }; |
| 542 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 543 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 544 | }; |
| 545 | /* 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] | 546 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 547 | * addition, "input" pins may or may not process the mic bias option |
| 548 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 549 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 550 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 551 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 552 | #define ALC_PIN_DIR_IN 0x00 |
| 553 | #define ALC_PIN_DIR_OUT 0x01 |
| 554 | #define ALC_PIN_DIR_INOUT 0x02 |
| 555 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 556 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 557 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 558 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 559 | * For each direction the minimum and maximum values are given. |
| 560 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 561 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 563 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 564 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 565 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 566 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 567 | }; |
| 568 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 569 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 570 | #define alc_pin_mode_n_items(_dir) \ |
| 571 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 573 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 574 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 575 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | unsigned int item_num = uinfo->value.enumerated.item; |
| 577 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 578 | |
| 579 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 580 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 582 | |
| 583 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 584 | item_num = alc_pin_mode_min(dir); |
| 585 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 586 | return 0; |
| 587 | } |
| 588 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 589 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 590 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 591 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 593 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 594 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 596 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 598 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 599 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | /* Find enumerated value for current pinctl setting */ |
| 602 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2c | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 603 | 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] | 604 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 605 | *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] | 606 | return 0; |
| 607 | } |
| 608 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 610 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 611 | { |
| 612 | signed int change; |
| 613 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 614 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 615 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 616 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 617 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 618 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 619 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 621 | 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] | 622 | val = alc_pin_mode_min(dir); |
| 623 | |
| 624 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 625 | if (change) { |
| 626 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 627 | snd_hda_codec_write_cache(codec, nid, 0, |
| 628 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 629 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 630 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 631 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 632 | * for the requested pin mode. Enum values of 2 or less are |
| 633 | * input modes. |
| 634 | * |
| 635 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 636 | * reduces noise slightly (particularly on input) so we'll |
| 637 | * do it. However, having both input and output buffers |
| 638 | * enabled simultaneously doesn't seem to be problematic if |
| 639 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 640 | */ |
| 641 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 642 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 643 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 644 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 645 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 646 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 647 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 648 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 649 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 650 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 651 | } |
| 652 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 653 | return change; |
| 654 | } |
| 655 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 656 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 657 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 658 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 659 | .info = alc_pin_mode_info, \ |
| 660 | .get = alc_pin_mode_get, \ |
| 661 | .put = alc_pin_mode_put, \ |
| 662 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 663 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 664 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 665 | * together using a mask with more than one bit set. This control is |
| 666 | * currently used only by the ALC260 test model. At this stage they are not |
| 667 | * needed for any "production" models. |
| 668 | */ |
| 669 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 670 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 672 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 674 | { |
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 676 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 677 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 678 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 680 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 681 | |
| 682 | *valp = (val & mask) != 0; |
| 683 | return 0; |
| 684 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 685 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 686 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 687 | { |
| 688 | signed int change; |
| 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 val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 694 | AC_VERB_GET_GPIO_DATA, |
| 695 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 696 | |
| 697 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 698 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 699 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 700 | gpio_data &= ~mask; |
| 701 | else |
| 702 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 703 | snd_hda_codec_write_cache(codec, nid, 0, |
| 704 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 705 | |
| 706 | return change; |
| 707 | } |
| 708 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 710 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 711 | .info = alc_gpio_data_info, \ |
| 712 | .get = alc_gpio_data_get, \ |
| 713 | .put = alc_gpio_data_put, \ |
| 714 | .private_value = nid | (mask<<16) } |
| 715 | #endif /* CONFIG_SND_DEBUG */ |
| 716 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 717 | /* A switch control to allow the enabling of the digital IO pins on the |
| 718 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 719 | * to provide something in the test model allowing digital outputs to be |
| 720 | * identified if present. If models are found which can utilise these |
| 721 | * outputs a more complete mixer control can be devised for those models if |
| 722 | * necessary. |
| 723 | */ |
| 724 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 725 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 726 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 727 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 728 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 729 | { |
| 730 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 731 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 732 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 733 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 734 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 735 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 736 | |
| 737 | *valp = (val & mask) != 0; |
| 738 | return 0; |
| 739 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 740 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 741 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 742 | { |
| 743 | signed int change; |
| 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 val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | unsigned int ctrl_data = 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, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 750 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 751 | |
| 752 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 753 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 754 | if (val==0) |
| 755 | ctrl_data &= ~mask; |
| 756 | else |
| 757 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 758 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 759 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 760 | |
| 761 | return change; |
| 762 | } |
| 763 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 764 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 765 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 766 | .info = alc_spdif_ctrl_info, \ |
| 767 | .get = alc_spdif_ctrl_get, \ |
| 768 | .put = alc_spdif_ctrl_put, \ |
| 769 | .private_value = nid | (mask<<16) } |
| 770 | #endif /* CONFIG_SND_DEBUG */ |
| 771 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 772 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 773 | * Again, this is only used in the ALC26x test models to help identify when |
| 774 | * the EAPD line must be asserted for features to work. |
| 775 | */ |
| 776 | #ifdef CONFIG_SND_DEBUG |
| 777 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 778 | |
| 779 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 780 | struct snd_ctl_elem_value *ucontrol) |
| 781 | { |
| 782 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 783 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 784 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 785 | long *valp = ucontrol->value.integer.value; |
| 786 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 787 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 788 | |
| 789 | *valp = (val & mask) != 0; |
| 790 | return 0; |
| 791 | } |
| 792 | |
| 793 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 794 | struct snd_ctl_elem_value *ucontrol) |
| 795 | { |
| 796 | int change; |
| 797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 798 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 800 | long val = *ucontrol->value.integer.value; |
| 801 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 802 | AC_VERB_GET_EAPD_BTLENABLE, |
| 803 | 0x00); |
| 804 | |
| 805 | /* Set/unset the masked control bit(s) as needed */ |
| 806 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 807 | if (!val) |
| 808 | ctrl_data &= ~mask; |
| 809 | else |
| 810 | ctrl_data |= mask; |
| 811 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 812 | ctrl_data); |
| 813 | |
| 814 | return change; |
| 815 | } |
| 816 | |
| 817 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 818 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 819 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 820 | .info = alc_eapd_ctrl_info, \ |
| 821 | .get = alc_eapd_ctrl_get, \ |
| 822 | .put = alc_eapd_ctrl_put, \ |
| 823 | .private_value = nid | (mask<<16) } |
| 824 | #endif /* CONFIG_SND_DEBUG */ |
| 825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 826 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 827 | * set up the input pin config (depending on the given auto-pin type) |
| 828 | */ |
| 829 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 830 | int auto_pin_type) |
| 831 | { |
| 832 | unsigned int val = PIN_IN; |
| 833 | |
| 834 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 835 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 836 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 837 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 838 | if (pincap & AC_PINCAP_VREF_80) |
| 839 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 840 | else if (pincap & AC_PINCAP_VREF_50) |
| 841 | val = PIN_VREF50; |
| 842 | else if (pincap & AC_PINCAP_VREF_100) |
| 843 | val = PIN_VREF100; |
| 844 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 845 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 846 | } |
| 847 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 848 | } |
| 849 | |
| 850 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 851 | */ |
| 852 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 853 | { |
| 854 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 855 | return; |
| 856 | spec->mixers[spec->num_mixers++] = mix; |
| 857 | } |
| 858 | |
| 859 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 860 | { |
| 861 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 862 | return; |
| 863 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 864 | } |
| 865 | |
| 866 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 867 | * set up from the preset table |
| 868 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 869 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 870 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 871 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 872 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | int i; |
| 874 | |
| 875 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 876 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 877 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 878 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 879 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 880 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 882 | spec->channel_mode = preset->channel_mode; |
| 883 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 884 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 885 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 886 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 887 | if (preset->const_channel_count) |
| 888 | spec->multiout.max_channels = preset->const_channel_count; |
| 889 | else |
| 890 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 891 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 892 | |
| 893 | spec->multiout.num_dacs = preset->num_dacs; |
| 894 | spec->multiout.dac_nids = preset->dac_nids; |
| 895 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 896 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 897 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 898 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 899 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 900 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 901 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 902 | spec->input_mux = preset->input_mux; |
| 903 | |
| 904 | spec->num_adc_nids = preset->num_adc_nids; |
| 905 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 906 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 907 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 908 | |
| 909 | spec->unsol_event = preset->unsol_event; |
| 910 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 911 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 912 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 913 | spec->loopback.amplist = preset->loopbacks; |
| 914 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 915 | |
| 916 | if (preset->setup) |
| 917 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 918 | } |
| 919 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 920 | /* Enable GPIO mask and set output */ |
| 921 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 925 | { } |
| 926 | }; |
| 927 | |
| 928 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 929 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 930 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 931 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 932 | { } |
| 933 | }; |
| 934 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 935 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 939 | { } |
| 940 | }; |
| 941 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 942 | /* |
| 943 | * Fix hardware PLL issue |
| 944 | * On some codecs, the analog PLL gating control must be off while |
| 945 | * the default value is 1. |
| 946 | */ |
| 947 | static void alc_fix_pll(struct hda_codec *codec) |
| 948 | { |
| 949 | struct alc_spec *spec = codec->spec; |
| 950 | unsigned int val; |
| 951 | |
| 952 | if (!spec->pll_nid) |
| 953 | return; |
| 954 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 955 | spec->pll_coef_idx); |
| 956 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 957 | AC_VERB_GET_PROC_COEF, 0); |
| 958 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 959 | spec->pll_coef_idx); |
| 960 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 961 | val & ~(1 << spec->pll_coef_bit)); |
| 962 | } |
| 963 | |
| 964 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 965 | unsigned int coef_idx, unsigned int coef_bit) |
| 966 | { |
| 967 | struct alc_spec *spec = codec->spec; |
| 968 | spec->pll_nid = nid; |
| 969 | spec->pll_coef_idx = coef_idx; |
| 970 | spec->pll_coef_bit = coef_bit; |
| 971 | alc_fix_pll(codec); |
| 972 | } |
| 973 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 974 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 975 | { |
| 976 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 977 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 978 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 979 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 980 | if (!nid) |
| 981 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 982 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 983 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 984 | nid = spec->autocfg.speaker_pins[i]; |
| 985 | if (!nid) |
| 986 | break; |
| 987 | snd_hda_codec_write(codec, nid, 0, |
| 988 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 989 | spec->jack_present ? 0 : PIN_OUT); |
| 990 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | } |
| 992 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 993 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 994 | hda_nid_t nid) |
| 995 | { |
| 996 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 997 | int i, nums; |
| 998 | |
| 999 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1000 | for (i = 0; i < nums; i++) |
| 1001 | if (conn[i] == nid) |
| 1002 | return i; |
| 1003 | return -1; |
| 1004 | } |
| 1005 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1006 | static void alc_mic_automute(struct hda_codec *codec) |
| 1007 | { |
| 1008 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1009 | struct alc_mic_route *dead, *alive; |
| 1010 | unsigned int present, type; |
| 1011 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1012 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1013 | if (!spec->auto_mic) |
| 1014 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1015 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1016 | return; |
| 1017 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1018 | return; |
| 1019 | |
| 1020 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1021 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1022 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1023 | if (present) { |
| 1024 | alive = &spec->ext_mic; |
| 1025 | dead = &spec->int_mic; |
| 1026 | } else { |
| 1027 | alive = &spec->int_mic; |
| 1028 | dead = &spec->ext_mic; |
| 1029 | } |
| 1030 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1031 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1032 | if (type == AC_WID_AUD_MIX) { |
| 1033 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1034 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1035 | alive->mux_idx, |
| 1036 | HDA_AMP_MUTE, 0); |
| 1037 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1038 | dead->mux_idx, |
| 1039 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1040 | } else { |
| 1041 | /* MUX style (e.g. ALC880) */ |
| 1042 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1043 | AC_VERB_SET_CONNECT_SEL, |
| 1044 | alive->mux_idx); |
| 1045 | } |
| 1046 | |
| 1047 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1048 | } |
| 1049 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1050 | /* unsolicited event for HP jack sensing */ |
| 1051 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1052 | { |
| 1053 | if (codec->vendor_id == 0x10ec0880) |
| 1054 | res >>= 28; |
| 1055 | else |
| 1056 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1057 | switch (res) { |
| 1058 | case ALC880_HP_EVENT: |
| 1059 | alc_automute_pin(codec); |
| 1060 | break; |
| 1061 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1062 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1063 | break; |
| 1064 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1065 | } |
| 1066 | |
| 1067 | static void alc_inithook(struct hda_codec *codec) |
| 1068 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1069 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1070 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1071 | } |
| 1072 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1073 | /* additional initialization for ALC888 variants */ |
| 1074 | static void alc888_coef_init(struct hda_codec *codec) |
| 1075 | { |
| 1076 | unsigned int tmp; |
| 1077 | |
| 1078 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1079 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1080 | 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] | 1081 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1082 | /* alc888S-VC */ |
| 1083 | snd_hda_codec_read(codec, 0x20, 0, |
| 1084 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1085 | else |
| 1086 | /* alc888-VB */ |
| 1087 | snd_hda_codec_read(codec, 0x20, 0, |
| 1088 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1089 | } |
| 1090 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1091 | static void alc889_coef_init(struct hda_codec *codec) |
| 1092 | { |
| 1093 | unsigned int tmp; |
| 1094 | |
| 1095 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1096 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1098 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1099 | } |
| 1100 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1101 | /* turn on/off EAPD control (only if available) */ |
| 1102 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1103 | { |
| 1104 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1105 | return; |
| 1106 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1107 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1108 | on ? 2 : 0); |
| 1109 | } |
| 1110 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1111 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1112 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1113 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1114 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1115 | switch (type) { |
| 1116 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1118 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1120 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1121 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1122 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1123 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1124 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1125 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1126 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1128 | set_eapd(codec, 0x0f, 1); |
| 1129 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | break; |
| 1131 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1132 | case 0x10ec0267: |
| 1133 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1134 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1135 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1136 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1137 | case 0x10ec0660: |
| 1138 | case 0x10ec0662: |
| 1139 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1140 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1141 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1142 | set_eapd(codec, 0x14, 1); |
| 1143 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1144 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1145 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1146 | switch (codec->vendor_id) { |
| 1147 | case 0x10ec0260: |
| 1148 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1149 | AC_VERB_SET_COEF_INDEX, 7); |
| 1150 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1151 | AC_VERB_GET_PROC_COEF, 0); |
| 1152 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1153 | AC_VERB_SET_COEF_INDEX, 7); |
| 1154 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1155 | AC_VERB_SET_PROC_COEF, |
| 1156 | tmp | 0x2010); |
| 1157 | break; |
| 1158 | case 0x10ec0262: |
| 1159 | case 0x10ec0880: |
| 1160 | case 0x10ec0882: |
| 1161 | case 0x10ec0883: |
| 1162 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1163 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1164 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1165 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1166 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1167 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1168 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1169 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1170 | #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] | 1171 | case 0x10ec0267: |
| 1172 | case 0x10ec0268: |
| 1173 | snd_hda_codec_write(codec, 0x20, 0, |
| 1174 | AC_VERB_SET_COEF_INDEX, 7); |
| 1175 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1176 | AC_VERB_GET_PROC_COEF, 0); |
| 1177 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1178 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1179 | snd_hda_codec_write(codec, 0x20, 0, |
| 1180 | AC_VERB_SET_PROC_COEF, |
| 1181 | tmp | 0x3000); |
| 1182 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1183 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1184 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1185 | break; |
| 1186 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1187 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1188 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1189 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1190 | { |
| 1191 | struct alc_spec *spec = codec->spec; |
| 1192 | |
| 1193 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1194 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1195 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1196 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1197 | if (spec->autocfg.line_out_pins[0] && |
| 1198 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1199 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1200 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1201 | else |
| 1202 | return; |
| 1203 | } |
| 1204 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1205 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1206 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1207 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1208 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1209 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1210 | spec->unsol_event = alc_sku_unsol_event; |
| 1211 | } |
| 1212 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1213 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1214 | { |
| 1215 | struct alc_spec *spec = codec->spec; |
| 1216 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1217 | hda_nid_t fixed, ext; |
| 1218 | int i; |
| 1219 | |
| 1220 | /* there must be only two mic inputs exclusively */ |
| 1221 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1222 | if (cfg->input_pins[i]) |
| 1223 | return; |
| 1224 | |
| 1225 | fixed = ext = 0; |
| 1226 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1227 | hda_nid_t nid = cfg->input_pins[i]; |
| 1228 | unsigned int defcfg; |
| 1229 | if (!nid) |
| 1230 | return; |
| 1231 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1232 | switch (get_defcfg_connect(defcfg)) { |
| 1233 | case AC_JACK_PORT_FIXED: |
| 1234 | if (fixed) |
| 1235 | return; /* already occupied */ |
| 1236 | fixed = nid; |
| 1237 | break; |
| 1238 | case AC_JACK_PORT_COMPLEX: |
| 1239 | if (ext) |
| 1240 | return; /* already occupied */ |
| 1241 | ext = nid; |
| 1242 | break; |
| 1243 | default: |
| 1244 | return; /* invalid entry */ |
| 1245 | } |
| 1246 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1247 | if (!ext || !fixed) |
| 1248 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1249 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1250 | return; /* no unsol support */ |
| 1251 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1252 | ext, fixed); |
| 1253 | spec->ext_mic.pin = ext; |
| 1254 | spec->int_mic.pin = fixed; |
| 1255 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1256 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1257 | spec->auto_mic = 1; |
| 1258 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1259 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1260 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1261 | spec->unsol_event = alc_sku_unsol_event; |
| 1262 | } |
| 1263 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1264 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1265 | { |
| 1266 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1267 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1268 | struct alc_spec *spec = codec->spec; |
| 1269 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1270 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1271 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1272 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1273 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1274 | goto do_sku; |
| 1275 | |
| 1276 | nid = 0x1d; |
| 1277 | if (codec->vendor_id == 0x10ec0260) |
| 1278 | nid = 0x17; |
| 1279 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1280 | |
| 1281 | if (!(ass & 1)) { |
| 1282 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1283 | codec->chip_name, ass); |
| 1284 | return -1; |
| 1285 | } |
| 1286 | |
| 1287 | /* check sum */ |
| 1288 | tmp = 0; |
| 1289 | for (i = 1; i < 16; i++) { |
| 1290 | if ((ass >> i) & 1) |
| 1291 | tmp++; |
| 1292 | } |
| 1293 | if (((ass >> 16) & 0xf) != tmp) |
| 1294 | return -1; |
| 1295 | |
| 1296 | spec->cdefine.port_connectivity = ass >> 30; |
| 1297 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1298 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1299 | spec->cdefine.customization = ass >> 8; |
| 1300 | do_sku: |
| 1301 | spec->cdefine.sku_cfg = ass; |
| 1302 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1303 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1304 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1305 | spec->cdefine.override = ass & 0x1; |
| 1306 | |
| 1307 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1308 | nid, spec->cdefine.sku_cfg); |
| 1309 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1310 | spec->cdefine.port_connectivity); |
| 1311 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1312 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1313 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1314 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1315 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1316 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1317 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1318 | |
| 1319 | return 0; |
| 1320 | } |
| 1321 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1322 | /* check subsystem ID and set up device-specific initialization; |
| 1323 | * return 1 if initialized, 0 if invalid SSID |
| 1324 | */ |
| 1325 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1326 | * 31 ~ 16 : Manufacture ID |
| 1327 | * 15 ~ 8 : SKU ID |
| 1328 | * 7 ~ 0 : Assembly ID |
| 1329 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1330 | */ |
| 1331 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1332 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1333 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1334 | { |
| 1335 | unsigned int ass, tmp, i; |
| 1336 | unsigned nid; |
| 1337 | struct alc_spec *spec = codec->spec; |
| 1338 | |
| 1339 | ass = codec->subsystem_id & 0xffff; |
| 1340 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1341 | goto do_sku; |
| 1342 | |
| 1343 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1344 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1345 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | * 29~21 : reserve |
| 1347 | * 20 : PCBEEP input |
| 1348 | * 19~16 : Check sum (15:1) |
| 1349 | * 15~1 : Custom |
| 1350 | * 0 : override |
| 1351 | */ |
| 1352 | nid = 0x1d; |
| 1353 | if (codec->vendor_id == 0x10ec0260) |
| 1354 | nid = 0x17; |
| 1355 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1356 | snd_printd("realtek: No valid SSID, " |
| 1357 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1358 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1359 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1360 | return 0; |
| 1361 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1362 | return 0; |
| 1363 | |
| 1364 | /* check sum */ |
| 1365 | tmp = 0; |
| 1366 | for (i = 1; i < 16; i++) { |
| 1367 | if ((ass >> i) & 1) |
| 1368 | tmp++; |
| 1369 | } |
| 1370 | if (((ass >> 16) & 0xf) != tmp) |
| 1371 | return 0; |
| 1372 | do_sku: |
| 1373 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1374 | ass & 0xffff, codec->vendor_id); |
| 1375 | /* |
| 1376 | * 0 : override |
| 1377 | * 1 : Swap Jack |
| 1378 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1379 | * 3~5 : External Amplifier control |
| 1380 | * 7~6 : Reserved |
| 1381 | */ |
| 1382 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1383 | switch (tmp) { |
| 1384 | case 1: |
| 1385 | spec->init_amp = ALC_INIT_GPIO1; |
| 1386 | break; |
| 1387 | case 3: |
| 1388 | spec->init_amp = ALC_INIT_GPIO2; |
| 1389 | break; |
| 1390 | case 7: |
| 1391 | spec->init_amp = ALC_INIT_GPIO3; |
| 1392 | break; |
| 1393 | case 5: |
| 1394 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1395 | break; |
| 1396 | } |
| 1397 | |
| 1398 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1399 | * when the external headphone out jack is plugged" |
| 1400 | */ |
| 1401 | if (!(ass & 0x8000)) |
| 1402 | return 1; |
| 1403 | /* |
| 1404 | * 10~8 : Jack location |
| 1405 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1406 | * 14~13: Resvered |
| 1407 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1408 | * when the external headphone out jack is plugged" |
| 1409 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1410 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1411 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1412 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1413 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1414 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1415 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1416 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1417 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1418 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1419 | else if (tmp == 3) |
| 1420 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1421 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1422 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1423 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1424 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1425 | return 1; |
| 1426 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1427 | } |
| 1428 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1429 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1430 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1431 | return 1; |
| 1432 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1433 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1434 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1435 | hda_nid_t porta, hda_nid_t porte, |
| 1436 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1437 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1438 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1439 | struct alc_spec *spec = codec->spec; |
| 1440 | snd_printd("realtek: " |
| 1441 | "Enable default setup for auto mode as fallback\n"); |
| 1442 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1443 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1444 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1445 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1446 | } |
| 1447 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1448 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1449 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1450 | */ |
| 1451 | |
| 1452 | struct alc_pincfg { |
| 1453 | hda_nid_t nid; |
| 1454 | u32 val; |
| 1455 | }; |
| 1456 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1457 | struct alc_fixup { |
| 1458 | const struct alc_pincfg *pins; |
| 1459 | const struct hda_verb *verbs; |
| 1460 | }; |
| 1461 | |
| 1462 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1463 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1464 | const struct alc_fixup *fix, |
| 1465 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1466 | { |
| 1467 | const struct alc_pincfg *cfg; |
| 1468 | |
| 1469 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1470 | if (!quirk) |
| 1471 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1472 | fix += quirk->value; |
| 1473 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1474 | if (pre_init && cfg) { |
| 1475 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1476 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1477 | codec->chip_name, quirk->name); |
| 1478 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1479 | for (; cfg->nid; cfg++) |
| 1480 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1481 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1482 | if (!pre_init && fix->verbs) { |
| 1483 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1484 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1485 | codec->chip_name, quirk->name); |
| 1486 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1487 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1488 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1489 | } |
| 1490 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1491 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1492 | unsigned int coef_idx) |
| 1493 | { |
| 1494 | unsigned int val; |
| 1495 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1496 | coef_idx); |
| 1497 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1498 | AC_VERB_GET_PROC_COEF, 0); |
| 1499 | return val; |
| 1500 | } |
| 1501 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1502 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1503 | * ALC888 |
| 1504 | */ |
| 1505 | |
| 1506 | /* |
| 1507 | * 2ch mode |
| 1508 | */ |
| 1509 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1510 | /* Mic-in jack as mic in */ |
| 1511 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1512 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1513 | /* Line-in jack as Line in */ |
| 1514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1516 | /* Line-Out as Front */ |
| 1517 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1518 | { } /* end */ |
| 1519 | }; |
| 1520 | |
| 1521 | /* |
| 1522 | * 4ch mode |
| 1523 | */ |
| 1524 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1525 | /* Mic-in jack as mic in */ |
| 1526 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1527 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1528 | /* Line-in jack as Surround */ |
| 1529 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1530 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1531 | /* Line-Out as Front */ |
| 1532 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1533 | { } /* end */ |
| 1534 | }; |
| 1535 | |
| 1536 | /* |
| 1537 | * 6ch mode |
| 1538 | */ |
| 1539 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1540 | /* Mic-in jack as CLFE */ |
| 1541 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1542 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1543 | /* Line-in jack as Surround */ |
| 1544 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1545 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1546 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1547 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1548 | { } /* end */ |
| 1549 | }; |
| 1550 | |
| 1551 | /* |
| 1552 | * 8ch mode |
| 1553 | */ |
| 1554 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1555 | /* Mic-in jack as CLFE */ |
| 1556 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1557 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1558 | /* Line-in jack as Surround */ |
| 1559 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1560 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1561 | /* Line-Out as Side */ |
| 1562 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1563 | { } /* end */ |
| 1564 | }; |
| 1565 | |
| 1566 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1567 | { 2, alc888_4ST_ch2_intel_init }, |
| 1568 | { 4, alc888_4ST_ch4_intel_init }, |
| 1569 | { 6, alc888_4ST_ch6_intel_init }, |
| 1570 | { 8, alc888_4ST_ch8_intel_init }, |
| 1571 | }; |
| 1572 | |
| 1573 | /* |
| 1574 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1575 | */ |
| 1576 | |
| 1577 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1578 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1579 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1580 | /* Connect Internal HP to Front */ |
| 1581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1583 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1584 | /* Connect Bass HP to Front */ |
| 1585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1587 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1588 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1589 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1590 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1591 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1592 | /* Connect Mic jack to CLFE */ |
| 1593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1595 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1596 | /* Connect Line-in jack to Surround */ |
| 1597 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1599 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1600 | /* Connect HP out jack to Front */ |
| 1601 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1602 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1603 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1604 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1605 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1606 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1607 | {} |
| 1608 | }; |
| 1609 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1610 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1611 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1612 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1613 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1614 | hda_nid_t nid; |
| 1615 | int i; |
| 1616 | |
| 1617 | spec->jack_present = 0; |
| 1618 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1619 | nid = spec->autocfg.hp_pins[i]; |
| 1620 | if (!nid) |
| 1621 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1622 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1623 | spec->jack_present = 1; |
| 1624 | break; |
| 1625 | } |
| 1626 | } |
| 1627 | |
| 1628 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1629 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1630 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1631 | nid = spec->autocfg.speaker_pins[i]; |
| 1632 | if (!nid) |
| 1633 | break; |
| 1634 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1635 | HDA_AMP_MUTE, mute); |
| 1636 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1637 | } |
| 1638 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1639 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1640 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1641 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1642 | if (codec->vendor_id == 0x10ec0880) |
| 1643 | res >>= 28; |
| 1644 | else |
| 1645 | res >>= 26; |
| 1646 | if (res == ALC880_HP_EVENT) |
| 1647 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1648 | } |
| 1649 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1650 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1651 | { |
| 1652 | struct alc_spec *spec = codec->spec; |
| 1653 | |
| 1654 | spec->autocfg.hp_pins[0] = 0x15; |
| 1655 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1656 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1657 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1658 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1659 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1660 | } |
| 1661 | |
| 1662 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1663 | { |
| 1664 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1665 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1666 | } |
| 1667 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1668 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1669 | { |
| 1670 | struct alc_spec *spec = codec->spec; |
| 1671 | |
| 1672 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1673 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1674 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1675 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1676 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1677 | |
| 1678 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1679 | * ALC888 Acer Aspire 4930G model |
| 1680 | */ |
| 1681 | |
| 1682 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1683 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1684 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1685 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1687 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1688 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1689 | /* Connect Internal HP to front */ |
| 1690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1693 | /* Connect HP out to front */ |
| 1694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1696 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1697 | { } |
| 1698 | }; |
| 1699 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1700 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1701 | * ALC888 Acer Aspire 6530G model |
| 1702 | */ |
| 1703 | |
| 1704 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1705 | /* Route to built-in subwoofer as well as speakers */ |
| 1706 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1710 | /* Bias voltage on for external mic port */ |
| 1711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1712 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1714 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1716 | /* Enable unsolicited event for HP jack */ |
| 1717 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1718 | /* Enable speaker output */ |
| 1719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1720 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1721 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1722 | /* Enable headphone output */ |
| 1723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1725 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1726 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1727 | { } |
| 1728 | }; |
| 1729 | |
| 1730 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1731 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1732 | */ |
| 1733 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1734 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1735 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1736 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1737 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1739 | /* Enable unsolicited event for HP jack */ |
| 1740 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1741 | /* Connect Internal Front to Front */ |
| 1742 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1744 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1745 | /* Connect Internal Rear to Rear */ |
| 1746 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1747 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1748 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1749 | /* Connect Internal CLFE to CLFE */ |
| 1750 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1752 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1753 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1757 | /* Enable all DACs */ |
| 1758 | /* DAC DISABLE/MUTE 1? */ |
| 1759 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1760 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1761 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1762 | /* DAC DISABLE/MUTE 2? */ |
| 1763 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1764 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1765 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1766 | /* DMIC fix |
| 1767 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1768 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1769 | * makes the signal become a difference/sum signal instead of standard |
| 1770 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1771 | * codec replicate the sum signal to both channels, turning it into a |
| 1772 | * normal mono mic. |
| 1773 | */ |
| 1774 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1775 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1776 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1777 | { } |
| 1778 | }; |
| 1779 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1780 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1781 | /* Front mic only available on one ADC */ |
| 1782 | { |
| 1783 | .num_items = 4, |
| 1784 | .items = { |
| 1785 | { "Mic", 0x0 }, |
| 1786 | { "Line", 0x2 }, |
| 1787 | { "CD", 0x4 }, |
| 1788 | { "Front Mic", 0xb }, |
| 1789 | }, |
| 1790 | }, |
| 1791 | { |
| 1792 | .num_items = 3, |
| 1793 | .items = { |
| 1794 | { "Mic", 0x0 }, |
| 1795 | { "Line", 0x2 }, |
| 1796 | { "CD", 0x4 }, |
| 1797 | }, |
| 1798 | } |
| 1799 | }; |
| 1800 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1801 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1802 | /* Interal mic only available on one ADC */ |
| 1803 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1804 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1805 | .items = { |
| 1806 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1807 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1808 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1809 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1810 | { "Int Mic", 0xb }, |
| 1811 | }, |
| 1812 | }, |
| 1813 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1814 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1815 | .items = { |
| 1816 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1817 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1818 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1819 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1820 | }, |
| 1821 | } |
| 1822 | }; |
| 1823 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1824 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1825 | /* Digital mic only available on first "ADC" */ |
| 1826 | { |
| 1827 | .num_items = 5, |
| 1828 | .items = { |
| 1829 | { "Mic", 0x0 }, |
| 1830 | { "Line", 0x2 }, |
| 1831 | { "CD", 0x4 }, |
| 1832 | { "Front Mic", 0xb }, |
| 1833 | { "Input Mix", 0xa }, |
| 1834 | }, |
| 1835 | }, |
| 1836 | { |
| 1837 | .num_items = 4, |
| 1838 | .items = { |
| 1839 | { "Mic", 0x0 }, |
| 1840 | { "Line", 0x2 }, |
| 1841 | { "CD", 0x4 }, |
| 1842 | { "Input Mix", 0xa }, |
| 1843 | }, |
| 1844 | }, |
| 1845 | { |
| 1846 | .num_items = 4, |
| 1847 | .items = { |
| 1848 | { "Mic", 0x0 }, |
| 1849 | { "Line", 0x2 }, |
| 1850 | { "CD", 0x4 }, |
| 1851 | { "Input Mix", 0xa }, |
| 1852 | }, |
| 1853 | } |
| 1854 | }; |
| 1855 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1856 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1858 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1859 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1860 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1861 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1862 | HDA_OUTPUT), |
| 1863 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1864 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1865 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1866 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1867 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1875 | { } /* end */ |
| 1876 | }; |
| 1877 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1878 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1880 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1881 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1882 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1883 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1884 | HDA_OUTPUT), |
| 1885 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1886 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1887 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1888 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1889 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1893 | { } /* end */ |
| 1894 | }; |
| 1895 | |
| 1896 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1897 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1898 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1899 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1900 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1901 | spec->autocfg.hp_pins[0] = 0x15; |
| 1902 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1903 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1904 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1905 | } |
| 1906 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1907 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1908 | { |
| 1909 | struct alc_spec *spec = codec->spec; |
| 1910 | |
| 1911 | spec->autocfg.hp_pins[0] = 0x15; |
| 1912 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1913 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1914 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1915 | } |
| 1916 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1917 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1918 | { |
| 1919 | struct alc_spec *spec = codec->spec; |
| 1920 | |
| 1921 | spec->autocfg.hp_pins[0] = 0x15; |
| 1922 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1923 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1924 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1925 | } |
| 1926 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1927 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1928 | * ALC880 3-stack model |
| 1929 | * |
| 1930 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1931 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1932 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1933 | */ |
| 1934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1935 | static hda_nid_t alc880_dac_nids[4] = { |
| 1936 | /* front, rear, clfe, rear_surr */ |
| 1937 | 0x02, 0x05, 0x04, 0x03 |
| 1938 | }; |
| 1939 | |
| 1940 | static hda_nid_t alc880_adc_nids[3] = { |
| 1941 | /* ADC0-2 */ |
| 1942 | 0x07, 0x08, 0x09, |
| 1943 | }; |
| 1944 | |
| 1945 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1946 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1947 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1948 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1949 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1950 | /* ADC1-2 */ |
| 1951 | 0x08, 0x09, |
| 1952 | }; |
| 1953 | |
| 1954 | #define ALC880_DIGOUT_NID 0x06 |
| 1955 | #define ALC880_DIGIN_NID 0x0a |
| 1956 | |
| 1957 | static struct hda_input_mux alc880_capture_source = { |
| 1958 | .num_items = 4, |
| 1959 | .items = { |
| 1960 | { "Mic", 0x0 }, |
| 1961 | { "Front Mic", 0x3 }, |
| 1962 | { "Line", 0x2 }, |
| 1963 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1964 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1965 | }; |
| 1966 | |
| 1967 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1968 | /* 2ch mode */ |
| 1969 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1970 | /* set line-in to input, mute it */ |
| 1971 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1972 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1973 | /* set mic-in to input vref 80%, mute it */ |
| 1974 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1975 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1976 | { } /* end */ |
| 1977 | }; |
| 1978 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1979 | /* 6ch mode */ |
| 1980 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1981 | /* set line-in to output, unmute it */ |
| 1982 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1983 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1984 | /* set mic-in to output, unmute it */ |
| 1985 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1986 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1987 | { } /* end */ |
| 1988 | }; |
| 1989 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1990 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1991 | { 2, alc880_threestack_ch2_init }, |
| 1992 | { 6, alc880_threestack_ch6_init }, |
| 1993 | }; |
| 1994 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1995 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1998 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1999 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2000 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2001 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2002 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2003 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2004 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2005 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2006 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2007 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2008 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2009 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2010 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2011 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2013 | { |
| 2014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2015 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2016 | .info = alc_ch_mode_info, |
| 2017 | .get = alc_ch_mode_get, |
| 2018 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2019 | }, |
| 2020 | { } /* end */ |
| 2021 | }; |
| 2022 | |
| 2023 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2024 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2025 | struct snd_ctl_elem_info *uinfo) |
| 2026 | { |
| 2027 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2028 | struct alc_spec *spec = codec->spec; |
| 2029 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2030 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2031 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2032 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2033 | HDA_INPUT); |
| 2034 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2035 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2036 | return err; |
| 2037 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2038 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2039 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2040 | unsigned int size, unsigned int __user *tlv) |
| 2041 | { |
| 2042 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2043 | struct alc_spec *spec = codec->spec; |
| 2044 | int err; |
| 2045 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2046 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2047 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2048 | HDA_INPUT); |
| 2049 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2050 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2051 | return err; |
| 2052 | } |
| 2053 | |
| 2054 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2055 | struct snd_ctl_elem_value *ucontrol); |
| 2056 | |
| 2057 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2058 | struct snd_ctl_elem_value *ucontrol, |
| 2059 | getput_call_t func) |
| 2060 | { |
| 2061 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2062 | struct alc_spec *spec = codec->spec; |
| 2063 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2064 | int err; |
| 2065 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2066 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2067 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2068 | 3, 0, HDA_INPUT); |
| 2069 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2070 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2071 | return err; |
| 2072 | } |
| 2073 | |
| 2074 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2075 | struct snd_ctl_elem_value *ucontrol) |
| 2076 | { |
| 2077 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2078 | snd_hda_mixer_amp_volume_get); |
| 2079 | } |
| 2080 | |
| 2081 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2082 | struct snd_ctl_elem_value *ucontrol) |
| 2083 | { |
| 2084 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2085 | snd_hda_mixer_amp_volume_put); |
| 2086 | } |
| 2087 | |
| 2088 | /* capture mixer elements */ |
| 2089 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2090 | |
| 2091 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2092 | struct snd_ctl_elem_value *ucontrol) |
| 2093 | { |
| 2094 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2095 | snd_hda_mixer_amp_switch_get); |
| 2096 | } |
| 2097 | |
| 2098 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2099 | struct snd_ctl_elem_value *ucontrol) |
| 2100 | { |
| 2101 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2102 | snd_hda_mixer_amp_switch_put); |
| 2103 | } |
| 2104 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2105 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2106 | { \ |
| 2107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2108 | .name = "Capture Switch", \ |
| 2109 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2110 | .count = num, \ |
| 2111 | .info = alc_cap_sw_info, \ |
| 2112 | .get = alc_cap_sw_get, \ |
| 2113 | .put = alc_cap_sw_put, \ |
| 2114 | }, \ |
| 2115 | { \ |
| 2116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2117 | .name = "Capture Volume", \ |
| 2118 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2119 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2120 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2121 | .count = num, \ |
| 2122 | .info = alc_cap_vol_info, \ |
| 2123 | .get = alc_cap_vol_get, \ |
| 2124 | .put = alc_cap_vol_put, \ |
| 2125 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2126 | } |
| 2127 | |
| 2128 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2129 | { \ |
| 2130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2131 | /* .name = "Capture Source", */ \ |
| 2132 | .name = "Input Source", \ |
| 2133 | .count = num, \ |
| 2134 | .info = alc_mux_enum_info, \ |
| 2135 | .get = alc_mux_enum_get, \ |
| 2136 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2137 | } |
| 2138 | |
| 2139 | #define DEFINE_CAPMIX(num) \ |
| 2140 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2141 | _DEFINE_CAPMIX(num), \ |
| 2142 | _DEFINE_CAPSRC(num), \ |
| 2143 | { } /* end */ \ |
| 2144 | } |
| 2145 | |
| 2146 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2147 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2148 | _DEFINE_CAPMIX(num), \ |
| 2149 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2150 | } |
| 2151 | |
| 2152 | /* up to three ADCs */ |
| 2153 | DEFINE_CAPMIX(1); |
| 2154 | DEFINE_CAPMIX(2); |
| 2155 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2156 | DEFINE_CAPMIX_NOSRC(1); |
| 2157 | DEFINE_CAPMIX_NOSRC(2); |
| 2158 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2159 | |
| 2160 | /* |
| 2161 | * ALC880 5-stack model |
| 2162 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2163 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2164 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2165 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2166 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2167 | */ |
| 2168 | |
| 2169 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2170 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2171 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2172 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2173 | { } /* end */ |
| 2174 | }; |
| 2175 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2176 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2177 | /* 6ch mode */ |
| 2178 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2179 | /* set line-in to input, mute it */ |
| 2180 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2181 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2182 | { } /* end */ |
| 2183 | }; |
| 2184 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2185 | /* 8ch mode */ |
| 2186 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2187 | /* set line-in to output, unmute it */ |
| 2188 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2189 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2190 | { } /* end */ |
| 2191 | }; |
| 2192 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2193 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | { 6, alc880_fivestack_ch6_init }, |
| 2195 | { 8, alc880_fivestack_ch8_init }, |
| 2196 | }; |
| 2197 | |
| 2198 | |
| 2199 | /* |
| 2200 | * ALC880 6-stack model |
| 2201 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2202 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2203 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2204 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2205 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2206 | */ |
| 2207 | |
| 2208 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2209 | /* front, rear, clfe, rear_surr */ |
| 2210 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2211 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2212 | |
| 2213 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2214 | .num_items = 4, |
| 2215 | .items = { |
| 2216 | { "Mic", 0x0 }, |
| 2217 | { "Front Mic", 0x1 }, |
| 2218 | { "Line", 0x2 }, |
| 2219 | { "CD", 0x4 }, |
| 2220 | }, |
| 2221 | }; |
| 2222 | |
| 2223 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2224 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2225 | { 8, NULL }, |
| 2226 | }; |
| 2227 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2228 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2229 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2230 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2231 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2232 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2233 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2234 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2235 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2236 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2237 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2238 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2247 | { |
| 2248 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2249 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2250 | .info = alc_ch_mode_info, |
| 2251 | .get = alc_ch_mode_get, |
| 2252 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2253 | }, |
| 2254 | { } /* end */ |
| 2255 | }; |
| 2256 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2257 | |
| 2258 | /* |
| 2259 | * ALC880 W810 model |
| 2260 | * |
| 2261 | * W810 has rear IO for: |
| 2262 | * Front (DAC 02) |
| 2263 | * Surround (DAC 03) |
| 2264 | * Center/LFE (DAC 04) |
| 2265 | * Digital out (06) |
| 2266 | * |
| 2267 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2268 | * 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] | 2269 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2270 | * There is a variable resistor to control the speaker or headphone |
| 2271 | * volume. This is a hardware-only device without a software API. |
| 2272 | * |
| 2273 | * Plugging headphones in will disable the internal speakers. This is |
| 2274 | * implemented in hardware, not via the driver using jack sense. In |
| 2275 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2276 | * disable both the speakers and headphones. |
| 2277 | * |
| 2278 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2279 | * These may not do anything useful with this driver yet, because I |
| 2280 | * haven't setup any initialization verbs for these yet... |
| 2281 | */ |
| 2282 | |
| 2283 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2284 | /* front, rear/surround, clfe */ |
| 2285 | 0x02, 0x03, 0x04 |
| 2286 | }; |
| 2287 | |
| 2288 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2289 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2290 | { 6, NULL } |
| 2291 | }; |
| 2292 | |
| 2293 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2294 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2295 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2296 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2297 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2298 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2299 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2300 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2301 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2303 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2304 | { } /* end */ |
| 2305 | }; |
| 2306 | |
| 2307 | |
| 2308 | /* |
| 2309 | * Z710V model |
| 2310 | * |
| 2311 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2312 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2313 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2314 | */ |
| 2315 | |
| 2316 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2317 | 0x02 |
| 2318 | }; |
| 2319 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2320 | |
| 2321 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2322 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2323 | { 2, NULL } |
| 2324 | }; |
| 2325 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2326 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2327 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2328 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2329 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2330 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2332 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2335 | { } /* end */ |
| 2336 | }; |
| 2337 | |
| 2338 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | /* |
| 2340 | * ALC880 F1734 model |
| 2341 | * |
| 2342 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2343 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2344 | */ |
| 2345 | |
| 2346 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2347 | 0x03 |
| 2348 | }; |
| 2349 | #define ALC880_F1734_HP_DAC 0x02 |
| 2350 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2351 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2352 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2353 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2354 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2355 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2356 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2357 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2360 | { } /* end */ |
| 2361 | }; |
| 2362 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2363 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2364 | .num_items = 2, |
| 2365 | .items = { |
| 2366 | { "Mic", 0x1 }, |
| 2367 | { "CD", 0x4 }, |
| 2368 | }, |
| 2369 | }; |
| 2370 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2371 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | /* |
| 2373 | * ALC880 ASUS model |
| 2374 | * |
| 2375 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2376 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2377 | * Mic = 0x18, Line = 0x1a |
| 2378 | */ |
| 2379 | |
| 2380 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2381 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2382 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2383 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2385 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2386 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2387 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2388 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2389 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2390 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2391 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2393 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2394 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2395 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2398 | { |
| 2399 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2400 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2401 | .info = alc_ch_mode_info, |
| 2402 | .get = alc_ch_mode_get, |
| 2403 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2404 | }, |
| 2405 | { } /* end */ |
| 2406 | }; |
| 2407 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2408 | /* |
| 2409 | * ALC880 ASUS W1V model |
| 2410 | * |
| 2411 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2412 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2413 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2414 | */ |
| 2415 | |
| 2416 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2417 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2418 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2419 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2420 | { } /* end */ |
| 2421 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2422 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2423 | /* TCL S700 */ |
| 2424 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2426 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2432 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2433 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2434 | { } /* end */ |
| 2435 | }; |
| 2436 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2437 | /* Uniwill */ |
| 2438 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2439 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2440 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2441 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2442 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2443 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2444 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2445 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2446 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2449 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2450 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2451 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2455 | { |
| 2456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2457 | .name = "Channel Mode", |
| 2458 | .info = alc_ch_mode_info, |
| 2459 | .get = alc_ch_mode_get, |
| 2460 | .put = alc_ch_mode_put, |
| 2461 | }, |
| 2462 | { } /* end */ |
| 2463 | }; |
| 2464 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2465 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2466 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2467 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2469 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 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("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2473 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2474 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2475 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2479 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2480 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2481 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2482 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2483 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2486 | { } /* end */ |
| 2487 | }; |
| 2488 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2489 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2490 | * virtual master controls |
| 2491 | */ |
| 2492 | |
| 2493 | /* |
| 2494 | * slave controls for virtual master |
| 2495 | */ |
| 2496 | static const char *alc_slave_vols[] = { |
| 2497 | "Front Playback Volume", |
| 2498 | "Surround Playback Volume", |
| 2499 | "Center Playback Volume", |
| 2500 | "LFE Playback Volume", |
| 2501 | "Side Playback Volume", |
| 2502 | "Headphone Playback Volume", |
| 2503 | "Speaker Playback Volume", |
| 2504 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2505 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2506 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2507 | NULL, |
| 2508 | }; |
| 2509 | |
| 2510 | static const char *alc_slave_sws[] = { |
| 2511 | "Front Playback Switch", |
| 2512 | "Surround Playback Switch", |
| 2513 | "Center Playback Switch", |
| 2514 | "LFE Playback Switch", |
| 2515 | "Side Playback Switch", |
| 2516 | "Headphone Playback Switch", |
| 2517 | "Speaker Playback Switch", |
| 2518 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2519 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2520 | "Line-Out Playback Switch", |
| 2521 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2522 | NULL, |
| 2523 | }; |
| 2524 | |
| 2525 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2526 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2528 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2529 | #define NID_MAPPING (-1) |
| 2530 | |
| 2531 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2532 | #define SUBDEV_HP_ (1 << 6) |
| 2533 | #define SUBDEV_LINE_ (2 << 6) |
| 2534 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2535 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2536 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2537 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2538 | static void alc_free_kctls(struct hda_codec *codec); |
| 2539 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2540 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2541 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2542 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2543 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2544 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2545 | { } /* end */ |
| 2546 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2547 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2548 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2549 | static int alc_build_controls(struct hda_codec *codec) |
| 2550 | { |
| 2551 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2552 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2553 | struct snd_kcontrol_new *knew; |
| 2554 | int i, j, err; |
| 2555 | unsigned int u; |
| 2556 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2557 | |
| 2558 | for (i = 0; i < spec->num_mixers; i++) { |
| 2559 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2560 | if (err < 0) |
| 2561 | return err; |
| 2562 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2563 | if (spec->cap_mixer) { |
| 2564 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2565 | if (err < 0) |
| 2566 | return err; |
| 2567 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2568 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2569 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2570 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2571 | if (err < 0) |
| 2572 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2573 | if (!spec->no_analog) { |
| 2574 | err = snd_hda_create_spdif_share_sw(codec, |
| 2575 | &spec->multiout); |
| 2576 | if (err < 0) |
| 2577 | return err; |
| 2578 | spec->multiout.share_spdif = 1; |
| 2579 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2580 | } |
| 2581 | if (spec->dig_in_nid) { |
| 2582 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2583 | if (err < 0) |
| 2584 | return err; |
| 2585 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2586 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2587 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2588 | /* create beep controls if needed */ |
| 2589 | if (spec->beep_amp) { |
| 2590 | struct snd_kcontrol_new *knew; |
| 2591 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2592 | struct snd_kcontrol *kctl; |
| 2593 | kctl = snd_ctl_new1(knew, codec); |
| 2594 | if (!kctl) |
| 2595 | return -ENOMEM; |
| 2596 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2597 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2598 | if (err < 0) |
| 2599 | return err; |
| 2600 | } |
| 2601 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2602 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2603 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2604 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2605 | if (!spec->no_analog && |
| 2606 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2607 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2608 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2609 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2610 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2611 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2612 | if (err < 0) |
| 2613 | return err; |
| 2614 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2615 | if (!spec->no_analog && |
| 2616 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2617 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2618 | NULL, alc_slave_sws); |
| 2619 | if (err < 0) |
| 2620 | return err; |
| 2621 | } |
| 2622 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2623 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2624 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2625 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2626 | if (!kctl) |
| 2627 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2628 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2629 | hda_nid_t *nids = spec->capsrc_nids; |
| 2630 | if (!nids) |
| 2631 | nids = spec->adc_nids; |
| 2632 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2633 | if (err < 0) |
| 2634 | return err; |
| 2635 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2636 | } |
| 2637 | if (spec->cap_mixer) { |
| 2638 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2639 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2640 | if (kname && strcmp(knew->name, kname) == 0) |
| 2641 | continue; |
| 2642 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2643 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2644 | err = snd_hda_add_nid(codec, kctl, i, |
| 2645 | spec->adc_nids[i]); |
| 2646 | if (err < 0) |
| 2647 | return err; |
| 2648 | } |
| 2649 | } |
| 2650 | } |
| 2651 | |
| 2652 | /* other nid->control mapping */ |
| 2653 | for (i = 0; i < spec->num_mixers; i++) { |
| 2654 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2655 | if (knew->iface != NID_MAPPING) |
| 2656 | continue; |
| 2657 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2658 | if (kctl == NULL) |
| 2659 | continue; |
| 2660 | u = knew->subdevice; |
| 2661 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2662 | nid = u & 0x3f; |
| 2663 | if (nid == 0) |
| 2664 | continue; |
| 2665 | switch (u & 0xc0) { |
| 2666 | case SUBDEV_SPEAKER_: |
| 2667 | nid = spec->autocfg.speaker_pins[nid]; |
| 2668 | break; |
| 2669 | case SUBDEV_LINE_: |
| 2670 | nid = spec->autocfg.line_out_pins[nid]; |
| 2671 | break; |
| 2672 | case SUBDEV_HP_: |
| 2673 | nid = spec->autocfg.hp_pins[nid]; |
| 2674 | break; |
| 2675 | default: |
| 2676 | continue; |
| 2677 | } |
| 2678 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2679 | if (err < 0) |
| 2680 | return err; |
| 2681 | } |
| 2682 | u = knew->private_value; |
| 2683 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2684 | nid = u & 0xff; |
| 2685 | if (nid == 0) |
| 2686 | continue; |
| 2687 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2688 | if (err < 0) |
| 2689 | return err; |
| 2690 | } |
| 2691 | } |
| 2692 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2693 | |
| 2694 | alc_free_kctls(codec); /* no longer needed */ |
| 2695 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2696 | return 0; |
| 2697 | } |
| 2698 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2699 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2700 | /* |
| 2701 | * initialize the codec volumes, etc |
| 2702 | */ |
| 2703 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2704 | /* |
| 2705 | * generic initialization of ADC, input mixers and output mixers |
| 2706 | */ |
| 2707 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2708 | /* |
| 2709 | * Unmute ADC0-2 and set the default input to mic-in |
| 2710 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2711 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2713 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2715 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2716 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2717 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2718 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2719 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2720 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2721 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2722 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2723 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2727 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2728 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2729 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2731 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2732 | /* |
| 2733 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2734 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2735 | /* set vol=0 to output mixers */ |
| 2736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2739 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2740 | /* set up input amps for analog loopback */ |
| 2741 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2742 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2746 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2747 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2748 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2750 | |
| 2751 | { } |
| 2752 | }; |
| 2753 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | /* |
| 2755 | * 3-stack pin configuration: |
| 2756 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2757 | */ |
| 2758 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2759 | /* |
| 2760 | * preset connection lists of input pins |
| 2761 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2762 | */ |
| 2763 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2764 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2765 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2766 | |
| 2767 | /* |
| 2768 | * Set pin mode and muting |
| 2769 | */ |
| 2770 | /* set front pin widgets 0x14 for output */ |
| 2771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2773 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2776 | /* Mic2 (as headphone out) for HP output */ |
| 2777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2779 | /* Line In pin widget for input */ |
| 2780 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2782 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2783 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2784 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2785 | /* CD pin widget for input */ |
| 2786 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2787 | |
| 2788 | { } |
| 2789 | }; |
| 2790 | |
| 2791 | /* |
| 2792 | * 5-stack pin configuration: |
| 2793 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2794 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2795 | */ |
| 2796 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2797 | /* |
| 2798 | * preset connection lists of input pins |
| 2799 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2800 | */ |
| 2801 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2802 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2803 | |
| 2804 | /* |
| 2805 | * Set pin mode and muting |
| 2806 | */ |
| 2807 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2810 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2811 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2812 | /* unmute pins for output (no gain on this amp) */ |
| 2813 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2816 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2817 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2818 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2821 | /* Mic2 (as headphone out) for HP output */ |
| 2822 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2824 | /* Line In pin widget for input */ |
| 2825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2827 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2828 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2830 | /* CD pin widget for input */ |
| 2831 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2832 | |
| 2833 | { } |
| 2834 | }; |
| 2835 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2836 | /* |
| 2837 | * W810 pin configuration: |
| 2838 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2839 | */ |
| 2840 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2841 | /* hphone/speaker input selector: front DAC */ |
| 2842 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2843 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2850 | |
| 2851 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2852 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2853 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2854 | { } |
| 2855 | }; |
| 2856 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2857 | /* |
| 2858 | * Z71V pin configuration: |
| 2859 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2860 | */ |
| 2861 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2866 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2867 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2868 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2869 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2870 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2871 | |
| 2872 | { } |
| 2873 | }; |
| 2874 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2875 | /* |
| 2876 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2877 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2878 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2879 | */ |
| 2880 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2881 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2882 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2883 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2886 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2887 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2888 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2889 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2890 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2891 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2892 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2893 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2894 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2895 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2896 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2897 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2898 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2899 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2900 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2901 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2902 | { } |
| 2903 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2904 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2905 | /* |
| 2906 | * Uniwill pin configuration: |
| 2907 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2908 | * line = 0x1a |
| 2909 | */ |
| 2910 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2911 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2912 | |
| 2913 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2917 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2918 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2919 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2923 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2925 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2927 | |
| 2928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2930 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2931 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2933 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2934 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2935 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2936 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2937 | |
| 2938 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2939 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2940 | |
| 2941 | { } |
| 2942 | }; |
| 2943 | |
| 2944 | /* |
| 2945 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2946 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2947 | */ |
| 2948 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2949 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2950 | |
| 2951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2952 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2953 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2955 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2956 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2961 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2963 | |
| 2964 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2965 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2966 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2967 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2970 | |
| 2971 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2972 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2973 | |
| 2974 | { } |
| 2975 | }; |
| 2976 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2977 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2978 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2979 | { } |
| 2980 | }; |
| 2981 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2982 | /* auto-toggle front mic */ |
| 2983 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2984 | { |
| 2985 | unsigned int present; |
| 2986 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2987 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2988 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2989 | bits = present ? HDA_AMP_MUTE : 0; |
| 2990 | 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] | 2991 | } |
| 2992 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2993 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2994 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2995 | struct alc_spec *spec = codec->spec; |
| 2996 | |
| 2997 | spec->autocfg.hp_pins[0] = 0x14; |
| 2998 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2999 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3000 | } |
| 3001 | |
| 3002 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3003 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3004 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3005 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3006 | } |
| 3007 | |
| 3008 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3009 | unsigned int res) |
| 3010 | { |
| 3011 | /* Looks like the unsol event is incompatible with the standard |
| 3012 | * definition. 4bit tag is placed at 28 bit! |
| 3013 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3014 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3015 | case ALC880_MIC_EVENT: |
| 3016 | alc880_uniwill_mic_automute(codec); |
| 3017 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3018 | default: |
| 3019 | alc_automute_amp_unsol_event(codec, res); |
| 3020 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3021 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3022 | } |
| 3023 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3024 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3025 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3026 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3027 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3028 | spec->autocfg.hp_pins[0] = 0x14; |
| 3029 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3030 | } |
| 3031 | |
| 3032 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3033 | { |
| 3034 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3035 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3036 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3037 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3038 | present &= HDA_AMP_VOLMASK; |
| 3039 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3040 | HDA_AMP_VOLMASK, present); |
| 3041 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3042 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3043 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3044 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3045 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3046 | unsigned int res) |
| 3047 | { |
| 3048 | /* Looks like the unsol event is incompatible with the standard |
| 3049 | * definition. 4bit tag is placed at 28 bit! |
| 3050 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3051 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3052 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3053 | else |
| 3054 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3055 | } |
| 3056 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3057 | /* |
| 3058 | * F1734 pin configuration: |
| 3059 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3060 | */ |
| 3061 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3062 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3063 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3064 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3065 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3066 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3067 | |
| 3068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3070 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3072 | |
| 3073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3078 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3079 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3080 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3081 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3084 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3085 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3086 | { } |
| 3087 | }; |
| 3088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3089 | /* |
| 3090 | * ASUS pin configuration: |
| 3091 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3092 | */ |
| 3093 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3094 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3095 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3096 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3097 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3098 | |
| 3099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3100 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3101 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3102 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3105 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3107 | |
| 3108 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3109 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3110 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3112 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3113 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3115 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3116 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3117 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | { } |
| 3119 | }; |
| 3120 | |
| 3121 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3122 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3123 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3124 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3125 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3126 | /* Clevo m520g init */ |
| 3127 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3128 | /* headphone output */ |
| 3129 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3130 | /* line-out */ |
| 3131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3133 | /* Line-in */ |
| 3134 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3135 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3136 | /* CD */ |
| 3137 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3138 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3139 | /* Mic1 (rear panel) */ |
| 3140 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3141 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3142 | /* Mic2 (front panel) */ |
| 3143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3145 | /* headphone */ |
| 3146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3148 | /* change to EAPD mode */ |
| 3149 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3150 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3151 | |
| 3152 | { } |
| 3153 | }; |
| 3154 | |
| 3155 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3156 | /* change to EAPD mode */ |
| 3157 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3158 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3159 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3160 | /* Headphone output */ |
| 3161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3162 | /* Front output*/ |
| 3163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3164 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3165 | |
| 3166 | /* Line In pin widget for input */ |
| 3167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3168 | /* CD pin widget for input */ |
| 3169 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3170 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3171 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3172 | |
| 3173 | /* change to EAPD mode */ |
| 3174 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3175 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3176 | |
| 3177 | { } |
| 3178 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3179 | |
| 3180 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3181 | * LG m1 express dual |
| 3182 | * |
| 3183 | * Pin assignment: |
| 3184 | * Rear Line-In/Out (blue): 0x14 |
| 3185 | * Build-in Mic-In: 0x15 |
| 3186 | * Speaker-out: 0x17 |
| 3187 | * HP-Out (green): 0x1b |
| 3188 | * Mic-In/Out (red): 0x19 |
| 3189 | * SPDIF-Out: 0x1e |
| 3190 | */ |
| 3191 | |
| 3192 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3193 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3194 | 0x05, 0x02, 0x03 |
| 3195 | }; |
| 3196 | |
| 3197 | /* seems analog CD is not working */ |
| 3198 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3199 | .num_items = 3, |
| 3200 | .items = { |
| 3201 | { "Mic", 0x1 }, |
| 3202 | { "Line", 0x5 }, |
| 3203 | { "Internal Mic", 0x6 }, |
| 3204 | }, |
| 3205 | }; |
| 3206 | |
| 3207 | /* 2,4,6 channel modes */ |
| 3208 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3209 | /* set line-in and mic-in to input */ |
| 3210 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3211 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3212 | { } |
| 3213 | }; |
| 3214 | |
| 3215 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3216 | /* set line-in to out and mic-in to input */ |
| 3217 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3218 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3219 | { } |
| 3220 | }; |
| 3221 | |
| 3222 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3223 | /* set line-in and mic-in to output */ |
| 3224 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3225 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3226 | { } |
| 3227 | }; |
| 3228 | |
| 3229 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3230 | { 2, alc880_lg_ch2_init }, |
| 3231 | { 4, alc880_lg_ch4_init }, |
| 3232 | { 6, alc880_lg_ch6_init }, |
| 3233 | }; |
| 3234 | |
| 3235 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3237 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3238 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3239 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3240 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3241 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3242 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3243 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3246 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3247 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3248 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3249 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3250 | { |
| 3251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3252 | .name = "Channel Mode", |
| 3253 | .info = alc_ch_mode_info, |
| 3254 | .get = alc_ch_mode_get, |
| 3255 | .put = alc_ch_mode_put, |
| 3256 | }, |
| 3257 | { } /* end */ |
| 3258 | }; |
| 3259 | |
| 3260 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3261 | /* set capture source to mic-in */ |
| 3262 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3264 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3265 | /* mute all amp mixer inputs */ |
| 3266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3269 | /* line-in to input */ |
| 3270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3272 | /* built-in mic */ |
| 3273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3275 | /* speaker-out */ |
| 3276 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3277 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3278 | /* mic-in to input */ |
| 3279 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3280 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3282 | /* HP-out */ |
| 3283 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3285 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3286 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3288 | { } |
| 3289 | }; |
| 3290 | |
| 3291 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3292 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3293 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3294 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3295 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3296 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3297 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3298 | } |
| 3299 | |
| 3300 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3301 | * LG LW20 |
| 3302 | * |
| 3303 | * Pin assignment: |
| 3304 | * Speaker-out: 0x14 |
| 3305 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3306 | * Built-in Mic-In: 0x19 |
| 3307 | * Line-In: 0x1b |
| 3308 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3309 | * SPDIF-Out: 0x1e |
| 3310 | */ |
| 3311 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3312 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3313 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3314 | .items = { |
| 3315 | { "Mic", 0x0 }, |
| 3316 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3317 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3318 | }, |
| 3319 | }; |
| 3320 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3321 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3322 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3323 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3325 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3326 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3327 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3328 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3329 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3330 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3331 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3336 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3337 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3338 | { |
| 3339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3340 | .name = "Channel Mode", |
| 3341 | .info = alc_ch_mode_info, |
| 3342 | .get = alc_ch_mode_get, |
| 3343 | .put = alc_ch_mode_put, |
| 3344 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3345 | { } /* end */ |
| 3346 | }; |
| 3347 | |
| 3348 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3349 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3350 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3351 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3352 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3353 | /* set capture source to mic-in */ |
| 3354 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3356 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3357 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3358 | /* speaker-out */ |
| 3359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3360 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3361 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3362 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3363 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3364 | /* mic-in to input */ |
| 3365 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3367 | /* built-in mic */ |
| 3368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3370 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3371 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3372 | { } |
| 3373 | }; |
| 3374 | |
| 3375 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3376 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3377 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3378 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3379 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3380 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3381 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3382 | } |
| 3383 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3384 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3385 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3386 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3389 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3390 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3391 | { } /* end */ |
| 3392 | }; |
| 3393 | |
| 3394 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3395 | .num_items = 2, |
| 3396 | .items = { |
| 3397 | { "Mic", 0x0 }, |
| 3398 | { "Internal Mic", 0x1 }, |
| 3399 | }, |
| 3400 | }; |
| 3401 | |
| 3402 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3403 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3404 | |
| 3405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3407 | |
| 3408 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3409 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3410 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3411 | /* Mic2 (as headphone out) for HP output */ |
| 3412 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3413 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3414 | /* Internal Speaker */ |
| 3415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3416 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3417 | |
| 3418 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3419 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3420 | |
| 3421 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3422 | { } |
| 3423 | }; |
| 3424 | |
| 3425 | /* toggle speaker-output according to the hp-jack state */ |
| 3426 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3427 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3428 | struct alc_spec *spec = codec->spec; |
| 3429 | alc_automute_amp(codec); |
| 3430 | /* toggle EAPD */ |
| 3431 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3432 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3433 | else |
| 3434 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3435 | } |
| 3436 | |
| 3437 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3438 | unsigned int res) |
| 3439 | { |
| 3440 | /* Looks like the unsol event is incompatible with the standard |
| 3441 | * definition. 4bit tag is placed at 28 bit! |
| 3442 | */ |
| 3443 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3444 | alc880_medion_rim_automute(codec); |
| 3445 | } |
| 3446 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3447 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3448 | { |
| 3449 | struct alc_spec *spec = codec->spec; |
| 3450 | |
| 3451 | spec->autocfg.hp_pins[0] = 0x14; |
| 3452 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3453 | } |
| 3454 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3455 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3456 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3457 | { 0x0b, HDA_INPUT, 0 }, |
| 3458 | { 0x0b, HDA_INPUT, 1 }, |
| 3459 | { 0x0b, HDA_INPUT, 2 }, |
| 3460 | { 0x0b, HDA_INPUT, 3 }, |
| 3461 | { 0x0b, HDA_INPUT, 4 }, |
| 3462 | { } /* end */ |
| 3463 | }; |
| 3464 | |
| 3465 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3466 | { 0x0b, HDA_INPUT, 1 }, |
| 3467 | { 0x0b, HDA_INPUT, 6 }, |
| 3468 | { 0x0b, HDA_INPUT, 7 }, |
| 3469 | { } /* end */ |
| 3470 | }; |
| 3471 | #endif |
| 3472 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3473 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3474 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3475 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3476 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3477 | static int alc_init(struct hda_codec *codec) |
| 3478 | { |
| 3479 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3480 | unsigned int i; |
| 3481 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3482 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3483 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3484 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3485 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3486 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3487 | |
| 3488 | if (spec->init_hook) |
| 3489 | spec->init_hook(codec); |
| 3490 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3491 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3492 | if (codec->patch_ops.check_power_status) |
| 3493 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3494 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3495 | return 0; |
| 3496 | } |
| 3497 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3498 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3499 | { |
| 3500 | struct alc_spec *spec = codec->spec; |
| 3501 | |
| 3502 | if (spec->unsol_event) |
| 3503 | spec->unsol_event(codec, res); |
| 3504 | } |
| 3505 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3506 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3507 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3508 | { |
| 3509 | struct alc_spec *spec = codec->spec; |
| 3510 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3511 | } |
| 3512 | #endif |
| 3513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3514 | /* |
| 3515 | * Analog playback callbacks |
| 3516 | */ |
| 3517 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3518 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3519 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3520 | { |
| 3521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3522 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3523 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3524 | } |
| 3525 | |
| 3526 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3527 | struct hda_codec *codec, |
| 3528 | unsigned int stream_tag, |
| 3529 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3530 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3531 | { |
| 3532 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3533 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3534 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3535 | } |
| 3536 | |
| 3537 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3538 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3539 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3540 | { |
| 3541 | struct alc_spec *spec = codec->spec; |
| 3542 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3543 | } |
| 3544 | |
| 3545 | /* |
| 3546 | * Digital out |
| 3547 | */ |
| 3548 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3549 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3550 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3551 | { |
| 3552 | struct alc_spec *spec = codec->spec; |
| 3553 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3554 | } |
| 3555 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3556 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3557 | struct hda_codec *codec, |
| 3558 | unsigned int stream_tag, |
| 3559 | unsigned int format, |
| 3560 | struct snd_pcm_substream *substream) |
| 3561 | { |
| 3562 | struct alc_spec *spec = codec->spec; |
| 3563 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3564 | stream_tag, format, substream); |
| 3565 | } |
| 3566 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3567 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3568 | struct hda_codec *codec, |
| 3569 | struct snd_pcm_substream *substream) |
| 3570 | { |
| 3571 | struct alc_spec *spec = codec->spec; |
| 3572 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3573 | } |
| 3574 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3575 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3576 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3577 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3578 | { |
| 3579 | struct alc_spec *spec = codec->spec; |
| 3580 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3581 | } |
| 3582 | |
| 3583 | /* |
| 3584 | * Analog capture |
| 3585 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3586 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3587 | struct hda_codec *codec, |
| 3588 | unsigned int stream_tag, |
| 3589 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3590 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3591 | { |
| 3592 | struct alc_spec *spec = codec->spec; |
| 3593 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3594 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3595 | stream_tag, 0, format); |
| 3596 | return 0; |
| 3597 | } |
| 3598 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3599 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3600 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3601 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3602 | { |
| 3603 | struct alc_spec *spec = codec->spec; |
| 3604 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3605 | snd_hda_codec_cleanup_stream(codec, |
| 3606 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3607 | return 0; |
| 3608 | } |
| 3609 | |
| 3610 | |
| 3611 | /* |
| 3612 | */ |
| 3613 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3614 | .substreams = 1, |
| 3615 | .channels_min = 2, |
| 3616 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3617 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3618 | .ops = { |
| 3619 | .open = alc880_playback_pcm_open, |
| 3620 | .prepare = alc880_playback_pcm_prepare, |
| 3621 | .cleanup = alc880_playback_pcm_cleanup |
| 3622 | }, |
| 3623 | }; |
| 3624 | |
| 3625 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3626 | .substreams = 1, |
| 3627 | .channels_min = 2, |
| 3628 | .channels_max = 2, |
| 3629 | /* NID is set in alc_build_pcms */ |
| 3630 | }; |
| 3631 | |
| 3632 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3633 | .substreams = 1, |
| 3634 | .channels_min = 2, |
| 3635 | .channels_max = 2, |
| 3636 | /* NID is set in alc_build_pcms */ |
| 3637 | }; |
| 3638 | |
| 3639 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3640 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3641 | .channels_min = 2, |
| 3642 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3643 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3645 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3646 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3647 | }, |
| 3648 | }; |
| 3649 | |
| 3650 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3651 | .substreams = 1, |
| 3652 | .channels_min = 2, |
| 3653 | .channels_max = 2, |
| 3654 | /* NID is set in alc_build_pcms */ |
| 3655 | .ops = { |
| 3656 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3657 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3658 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3659 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3660 | }, |
| 3661 | }; |
| 3662 | |
| 3663 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3664 | .substreams = 1, |
| 3665 | .channels_min = 2, |
| 3666 | .channels_max = 2, |
| 3667 | /* NID is set in alc_build_pcms */ |
| 3668 | }; |
| 3669 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3670 | /* 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] | 3671 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3672 | .substreams = 0, |
| 3673 | .channels_min = 0, |
| 3674 | .channels_max = 0, |
| 3675 | }; |
| 3676 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3677 | static int alc_build_pcms(struct hda_codec *codec) |
| 3678 | { |
| 3679 | struct alc_spec *spec = codec->spec; |
| 3680 | struct hda_pcm *info = spec->pcm_rec; |
| 3681 | int i; |
| 3682 | |
| 3683 | codec->num_pcms = 1; |
| 3684 | codec->pcm_info = info; |
| 3685 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3686 | if (spec->no_analog) |
| 3687 | goto skip_analog; |
| 3688 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3689 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3690 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3692 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3693 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3694 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3695 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3696 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3697 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3698 | } |
| 3699 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3700 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3701 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3702 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3703 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3704 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3705 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3706 | if (spec->channel_mode) { |
| 3707 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3708 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3709 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3710 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3711 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3712 | } |
| 3713 | } |
| 3714 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3715 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3716 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3717 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3718 | snprintf(spec->stream_name_digital, |
| 3719 | sizeof(spec->stream_name_digital), |
| 3720 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3721 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3722 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3723 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3724 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3725 | if (spec->dig_out_type) |
| 3726 | info->pcm_type = spec->dig_out_type; |
| 3727 | else |
| 3728 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3729 | if (spec->multiout.dig_out_nid && |
| 3730 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3731 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3732 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3733 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3734 | if (spec->dig_in_nid && |
| 3735 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3736 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3737 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3738 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3739 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3740 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3741 | } |
| 3742 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3743 | if (spec->no_analog) |
| 3744 | return 0; |
| 3745 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3746 | /* If the use of more than one ADC is requested for the current |
| 3747 | * model, configure a second analog capture-only PCM. |
| 3748 | */ |
| 3749 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3750 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3751 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3752 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3753 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3754 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3755 | if (spec->alt_dac_nid) { |
| 3756 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3757 | *spec->stream_analog_alt_playback; |
| 3758 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3759 | spec->alt_dac_nid; |
| 3760 | } else { |
| 3761 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3762 | alc_pcm_null_stream; |
| 3763 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3764 | } |
| 3765 | if (spec->num_adc_nids > 1) { |
| 3766 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3767 | *spec->stream_analog_alt_capture; |
| 3768 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3769 | spec->adc_nids[1]; |
| 3770 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3771 | spec->num_adc_nids - 1; |
| 3772 | } else { |
| 3773 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3774 | alc_pcm_null_stream; |
| 3775 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3776 | } |
| 3777 | } |
| 3778 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3779 | return 0; |
| 3780 | } |
| 3781 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3782 | static inline void alc_shutup(struct hda_codec *codec) |
| 3783 | { |
| 3784 | snd_hda_shutup_pins(codec); |
| 3785 | } |
| 3786 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3787 | static void alc_free_kctls(struct hda_codec *codec) |
| 3788 | { |
| 3789 | struct alc_spec *spec = codec->spec; |
| 3790 | |
| 3791 | if (spec->kctls.list) { |
| 3792 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3793 | int i; |
| 3794 | for (i = 0; i < spec->kctls.used; i++) |
| 3795 | kfree(kctl[i].name); |
| 3796 | } |
| 3797 | snd_array_free(&spec->kctls); |
| 3798 | } |
| 3799 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3800 | static void alc_free(struct hda_codec *codec) |
| 3801 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3802 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3803 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3804 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3805 | return; |
| 3806 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3807 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3808 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3809 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3810 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3811 | } |
| 3812 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3813 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3814 | static void alc_power_eapd(struct hda_codec *codec) |
| 3815 | { |
| 3816 | /* We currently only handle front, HP */ |
| 3817 | switch (codec->vendor_id) { |
| 3818 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3819 | set_eapd(codec, 0x0f, 0); |
| 3820 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3821 | break; |
| 3822 | case 0x10ec0262: |
| 3823 | case 0x10ec0267: |
| 3824 | case 0x10ec0268: |
| 3825 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3826 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3827 | case 0x10ec0272: |
| 3828 | case 0x10ec0660: |
| 3829 | case 0x10ec0662: |
| 3830 | case 0x10ec0663: |
| 3831 | case 0x10ec0862: |
| 3832 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3833 | set_eapd(codec, 0x14, 0); |
| 3834 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3835 | break; |
| 3836 | } |
| 3837 | } |
| 3838 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3839 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3840 | { |
| 3841 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3842 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3843 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3844 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3845 | return 0; |
| 3846 | } |
| 3847 | #endif |
| 3848 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3849 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3850 | static int alc_resume(struct hda_codec *codec) |
| 3851 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3852 | codec->patch_ops.init(codec); |
| 3853 | snd_hda_codec_resume_amp(codec); |
| 3854 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3855 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3856 | if (codec->patch_ops.check_power_status) |
| 3857 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3858 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3859 | return 0; |
| 3860 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3861 | #endif |
| 3862 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3863 | /* |
| 3864 | */ |
| 3865 | static struct hda_codec_ops alc_patch_ops = { |
| 3866 | .build_controls = alc_build_controls, |
| 3867 | .build_pcms = alc_build_pcms, |
| 3868 | .init = alc_init, |
| 3869 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3870 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3871 | #ifdef SND_HDA_NEEDS_RESUME |
| 3872 | .resume = alc_resume, |
| 3873 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3874 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3875 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3876 | .check_power_status = alc_check_power_status, |
| 3877 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3878 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3879 | }; |
| 3880 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 3881 | /* replace the codec chip_name with the given string */ |
| 3882 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 3883 | { |
| 3884 | kfree(codec->chip_name); |
| 3885 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 3886 | if (!codec->chip_name) { |
| 3887 | alc_free(codec); |
| 3888 | return -ENOMEM; |
| 3889 | } |
| 3890 | return 0; |
| 3891 | } |
| 3892 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3893 | /* |
| 3894 | * Test configuration for debugging |
| 3895 | * |
| 3896 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3897 | * enum controls. |
| 3898 | */ |
| 3899 | #ifdef CONFIG_SND_DEBUG |
| 3900 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3901 | 0x02, 0x03, 0x04, 0x05 |
| 3902 | }; |
| 3903 | |
| 3904 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3905 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3906 | .items = { |
| 3907 | { "In-1", 0x0 }, |
| 3908 | { "In-2", 0x1 }, |
| 3909 | { "In-3", 0x2 }, |
| 3910 | { "In-4", 0x3 }, |
| 3911 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3912 | { "Front", 0x5 }, |
| 3913 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3914 | }, |
| 3915 | }; |
| 3916 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3917 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3918 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3919 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3920 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3921 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3922 | }; |
| 3923 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3924 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3925 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3926 | { |
| 3927 | static char *texts[] = { |
| 3928 | "N/A", "Line Out", "HP Out", |
| 3929 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3930 | }; |
| 3931 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3932 | uinfo->count = 1; |
| 3933 | uinfo->value.enumerated.items = 8; |
| 3934 | if (uinfo->value.enumerated.item >= 8) |
| 3935 | uinfo->value.enumerated.item = 7; |
| 3936 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3937 | return 0; |
| 3938 | } |
| 3939 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3940 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3941 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3942 | { |
| 3943 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3944 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3945 | unsigned int pin_ctl, item = 0; |
| 3946 | |
| 3947 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3948 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3949 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3950 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3951 | item = 2; |
| 3952 | else |
| 3953 | item = 1; |
| 3954 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3955 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3956 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3957 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3958 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3959 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3960 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3961 | } |
| 3962 | } |
| 3963 | ucontrol->value.enumerated.item[0] = item; |
| 3964 | return 0; |
| 3965 | } |
| 3966 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3967 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3968 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3969 | { |
| 3970 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3971 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3972 | static unsigned int ctls[] = { |
| 3973 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3974 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3975 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3976 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3977 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3978 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3979 | }; |
| 3980 | unsigned int old_ctl, new_ctl; |
| 3981 | |
| 3982 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3983 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3984 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3985 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3986 | int val; |
| 3987 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3988 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3989 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3990 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3991 | HDA_AMP_MUTE : 0; |
| 3992 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3993 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3994 | return 1; |
| 3995 | } |
| 3996 | return 0; |
| 3997 | } |
| 3998 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3999 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4000 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4001 | { |
| 4002 | static char *texts[] = { |
| 4003 | "Front", "Surround", "CLFE", "Side" |
| 4004 | }; |
| 4005 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4006 | uinfo->count = 1; |
| 4007 | uinfo->value.enumerated.items = 4; |
| 4008 | if (uinfo->value.enumerated.item >= 4) |
| 4009 | uinfo->value.enumerated.item = 3; |
| 4010 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4011 | return 0; |
| 4012 | } |
| 4013 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4014 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4015 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4016 | { |
| 4017 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4018 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4019 | unsigned int sel; |
| 4020 | |
| 4021 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4022 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4023 | return 0; |
| 4024 | } |
| 4025 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4026 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4027 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4028 | { |
| 4029 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4030 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4031 | unsigned int sel; |
| 4032 | |
| 4033 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4034 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4035 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4036 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4037 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4038 | return 1; |
| 4039 | } |
| 4040 | return 0; |
| 4041 | } |
| 4042 | |
| 4043 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4045 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4046 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4047 | .info = alc_test_pin_ctl_info, \ |
| 4048 | .get = alc_test_pin_ctl_get, \ |
| 4049 | .put = alc_test_pin_ctl_put, \ |
| 4050 | .private_value = nid \ |
| 4051 | } |
| 4052 | |
| 4053 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4055 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4056 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4057 | .info = alc_test_pin_src_info, \ |
| 4058 | .get = alc_test_pin_src_get, \ |
| 4059 | .put = alc_test_pin_src_put, \ |
| 4060 | .private_value = nid \ |
| 4061 | } |
| 4062 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4063 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4065 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4066 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4067 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4068 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4069 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4070 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4071 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4072 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4073 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4074 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4075 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4076 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4077 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4078 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4079 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4080 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4081 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4082 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4083 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4084 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4085 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4086 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4087 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4088 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4089 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4090 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4091 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4092 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4093 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4094 | { |
| 4095 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4096 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4097 | .info = alc_ch_mode_info, |
| 4098 | .get = alc_ch_mode_get, |
| 4099 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4100 | }, |
| 4101 | { } /* end */ |
| 4102 | }; |
| 4103 | |
| 4104 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4105 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4109 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4114 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4118 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4119 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4123 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4124 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4127 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4128 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4129 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4130 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4131 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4132 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4133 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4134 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4135 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4139 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4140 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4142 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4143 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4144 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4146 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4147 | /* Analog input/passthru */ |
| 4148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4151 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4153 | { } |
| 4154 | }; |
| 4155 | #endif |
| 4156 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4157 | /* |
| 4158 | */ |
| 4159 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4160 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4161 | [ALC880_3ST] = "3stack", |
| 4162 | [ALC880_TCL_S700] = "tcl", |
| 4163 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4164 | [ALC880_CLEVO] = "clevo", |
| 4165 | [ALC880_5ST] = "5stack", |
| 4166 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4167 | [ALC880_W810] = "w810", |
| 4168 | [ALC880_Z71V] = "z71v", |
| 4169 | [ALC880_6ST] = "6stack", |
| 4170 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4171 | [ALC880_ASUS] = "asus", |
| 4172 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4173 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4174 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4175 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4176 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4177 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4178 | [ALC880_F1734] = "F1734", |
| 4179 | [ALC880_LG] = "lg", |
| 4180 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4181 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4182 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4183 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4184 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4185 | [ALC880_AUTO] = "auto", |
| 4186 | }; |
| 4187 | |
| 4188 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4189 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4190 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4191 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4192 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4193 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4194 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4195 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4196 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4197 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4198 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4199 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4200 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4201 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4202 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4203 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4204 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4205 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4206 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4207 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4208 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4209 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4210 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4211 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4212 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4213 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4214 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4215 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4216 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4217 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4218 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4219 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4220 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4221 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4222 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4223 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4224 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4225 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4226 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4227 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4228 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4229 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4230 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4231 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4232 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4233 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4234 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4235 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4236 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4237 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4238 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4239 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4240 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4241 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4242 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4243 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4244 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4245 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4246 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4247 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4248 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4249 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4250 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4251 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4252 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4253 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4254 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4255 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4256 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4257 | /* default Intel */ |
| 4258 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4259 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4260 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4261 | {} |
| 4262 | }; |
| 4263 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4264 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4265 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4266 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4267 | static struct alc_config_preset alc880_presets[] = { |
| 4268 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4269 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4270 | .init_verbs = { alc880_volume_init_verbs, |
| 4271 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4272 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4273 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4274 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4275 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4276 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4277 | .input_mux = &alc880_capture_source, |
| 4278 | }, |
| 4279 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4280 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4281 | .init_verbs = { alc880_volume_init_verbs, |
| 4282 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4283 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4284 | .dac_nids = alc880_dac_nids, |
| 4285 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4286 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4287 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4288 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4289 | .input_mux = &alc880_capture_source, |
| 4290 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4291 | [ALC880_TCL_S700] = { |
| 4292 | .mixers = { alc880_tcl_s700_mixer }, |
| 4293 | .init_verbs = { alc880_volume_init_verbs, |
| 4294 | alc880_pin_tcl_S700_init_verbs, |
| 4295 | alc880_gpio2_init_verbs }, |
| 4296 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4297 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4298 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4299 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4300 | .hp_nid = 0x03, |
| 4301 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4302 | .channel_mode = alc880_2_jack_modes, |
| 4303 | .input_mux = &alc880_capture_source, |
| 4304 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4305 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | .mixers = { alc880_three_stack_mixer, |
| 4307 | alc880_five_stack_mixer}, |
| 4308 | .init_verbs = { alc880_volume_init_verbs, |
| 4309 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4310 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4311 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4312 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4313 | .channel_mode = alc880_fivestack_modes, |
| 4314 | .input_mux = &alc880_capture_source, |
| 4315 | }, |
| 4316 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4317 | .mixers = { alc880_three_stack_mixer, |
| 4318 | alc880_five_stack_mixer }, |
| 4319 | .init_verbs = { alc880_volume_init_verbs, |
| 4320 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4321 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4322 | .dac_nids = alc880_dac_nids, |
| 4323 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4324 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4325 | .channel_mode = alc880_fivestack_modes, |
| 4326 | .input_mux = &alc880_capture_source, |
| 4327 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4328 | [ALC880_6ST] = { |
| 4329 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4330 | .init_verbs = { alc880_volume_init_verbs, |
| 4331 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4332 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4333 | .dac_nids = alc880_6st_dac_nids, |
| 4334 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4335 | .channel_mode = alc880_sixstack_modes, |
| 4336 | .input_mux = &alc880_6stack_capture_source, |
| 4337 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4338 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4339 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4340 | .init_verbs = { alc880_volume_init_verbs, |
| 4341 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4342 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4343 | .dac_nids = alc880_6st_dac_nids, |
| 4344 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4345 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4346 | .channel_mode = alc880_sixstack_modes, |
| 4347 | .input_mux = &alc880_6stack_capture_source, |
| 4348 | }, |
| 4349 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4350 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4351 | .init_verbs = { alc880_volume_init_verbs, |
| 4352 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4353 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4354 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4355 | .dac_nids = alc880_w810_dac_nids, |
| 4356 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4357 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4358 | .channel_mode = alc880_w810_modes, |
| 4359 | .input_mux = &alc880_capture_source, |
| 4360 | }, |
| 4361 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4362 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4363 | .init_verbs = { alc880_volume_init_verbs, |
| 4364 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4365 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4366 | .dac_nids = alc880_z71v_dac_nids, |
| 4367 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4368 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4369 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4370 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4371 | .input_mux = &alc880_capture_source, |
| 4372 | }, |
| 4373 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4375 | .init_verbs = { alc880_volume_init_verbs, |
| 4376 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4377 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4378 | .dac_nids = alc880_f1734_dac_nids, |
| 4379 | .hp_nid = 0x02, |
| 4380 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4381 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4382 | .input_mux = &alc880_f1734_capture_source, |
| 4383 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4384 | .setup = alc880_uniwill_p53_setup, |
| 4385 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4386 | }, |
| 4387 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4388 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4389 | .init_verbs = { alc880_volume_init_verbs, |
| 4390 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4391 | alc880_gpio1_init_verbs }, |
| 4392 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4393 | .dac_nids = alc880_asus_dac_nids, |
| 4394 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4395 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4396 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4397 | .input_mux = &alc880_capture_source, |
| 4398 | }, |
| 4399 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4400 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4401 | .init_verbs = { alc880_volume_init_verbs, |
| 4402 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4403 | alc880_gpio1_init_verbs }, |
| 4404 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4405 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4406 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4407 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4408 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4409 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4410 | .input_mux = &alc880_capture_source, |
| 4411 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4412 | [ALC880_ASUS_DIG2] = { |
| 4413 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4414 | .init_verbs = { alc880_volume_init_verbs, |
| 4415 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4416 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4417 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4418 | .dac_nids = alc880_asus_dac_nids, |
| 4419 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4420 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4421 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4422 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4423 | .input_mux = &alc880_capture_source, |
| 4424 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4425 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4426 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4427 | .init_verbs = { alc880_volume_init_verbs, |
| 4428 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | alc880_gpio1_init_verbs }, |
| 4430 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4431 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4432 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4433 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4434 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4435 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4436 | .input_mux = &alc880_capture_source, |
| 4437 | }, |
| 4438 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4439 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4440 | .init_verbs = { alc880_volume_init_verbs, |
| 4441 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4442 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4443 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4444 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4445 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4446 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4447 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4448 | .input_mux = &alc880_capture_source, |
| 4449 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4450 | [ALC880_UNIWILL] = { |
| 4451 | .mixers = { alc880_uniwill_mixer }, |
| 4452 | .init_verbs = { alc880_volume_init_verbs, |
| 4453 | alc880_uniwill_init_verbs }, |
| 4454 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4455 | .dac_nids = alc880_asus_dac_nids, |
| 4456 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4457 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4458 | .channel_mode = alc880_threestack_modes, |
| 4459 | .need_dac_fix = 1, |
| 4460 | .input_mux = &alc880_capture_source, |
| 4461 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4462 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4463 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4464 | }, |
| 4465 | [ALC880_UNIWILL_P53] = { |
| 4466 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4467 | .init_verbs = { alc880_volume_init_verbs, |
| 4468 | alc880_uniwill_p53_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_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4472 | .channel_mode = alc880_threestack_modes, |
| 4473 | .input_mux = &alc880_capture_source, |
| 4474 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4475 | .setup = alc880_uniwill_p53_setup, |
| 4476 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4477 | }, |
| 4478 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4479 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4480 | .init_verbs = { alc880_volume_init_verbs, |
| 4481 | alc880_uniwill_p53_init_verbs, |
| 4482 | alc880_beep_init_verbs }, |
| 4483 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4484 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4485 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4486 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4487 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4488 | .input_mux = &alc880_capture_source, |
| 4489 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4490 | .setup = alc880_uniwill_p53_setup, |
| 4491 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4492 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4493 | [ALC880_CLEVO] = { |
| 4494 | .mixers = { alc880_three_stack_mixer }, |
| 4495 | .init_verbs = { alc880_volume_init_verbs, |
| 4496 | alc880_pin_clevo_init_verbs }, |
| 4497 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4498 | .dac_nids = alc880_dac_nids, |
| 4499 | .hp_nid = 0x03, |
| 4500 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4501 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4502 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4503 | .input_mux = &alc880_capture_source, |
| 4504 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4505 | [ALC880_LG] = { |
| 4506 | .mixers = { alc880_lg_mixer }, |
| 4507 | .init_verbs = { alc880_volume_init_verbs, |
| 4508 | alc880_lg_init_verbs }, |
| 4509 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4510 | .dac_nids = alc880_lg_dac_nids, |
| 4511 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4512 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4513 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4514 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4515 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4516 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4517 | .setup = alc880_lg_setup, |
| 4518 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4519 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4520 | .loopbacks = alc880_lg_loopbacks, |
| 4521 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4522 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4523 | [ALC880_LG_LW] = { |
| 4524 | .mixers = { alc880_lg_lw_mixer }, |
| 4525 | .init_verbs = { alc880_volume_init_verbs, |
| 4526 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4527 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4528 | .dac_nids = alc880_dac_nids, |
| 4529 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4530 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4531 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4532 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4533 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4534 | .setup = alc880_lg_lw_setup, |
| 4535 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4536 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4537 | [ALC880_MEDION_RIM] = { |
| 4538 | .mixers = { alc880_medion_rim_mixer }, |
| 4539 | .init_verbs = { alc880_volume_init_verbs, |
| 4540 | alc880_medion_rim_init_verbs, |
| 4541 | alc_gpio2_init_verbs }, |
| 4542 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4543 | .dac_nids = alc880_dac_nids, |
| 4544 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4545 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4546 | .channel_mode = alc880_2_jack_modes, |
| 4547 | .input_mux = &alc880_medion_rim_capture_source, |
| 4548 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4549 | .setup = alc880_medion_rim_setup, |
| 4550 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4551 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4552 | #ifdef CONFIG_SND_DEBUG |
| 4553 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4554 | .mixers = { alc880_test_mixer }, |
| 4555 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4556 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4557 | .dac_nids = alc880_test_dac_nids, |
| 4558 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4559 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4560 | .channel_mode = alc880_test_modes, |
| 4561 | .input_mux = &alc880_test_capture_source, |
| 4562 | }, |
| 4563 | #endif |
| 4564 | }; |
| 4565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4566 | /* |
| 4567 | * Automatic parse of I/O pins from the BIOS configuration |
| 4568 | */ |
| 4569 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4570 | enum { |
| 4571 | ALC_CTL_WIDGET_VOL, |
| 4572 | ALC_CTL_WIDGET_MUTE, |
| 4573 | ALC_CTL_BIND_MUTE, |
| 4574 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4575 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4576 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4577 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4578 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4579 | }; |
| 4580 | |
| 4581 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4582 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4583 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4584 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4585 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4586 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4587 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4588 | knew = snd_array_new(&spec->kctls); |
| 4589 | if (!knew) |
| 4590 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4591 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4592 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4593 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4594 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4595 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4596 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4597 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4598 | return 0; |
| 4599 | } |
| 4600 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4601 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4602 | const char *pfx, const char *dir, |
| 4603 | const char *sfx, unsigned long val) |
| 4604 | { |
| 4605 | char name[32]; |
| 4606 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4607 | return add_control(spec, type, name, val); |
| 4608 | } |
| 4609 | |
| 4610 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4611 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4612 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4613 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4614 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4615 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4616 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4617 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4618 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4619 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4620 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4621 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4622 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4623 | #define ALC880_PIN_CD_NID 0x1c |
| 4624 | |
| 4625 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4626 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4627 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4628 | { |
| 4629 | hda_nid_t nid; |
| 4630 | int assigned[4]; |
| 4631 | int i, j; |
| 4632 | |
| 4633 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4634 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4635 | |
| 4636 | /* check the pins hardwired to audio widget */ |
| 4637 | for (i = 0; i < cfg->line_outs; i++) { |
| 4638 | nid = cfg->line_out_pins[i]; |
| 4639 | if (alc880_is_fixed_pin(nid)) { |
| 4640 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4641 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4642 | assigned[idx] = 1; |
| 4643 | } |
| 4644 | } |
| 4645 | /* left pins can be connect to any audio widget */ |
| 4646 | for (i = 0; i < cfg->line_outs; i++) { |
| 4647 | nid = cfg->line_out_pins[i]; |
| 4648 | if (alc880_is_fixed_pin(nid)) |
| 4649 | continue; |
| 4650 | /* search for an empty channel */ |
| 4651 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4652 | if (!assigned[j]) { |
| 4653 | spec->multiout.dac_nids[i] = |
| 4654 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4655 | assigned[j] = 1; |
| 4656 | break; |
| 4657 | } |
| 4658 | } |
| 4659 | } |
| 4660 | spec->multiout.num_dacs = cfg->line_outs; |
| 4661 | return 0; |
| 4662 | } |
| 4663 | |
| 4664 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4665 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4666 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4667 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4668 | static const char *chname[4] = { |
| 4669 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4670 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4671 | hda_nid_t nid; |
| 4672 | int i, err; |
| 4673 | |
| 4674 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4675 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4676 | continue; |
| 4677 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4678 | if (i == 2) { |
| 4679 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4680 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4681 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4682 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4683 | HDA_OUTPUT)); |
| 4684 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4685 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4686 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4687 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4688 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4689 | HDA_OUTPUT)); |
| 4690 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4691 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4692 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4693 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4694 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4695 | HDA_INPUT)); |
| 4696 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4697 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4698 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4699 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4700 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4701 | HDA_INPUT)); |
| 4702 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4703 | return err; |
| 4704 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4705 | const char *pfx; |
| 4706 | if (cfg->line_outs == 1 && |
| 4707 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4708 | pfx = "Speaker"; |
| 4709 | else |
| 4710 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4711 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4712 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4713 | HDA_OUTPUT)); |
| 4714 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4715 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4716 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4717 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4718 | HDA_INPUT)); |
| 4719 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4720 | return err; |
| 4721 | } |
| 4722 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4723 | return 0; |
| 4724 | } |
| 4725 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4726 | /* add playback controls for speaker and HP outputs */ |
| 4727 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4728 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4729 | { |
| 4730 | hda_nid_t nid; |
| 4731 | int err; |
| 4732 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4733 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4734 | return 0; |
| 4735 | |
| 4736 | if (alc880_is_fixed_pin(pin)) { |
| 4737 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4738 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4739 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4740 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4741 | else |
| 4742 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4743 | /* control HP volume/switch on the output mixer amp */ |
| 4744 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4745 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4746 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4747 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4749 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4750 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4751 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4752 | return err; |
| 4753 | } else if (alc880_is_multi_pin(pin)) { |
| 4754 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4755 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4756 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4757 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4758 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4759 | return err; |
| 4760 | } |
| 4761 | return 0; |
| 4762 | } |
| 4763 | |
| 4764 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4765 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4766 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4767 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4769 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4770 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4771 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4772 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, 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_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4776 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4777 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4778 | return err; |
| 4779 | return 0; |
| 4780 | } |
| 4781 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4782 | 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] | 4783 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4784 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4785 | return (pincap & AC_PINCAP_IN) != 0; |
| 4786 | } |
| 4787 | |
| 4788 | /* create playback/capture controls for input pins */ |
| 4789 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4790 | const struct auto_pin_cfg *cfg, |
| 4791 | hda_nid_t mixer, |
| 4792 | hda_nid_t cap1, hda_nid_t cap2) |
| 4793 | { |
| 4794 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4795 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4796 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4797 | |
| 4798 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4799 | hda_nid_t pin; |
| 4800 | |
| 4801 | pin = cfg->input_pins[i]; |
| 4802 | if (!alc_is_input_pin(codec, pin)) |
| 4803 | continue; |
| 4804 | |
| 4805 | if (mixer) { |
| 4806 | idx = get_connection_index(codec, mixer, pin); |
| 4807 | if (idx >= 0) { |
| 4808 | err = new_analog_input(spec, pin, |
| 4809 | auto_pin_cfg_labels[i], |
| 4810 | idx, mixer); |
| 4811 | if (err < 0) |
| 4812 | return err; |
| 4813 | } |
| 4814 | } |
| 4815 | |
| 4816 | if (!cap1) |
| 4817 | continue; |
| 4818 | idx = get_connection_index(codec, cap1, pin); |
| 4819 | if (idx < 0 && cap2) |
| 4820 | idx = get_connection_index(codec, cap2, pin); |
| 4821 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4822 | imux->items[imux->num_items].label = |
| 4823 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4824 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4825 | imux->num_items++; |
| 4826 | } |
| 4827 | } |
| 4828 | return 0; |
| 4829 | } |
| 4830 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4831 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4832 | const struct auto_pin_cfg *cfg) |
| 4833 | { |
| 4834 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4835 | } |
| 4836 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4837 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4838 | unsigned int pin_type) |
| 4839 | { |
| 4840 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4841 | pin_type); |
| 4842 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4843 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4844 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4845 | } |
| 4846 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4847 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4848 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4849 | int dac_idx) |
| 4850 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4851 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4852 | /* need the manual connection? */ |
| 4853 | if (alc880_is_multi_pin(nid)) { |
| 4854 | struct alc_spec *spec = codec->spec; |
| 4855 | int idx = alc880_multi_pin_idx(nid); |
| 4856 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4857 | AC_VERB_SET_CONNECT_SEL, |
| 4858 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4859 | } |
| 4860 | } |
| 4861 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4862 | static int get_pin_type(int line_out_type) |
| 4863 | { |
| 4864 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4865 | return PIN_HP; |
| 4866 | else |
| 4867 | return PIN_OUT; |
| 4868 | } |
| 4869 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4870 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4871 | { |
| 4872 | struct alc_spec *spec = codec->spec; |
| 4873 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4874 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4875 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4876 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4877 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4878 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4879 | } |
| 4880 | } |
| 4881 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4882 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4883 | { |
| 4884 | struct alc_spec *spec = codec->spec; |
| 4885 | hda_nid_t pin; |
| 4886 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4887 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4888 | if (pin) /* connect to front */ |
| 4889 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4890 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4891 | if (pin) /* connect to front */ |
| 4892 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4893 | } |
| 4894 | |
| 4895 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4896 | { |
| 4897 | struct alc_spec *spec = codec->spec; |
| 4898 | int i; |
| 4899 | |
| 4900 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4901 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4902 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4903 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4904 | if (nid != ALC880_PIN_CD_NID && |
| 4905 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4906 | snd_hda_codec_write(codec, nid, 0, |
| 4907 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4908 | AMP_OUT_MUTE); |
| 4909 | } |
| 4910 | } |
| 4911 | } |
| 4912 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4913 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 4914 | { |
| 4915 | struct alc_spec *spec = codec->spec; |
| 4916 | int c; |
| 4917 | |
| 4918 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 4919 | unsigned int mux_idx; |
| 4920 | const struct hda_input_mux *imux; |
| 4921 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 4922 | imux = &spec->input_mux[mux_idx]; |
| 4923 | if (!imux->num_items && mux_idx > 0) |
| 4924 | imux = &spec->input_mux[0]; |
| 4925 | if (imux) |
| 4926 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 4927 | AC_VERB_SET_CONNECT_SEL, |
| 4928 | imux->items[0].index); |
| 4929 | } |
| 4930 | } |
| 4931 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4932 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4933 | /* return 1 if successful, 0 if the proper config is not found, |
| 4934 | * or a negative error code |
| 4935 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4936 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4937 | { |
| 4938 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4939 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4940 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4941 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4942 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4943 | alc880_ignore); |
| 4944 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4945 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4946 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4948 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4949 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4950 | if (err < 0) |
| 4951 | return err; |
| 4952 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4953 | if (err < 0) |
| 4954 | return err; |
| 4955 | err = alc880_auto_create_extra_out(spec, |
| 4956 | spec->autocfg.speaker_pins[0], |
| 4957 | "Speaker"); |
| 4958 | if (err < 0) |
| 4959 | return err; |
| 4960 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4961 | "Headphone"); |
| 4962 | if (err < 0) |
| 4963 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4964 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4965 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4966 | return err; |
| 4967 | |
| 4968 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4969 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4970 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4971 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4972 | hda_nid_t dig_nid; |
| 4973 | err = snd_hda_get_connections(codec, |
| 4974 | spec->autocfg.dig_out_pins[i], |
| 4975 | &dig_nid, 1); |
| 4976 | if (err < 0) |
| 4977 | continue; |
| 4978 | if (!i) |
| 4979 | spec->multiout.dig_out_nid = dig_nid; |
| 4980 | else { |
| 4981 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4982 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4983 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4984 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4985 | } |
| 4986 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4987 | if (spec->autocfg.dig_in_pin) |
| 4988 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4989 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4990 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4991 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4992 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4993 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4994 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4995 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4996 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4997 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 4998 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4999 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5000 | return 1; |
| 5001 | } |
| 5002 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5003 | /* additional initialization for auto-configuration model */ |
| 5004 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5005 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5006 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5007 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5008 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5010 | alc880_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5011 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5012 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5013 | } |
| 5014 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5015 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5016 | * one of two digital mic pins, e.g. on ALC272 |
| 5017 | */ |
| 5018 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5019 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5020 | struct alc_spec *spec = codec->spec; |
| 5021 | int i; |
| 5022 | |
| 5023 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5024 | hda_nid_t cap = spec->capsrc_nids ? |
| 5025 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5026 | int iidx, eidx; |
| 5027 | |
| 5028 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5029 | if (iidx < 0) |
| 5030 | continue; |
| 5031 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5032 | if (eidx < 0) |
| 5033 | continue; |
| 5034 | spec->int_mic.mux_idx = iidx; |
| 5035 | spec->ext_mic.mux_idx = eidx; |
| 5036 | if (spec->capsrc_nids) |
| 5037 | spec->capsrc_nids += i; |
| 5038 | spec->adc_nids += i; |
| 5039 | spec->num_adc_nids = 1; |
| 5040 | return; |
| 5041 | } |
| 5042 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5043 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5044 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5045 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5046 | } |
| 5047 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5048 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5049 | static void fixup_single_adc(struct hda_codec *codec) |
| 5050 | { |
| 5051 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5052 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5053 | int i; |
| 5054 | |
| 5055 | /* search for the input pin; there must be only one */ |
| 5056 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5057 | if (spec->autocfg.input_pins[i]) { |
| 5058 | pin = spec->autocfg.input_pins[i]; |
| 5059 | break; |
| 5060 | } |
| 5061 | } |
| 5062 | if (!pin) |
| 5063 | return; |
| 5064 | |
| 5065 | /* set the default connection to that pin */ |
| 5066 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5067 | hda_nid_t cap = spec->capsrc_nids ? |
| 5068 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5069 | int idx; |
| 5070 | |
| 5071 | idx = get_connection_index(codec, cap, pin); |
| 5072 | if (idx < 0) |
| 5073 | continue; |
| 5074 | /* use only this ADC */ |
| 5075 | if (spec->capsrc_nids) |
| 5076 | spec->capsrc_nids += i; |
| 5077 | spec->adc_nids += i; |
| 5078 | spec->num_adc_nids = 1; |
| 5079 | /* select or unmute this route */ |
| 5080 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5081 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5082 | HDA_AMP_MUTE, 0); |
| 5083 | } else { |
| 5084 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5085 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5086 | } |
| 5087 | return; |
| 5088 | } |
| 5089 | } |
| 5090 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5091 | static void set_capture_mixer(struct hda_codec *codec) |
| 5092 | { |
| 5093 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5094 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5095 | { alc_capture_mixer_nosrc1, |
| 5096 | alc_capture_mixer_nosrc2, |
| 5097 | alc_capture_mixer_nosrc3 }, |
| 5098 | { alc_capture_mixer1, |
| 5099 | alc_capture_mixer2, |
| 5100 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5101 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5102 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5103 | int mux = 0; |
| 5104 | if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5105 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5106 | else if (spec->input_mux) { |
| 5107 | if (spec->input_mux->num_items > 1) |
| 5108 | mux = 1; |
| 5109 | else if (spec->input_mux->num_items == 1) |
| 5110 | fixup_single_adc(codec); |
| 5111 | } |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5112 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 5113 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5114 | } |
| 5115 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5116 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5117 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5118 | int num_nids) |
| 5119 | { |
| 5120 | struct alc_spec *spec = codec->spec; |
| 5121 | int n; |
| 5122 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5123 | |
| 5124 | for (n = 0; n < num_nids; n++) { |
| 5125 | hda_nid_t adc, cap; |
| 5126 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5127 | int nconns, i, j; |
| 5128 | |
| 5129 | adc = nids[n]; |
| 5130 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5131 | continue; |
| 5132 | cap = adc; |
| 5133 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5134 | ARRAY_SIZE(conn)); |
| 5135 | if (nconns == 1) { |
| 5136 | cap = conn[0]; |
| 5137 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5138 | ARRAY_SIZE(conn)); |
| 5139 | } |
| 5140 | if (nconns <= 0) |
| 5141 | continue; |
| 5142 | if (!fallback_adc) { |
| 5143 | fallback_adc = adc; |
| 5144 | fallback_cap = cap; |
| 5145 | } |
| 5146 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5147 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5148 | if (!nid) |
| 5149 | continue; |
| 5150 | for (j = 0; j < nconns; j++) { |
| 5151 | if (conn[j] == nid) |
| 5152 | break; |
| 5153 | } |
| 5154 | if (j >= nconns) |
| 5155 | break; |
| 5156 | } |
| 5157 | if (i >= AUTO_PIN_LAST) { |
| 5158 | int num_adcs = spec->num_adc_nids; |
| 5159 | spec->private_adc_nids[num_adcs] = adc; |
| 5160 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5161 | spec->num_adc_nids++; |
| 5162 | spec->adc_nids = spec->private_adc_nids; |
| 5163 | if (adc != cap) |
| 5164 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5165 | } |
| 5166 | } |
| 5167 | if (!spec->num_adc_nids) { |
| 5168 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5169 | " using fallback 0x%x\n", |
| 5170 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5171 | spec->private_adc_nids[0] = fallback_adc; |
| 5172 | spec->adc_nids = spec->private_adc_nids; |
| 5173 | if (fallback_adc != fallback_cap) { |
| 5174 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5175 | spec->capsrc_nids = spec->private_adc_nids; |
| 5176 | } |
| 5177 | } |
| 5178 | } |
| 5179 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5180 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5181 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5182 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 5183 | |
| 5184 | static struct snd_pci_quirk beep_white_list[] = { |
| 5185 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
| 5186 | {} |
| 5187 | }; |
| 5188 | |
| 5189 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5190 | { |
| 5191 | struct alc_spec *spec = codec->spec; |
| 5192 | const struct snd_pci_quirk *q; |
| 5193 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5194 | if (q) |
| 5195 | return q->value; |
| 5196 | return spec->cdefine.enable_pcbeep; |
| 5197 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5198 | #else |
| 5199 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 5200 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5201 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5202 | |
| 5203 | /* |
| 5204 | * OK, here we have finally the patch for ALC880 |
| 5205 | */ |
| 5206 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5207 | static int patch_alc880(struct hda_codec *codec) |
| 5208 | { |
| 5209 | struct alc_spec *spec; |
| 5210 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5211 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5212 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5213 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5214 | if (spec == NULL) |
| 5215 | return -ENOMEM; |
| 5216 | |
| 5217 | codec->spec = spec; |
| 5218 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5219 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5220 | alc880_models, |
| 5221 | alc880_cfg_tbl); |
| 5222 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5223 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5224 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5225 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5226 | } |
| 5227 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5228 | if (board_config == ALC880_AUTO) { |
| 5229 | /* automatic parse from the BIOS config */ |
| 5230 | err = alc880_parse_auto_config(codec); |
| 5231 | if (err < 0) { |
| 5232 | alc_free(codec); |
| 5233 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5234 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5235 | printk(KERN_INFO |
| 5236 | "hda_codec: Cannot set up configuration " |
| 5237 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5238 | board_config = ALC880_3ST; |
| 5239 | } |
| 5240 | } |
| 5241 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5242 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5243 | if (err < 0) { |
| 5244 | alc_free(codec); |
| 5245 | return err; |
| 5246 | } |
| 5247 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5248 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5249 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5250 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5251 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5252 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5253 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5254 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5255 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5256 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5258 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5259 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5260 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5261 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5262 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5263 | if (wcap != AC_WID_AUD_IN) { |
| 5264 | spec->adc_nids = alc880_adc_nids_alt; |
| 5265 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5266 | } else { |
| 5267 | spec->adc_nids = alc880_adc_nids; |
| 5268 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5269 | } |
| 5270 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5271 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5272 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5273 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5274 | spec->vmaster_nid = 0x0c; |
| 5275 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5276 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5277 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5278 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5279 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5280 | if (!spec->loopback.amplist) |
| 5281 | spec->loopback.amplist = alc880_loopbacks; |
| 5282 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5283 | |
| 5284 | return 0; |
| 5285 | } |
| 5286 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5287 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5288 | /* |
| 5289 | * ALC260 support |
| 5290 | */ |
| 5291 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5292 | static hda_nid_t alc260_dac_nids[1] = { |
| 5293 | /* front */ |
| 5294 | 0x02, |
| 5295 | }; |
| 5296 | |
| 5297 | static hda_nid_t alc260_adc_nids[1] = { |
| 5298 | /* ADC0 */ |
| 5299 | 0x04, |
| 5300 | }; |
| 5301 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5302 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5303 | /* ADC1 */ |
| 5304 | 0x05, |
| 5305 | }; |
| 5306 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5307 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5308 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5309 | */ |
| 5310 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5311 | /* ADC0, ADC1 */ |
| 5312 | 0x04, 0x05 |
| 5313 | }; |
| 5314 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5315 | #define ALC260_DIGOUT_NID 0x03 |
| 5316 | #define ALC260_DIGIN_NID 0x06 |
| 5317 | |
| 5318 | static struct hda_input_mux alc260_capture_source = { |
| 5319 | .num_items = 4, |
| 5320 | .items = { |
| 5321 | { "Mic", 0x0 }, |
| 5322 | { "Front Mic", 0x1 }, |
| 5323 | { "Line", 0x2 }, |
| 5324 | { "CD", 0x4 }, |
| 5325 | }, |
| 5326 | }; |
| 5327 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5328 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5329 | * headphone jack and the internal CD lines since these are the only pins at |
| 5330 | * which audio can appear. For flexibility, also allow the option of |
| 5331 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5332 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5333 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5334 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5335 | { |
| 5336 | .num_items = 3, |
| 5337 | .items = { |
| 5338 | { "Mic/Line", 0x0 }, |
| 5339 | { "CD", 0x4 }, |
| 5340 | { "Headphone", 0x2 }, |
| 5341 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5342 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5343 | { |
| 5344 | .num_items = 4, |
| 5345 | .items = { |
| 5346 | { "Mic/Line", 0x0 }, |
| 5347 | { "CD", 0x4 }, |
| 5348 | { "Headphone", 0x2 }, |
| 5349 | { "Mixer", 0x5 }, |
| 5350 | }, |
| 5351 | }, |
| 5352 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5353 | }; |
| 5354 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5355 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5356 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5357 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5358 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5359 | { |
| 5360 | .num_items = 4, |
| 5361 | .items = { |
| 5362 | { "Mic", 0x0 }, |
| 5363 | { "Line", 0x2 }, |
| 5364 | { "CD", 0x4 }, |
| 5365 | { "Headphone", 0x5 }, |
| 5366 | }, |
| 5367 | }, |
| 5368 | { |
| 5369 | .num_items = 5, |
| 5370 | .items = { |
| 5371 | { "Mic", 0x0 }, |
| 5372 | { "Line", 0x2 }, |
| 5373 | { "CD", 0x4 }, |
| 5374 | { "Headphone", 0x6 }, |
| 5375 | { "Mixer", 0x5 }, |
| 5376 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5377 | }, |
| 5378 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5379 | |
| 5380 | /* Maxdata Favorit 100XS */ |
| 5381 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5382 | { |
| 5383 | .num_items = 2, |
| 5384 | .items = { |
| 5385 | { "Line/Mic", 0x0 }, |
| 5386 | { "CD", 0x4 }, |
| 5387 | }, |
| 5388 | }, |
| 5389 | { |
| 5390 | .num_items = 3, |
| 5391 | .items = { |
| 5392 | { "Line/Mic", 0x0 }, |
| 5393 | { "CD", 0x4 }, |
| 5394 | { "Mixer", 0x5 }, |
| 5395 | }, |
| 5396 | }, |
| 5397 | }; |
| 5398 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5399 | /* |
| 5400 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5401 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5402 | * element which allows changing the channel mode, so the verb list is |
| 5403 | * never used. |
| 5404 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5405 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5406 | { 2, NULL }, |
| 5407 | }; |
| 5408 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5409 | |
| 5410 | /* Mixer combinations |
| 5411 | * |
| 5412 | * basic: base_output + input + pc_beep + capture |
| 5413 | * HP: base_output + input + capture_alt |
| 5414 | * HP_3013: hp_3013 + input + capture |
| 5415 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5416 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5417 | */ |
| 5418 | |
| 5419 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5420 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5421 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5422 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5423 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5424 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5425 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5426 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5427 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5428 | |
| 5429 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5430 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5431 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5432 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5433 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5434 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5435 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5436 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5437 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5438 | { } /* end */ |
| 5439 | }; |
| 5440 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5441 | /* update HP, line and mono out pins according to the master switch */ |
| 5442 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5443 | hda_nid_t hp, hda_nid_t line, |
| 5444 | hda_nid_t mono) |
| 5445 | { |
| 5446 | struct alc_spec *spec = codec->spec; |
| 5447 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5448 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5449 | 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] | 5450 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5451 | 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] | 5452 | val); |
| 5453 | /* mono (speaker) depending on the HP jack sense */ |
| 5454 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5455 | 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] | 5456 | val); |
| 5457 | } |
| 5458 | |
| 5459 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5460 | struct snd_ctl_elem_value *ucontrol) |
| 5461 | { |
| 5462 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5463 | struct alc_spec *spec = codec->spec; |
| 5464 | *ucontrol->value.integer.value = spec->master_sw; |
| 5465 | return 0; |
| 5466 | } |
| 5467 | |
| 5468 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5469 | struct snd_ctl_elem_value *ucontrol) |
| 5470 | { |
| 5471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5472 | struct alc_spec *spec = codec->spec; |
| 5473 | int val = !!*ucontrol->value.integer.value; |
| 5474 | hda_nid_t hp, line, mono; |
| 5475 | |
| 5476 | if (val == spec->master_sw) |
| 5477 | return 0; |
| 5478 | spec->master_sw = val; |
| 5479 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5480 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5481 | mono = kcontrol->private_value & 0xff; |
| 5482 | alc260_hp_master_update(codec, hp, line, mono); |
| 5483 | return 1; |
| 5484 | } |
| 5485 | |
| 5486 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5487 | { |
| 5488 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5489 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5490 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5491 | .info = snd_ctl_boolean_mono_info, |
| 5492 | .get = alc260_hp_master_sw_get, |
| 5493 | .put = alc260_hp_master_sw_put, |
| 5494 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5495 | }, |
| 5496 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5497 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5498 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5499 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5500 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5501 | HDA_OUTPUT), |
| 5502 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5503 | { } /* end */ |
| 5504 | }; |
| 5505 | |
| 5506 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5507 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5508 | {}, |
| 5509 | }; |
| 5510 | |
| 5511 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5512 | { |
| 5513 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5514 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5515 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5516 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5517 | } |
| 5518 | |
| 5519 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5520 | { |
| 5521 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5522 | alc260_hp_automute(codec); |
| 5523 | } |
| 5524 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5525 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5526 | { |
| 5527 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5528 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5529 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5530 | .info = snd_ctl_boolean_mono_info, |
| 5531 | .get = alc260_hp_master_sw_get, |
| 5532 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5533 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5534 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5535 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5536 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5537 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5538 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5539 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5540 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5541 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5542 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5543 | { } /* end */ |
| 5544 | }; |
| 5545 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5546 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5547 | .ops = &snd_hda_bind_vol, |
| 5548 | .values = { |
| 5549 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5550 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5551 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5552 | 0 |
| 5553 | }, |
| 5554 | }; |
| 5555 | |
| 5556 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5557 | .ops = &snd_hda_bind_sw, |
| 5558 | .values = { |
| 5559 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5560 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5561 | 0 |
| 5562 | }, |
| 5563 | }; |
| 5564 | |
| 5565 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5566 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5567 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5568 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5569 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5570 | { } /* end */ |
| 5571 | }; |
| 5572 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5573 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5574 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5575 | {}, |
| 5576 | }; |
| 5577 | |
| 5578 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5579 | { |
| 5580 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5581 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5582 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5583 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5584 | } |
| 5585 | |
| 5586 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5587 | unsigned int res) |
| 5588 | { |
| 5589 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5590 | alc260_hp_3013_automute(codec); |
| 5591 | } |
| 5592 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5593 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5594 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5595 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5596 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5597 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5598 | bits); |
| 5599 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5600 | bits); |
| 5601 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5602 | bits); |
| 5603 | } |
| 5604 | |
| 5605 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5606 | unsigned int res) |
| 5607 | { |
| 5608 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5609 | alc260_hp_3012_automute(codec); |
| 5610 | } |
| 5611 | |
| 5612 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5613 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5614 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5615 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5616 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5617 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5618 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5619 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5620 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5621 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5622 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5623 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5624 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5625 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5626 | { } /* end */ |
| 5627 | }; |
| 5628 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5629 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5630 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5631 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5632 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5633 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5634 | * revisions available in early 2006. Therefore for now allow the |
| 5635 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5636 | * that the lack of mic bias for this NID is intentional we could change the |
| 5637 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5638 | * |
| 5639 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5640 | * don't appear to make the mic bias available from the "line" jack, even |
| 5641 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5642 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5643 | * and the output jack. If this turns out to be the case for all such |
| 5644 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5645 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5646 | * |
| 5647 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5648 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5649 | * controls for such models. On models without a "mono speaker" the control |
| 5650 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5651 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5652 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5653 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5654 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5655 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5656 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5657 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5658 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5659 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5660 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5661 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5663 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5664 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5665 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5666 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5667 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5668 | { } /* end */ |
| 5669 | }; |
| 5670 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5671 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5672 | */ |
| 5673 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5675 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5676 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5677 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5678 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5679 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5680 | { } /* end */ |
| 5681 | }; |
| 5682 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5683 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5684 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5685 | */ |
| 5686 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5687 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5688 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5689 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5690 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5691 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5692 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5693 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5694 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5695 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5696 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5697 | { } /* end */ |
| 5698 | }; |
| 5699 | |
| 5700 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5701 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5702 | */ |
| 5703 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5704 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5705 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5708 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5709 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5710 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5711 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5712 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5713 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5714 | { } /* end */ |
| 5715 | }; |
| 5716 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5717 | /* |
| 5718 | * initialization verbs |
| 5719 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5720 | static struct hda_verb alc260_init_verbs[] = { |
| 5721 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5722 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5723 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5724 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5725 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5726 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5727 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5728 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5729 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5730 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5731 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5732 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5733 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5734 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5735 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5736 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5737 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5738 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5739 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5740 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5741 | /* set connection select to line in (default select for this ADC) */ |
| 5742 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5743 | /* mute capture amp left and right */ |
| 5744 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5745 | /* set connection select to line in (default select for this ADC) */ |
| 5746 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5747 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5749 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5751 | /* set vol=0 HP mixer amp left and right */ |
| 5752 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5753 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5754 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5755 | /* set vol=0 Mono mixer amp left and right */ |
| 5756 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5757 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5758 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5759 | /* unmute LINE-2 out pin */ |
| 5760 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5761 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5762 | * Line In 2 = 0x03 |
| 5763 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5764 | /* mute analog inputs */ |
| 5765 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5767 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5769 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5770 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5771 | /* mute Front out path */ |
| 5772 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5773 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5774 | /* mute Headphone out path */ |
| 5775 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5776 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5777 | /* mute Mono out path */ |
| 5778 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5779 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5780 | { } |
| 5781 | }; |
| 5782 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5783 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5784 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5785 | /* Headphone and output */ |
| 5786 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5787 | /* mono output */ |
| 5788 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5789 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5790 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5791 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5792 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5793 | /* Line In pin widget for input */ |
| 5794 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5795 | /* Line-2 pin widget for output */ |
| 5796 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5797 | /* CD pin widget for input */ |
| 5798 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5799 | /* unmute amp left and right */ |
| 5800 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5801 | /* set connection select to line in (default select for this ADC) */ |
| 5802 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5803 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5804 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5805 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5806 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5807 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5808 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5809 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5810 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5811 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5812 | * Line In 2 = 0x03 |
| 5813 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5814 | /* mute analog inputs */ |
| 5815 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5817 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5821 | /* Unmute Front out path */ |
| 5822 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5824 | /* Unmute Headphone out path */ |
| 5825 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5827 | /* Unmute Mono out path */ |
| 5828 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5829 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5830 | { } |
| 5831 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5832 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | |
| 5834 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5835 | /* Line out and output */ |
| 5836 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5837 | /* mono output */ |
| 5838 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5839 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5840 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5841 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5842 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5843 | /* Line In pin widget for input */ |
| 5844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5845 | /* Headphone pin widget for output */ |
| 5846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5847 | /* CD pin widget for input */ |
| 5848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5849 | /* unmute amp left and right */ |
| 5850 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5851 | /* set connection select to line in (default select for this ADC) */ |
| 5852 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5853 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5854 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5855 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5856 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5857 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5858 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5859 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5860 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5861 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5862 | * Line In 2 = 0x03 |
| 5863 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5864 | /* mute analog inputs */ |
| 5865 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5866 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5867 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5869 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5871 | /* Unmute Front out path */ |
| 5872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5873 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5874 | /* Unmute Headphone out path */ |
| 5875 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5877 | /* Unmute Mono out path */ |
| 5878 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5879 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5880 | { } |
| 5881 | }; |
| 5882 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5883 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5884 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5885 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5886 | */ |
| 5887 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5888 | /* Disable all GPIOs */ |
| 5889 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5890 | /* Internal speaker is connected to headphone pin */ |
| 5891 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5892 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5893 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5894 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5895 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5896 | /* Ensure all other unused pins are disabled and muted. */ |
| 5897 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5898 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5899 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5900 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5901 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5902 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5903 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5904 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5905 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5906 | /* Disable digital (SPDIF) pins */ |
| 5907 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5908 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5909 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5910 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5911 | * when acting as an output. |
| 5912 | */ |
| 5913 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5914 | |
| 5915 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5916 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5918 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5919 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5921 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5922 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5923 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5924 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5925 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5926 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5927 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5928 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5929 | * If the pin mode is changed by the user the pin mode control will |
| 5930 | * take care of enabling the pin's input/output buffers as needed. |
| 5931 | * Therefore there's no need to enable the input buffer at this |
| 5932 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5933 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5934 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5935 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5936 | * mixer ctrl) |
| 5937 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5938 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5939 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5940 | /* Mute capture amp left and right */ |
| 5941 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5942 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5943 | * in (on mic1 pin) |
| 5944 | */ |
| 5945 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5946 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5947 | /* Do the same for the second ADC: mute capture input amp and |
| 5948 | * set ADC connection to line in (on mic1 pin) |
| 5949 | */ |
| 5950 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5951 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5952 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5953 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5961 | {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] | 5962 | |
| 5963 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5964 | }; |
| 5965 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5966 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5967 | * similar laptops (adapted from Fujitsu init verbs). |
| 5968 | */ |
| 5969 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5970 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5971 | * the headphone jack. Turn this on and rely on the standard mute |
| 5972 | * methods whenever the user wants to turn these outputs off. |
| 5973 | */ |
| 5974 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5975 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5976 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5977 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5978 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5979 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5980 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5981 | /* Line In jack is connected to Line1 pin */ |
| 5982 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5983 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5984 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5985 | /* Ensure all other unused pins are disabled and muted. */ |
| 5986 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5987 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5988 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5989 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5990 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5991 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5992 | /* Disable digital (SPDIF) pins */ |
| 5993 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5994 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5995 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5996 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5997 | * bus when acting as outputs. |
| 5998 | */ |
| 5999 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6000 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6001 | |
| 6002 | /* Start with output sum widgets muted and their output gains at min */ |
| 6003 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6004 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6005 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6006 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6007 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6009 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6010 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6011 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6012 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6013 | /* Unmute Line-out pin widget amp left and right |
| 6014 | * (no equiv mixer ctrl) |
| 6015 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6016 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6017 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6018 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6019 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6020 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6021 | * will take care of enabling the pin's input/output buffers as needed. |
| 6022 | * Therefore there's no need to enable the input buffer at this |
| 6023 | * stage. |
| 6024 | */ |
| 6025 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6026 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6027 | |
| 6028 | /* Mute capture amp left and right */ |
| 6029 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6030 | /* Set ADC connection select to match default mixer setting - mic |
| 6031 | * (on mic1 pin) |
| 6032 | */ |
| 6033 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6034 | |
| 6035 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6036 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6037 | */ |
| 6038 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6039 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6040 | |
| 6041 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6042 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6043 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6046 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6048 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6049 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6050 | |
| 6051 | { } |
| 6052 | }; |
| 6053 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6054 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6055 | * (adapted from Acer init verbs). |
| 6056 | */ |
| 6057 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6058 | /* GPIO 0 enables the output jack. |
| 6059 | * Turn this on and rely on the standard mute |
| 6060 | * methods whenever the user wants to turn these outputs off. |
| 6061 | */ |
| 6062 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6063 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6064 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6065 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6066 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6067 | /* Ensure all other unused pins are disabled and muted. */ |
| 6068 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6069 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6070 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6071 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6072 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6073 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6074 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6075 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6076 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6077 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6078 | /* Disable digital (SPDIF) pins */ |
| 6079 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6080 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6081 | |
| 6082 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6083 | * bus when acting as outputs. |
| 6084 | */ |
| 6085 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6086 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6087 | |
| 6088 | /* Start with output sum widgets muted and their output gains at min */ |
| 6089 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6092 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6095 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6098 | |
| 6099 | /* Unmute Line-out pin widget amp left and right |
| 6100 | * (no equiv mixer ctrl) |
| 6101 | */ |
| 6102 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 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 | |
| 6111 | /* Mute capture amp left and right */ |
| 6112 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6113 | /* Set ADC connection select to match default mixer setting - mic |
| 6114 | * (on mic1 pin) |
| 6115 | */ |
| 6116 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6117 | |
| 6118 | /* Do similar with the second ADC: mute capture input amp and |
| 6119 | * set ADC connection to mic to match ALSA's default state. |
| 6120 | */ |
| 6121 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6122 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6123 | |
| 6124 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6133 | |
| 6134 | { } |
| 6135 | }; |
| 6136 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6137 | static struct hda_verb alc260_will_verbs[] = { |
| 6138 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6139 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6140 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6141 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6142 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6143 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6144 | {} |
| 6145 | }; |
| 6146 | |
| 6147 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6148 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6149 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6150 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6151 | |
| 6152 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6153 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6154 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6155 | |
| 6156 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6157 | {} |
| 6158 | }; |
| 6159 | |
| 6160 | /* toggle speaker-output according to the hp-jack state */ |
| 6161 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6162 | { |
| 6163 | unsigned int present; |
| 6164 | |
| 6165 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6166 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6167 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6168 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6169 | AC_VERB_SET_GPIO_DATA, 1); |
| 6170 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6171 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6172 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6173 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6174 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6175 | AC_VERB_SET_GPIO_DATA, 0); |
| 6176 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6177 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6178 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6179 | } |
| 6180 | } |
| 6181 | |
| 6182 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6183 | unsigned int res) |
| 6184 | { |
| 6185 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6186 | alc260_replacer_672v_automute(codec); |
| 6187 | } |
| 6188 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6189 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6190 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6191 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6192 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6193 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6194 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6195 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6196 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6197 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6198 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6199 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6200 | {} |
| 6201 | }; |
| 6202 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6203 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6204 | * configuration. |
| 6205 | */ |
| 6206 | #ifdef CONFIG_SND_DEBUG |
| 6207 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6208 | 0x02, |
| 6209 | }; |
| 6210 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6211 | 0x04, 0x05, |
| 6212 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6213 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6214 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6215 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6216 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6217 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6218 | { |
| 6219 | .num_items = 7, |
| 6220 | .items = { |
| 6221 | { "MIC1 pin", 0x0 }, |
| 6222 | { "MIC2 pin", 0x1 }, |
| 6223 | { "LINE1 pin", 0x2 }, |
| 6224 | { "LINE2 pin", 0x3 }, |
| 6225 | { "CD pin", 0x4 }, |
| 6226 | { "LINE-OUT pin", 0x5 }, |
| 6227 | { "HP-OUT pin", 0x6 }, |
| 6228 | }, |
| 6229 | }, |
| 6230 | { |
| 6231 | .num_items = 8, |
| 6232 | .items = { |
| 6233 | { "MIC1 pin", 0x0 }, |
| 6234 | { "MIC2 pin", 0x1 }, |
| 6235 | { "LINE1 pin", 0x2 }, |
| 6236 | { "LINE2 pin", 0x3 }, |
| 6237 | { "CD pin", 0x4 }, |
| 6238 | { "Mixer", 0x5 }, |
| 6239 | { "LINE-OUT pin", 0x6 }, |
| 6240 | { "HP-OUT pin", 0x7 }, |
| 6241 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6242 | }, |
| 6243 | }; |
| 6244 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6245 | /* Output driver widgets */ |
| 6246 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6247 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6248 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6249 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6250 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6251 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6252 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6253 | /* Modes for retasking pin widgets |
| 6254 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6255 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6256 | * mention this restriction. At this stage it's not clear whether |
| 6257 | * this behaviour is intentional or is a hardware bug in chip |
| 6258 | * revisions available at least up until early 2006. Therefore for |
| 6259 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6260 | * choices, but if it turns out that the lack of mic bias for these |
| 6261 | * NIDs is intentional we could change their modes from |
| 6262 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6263 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6264 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6265 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6266 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6267 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6268 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6269 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6270 | |
| 6271 | /* Loopback mixer controls */ |
| 6272 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6273 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6274 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6275 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6276 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6277 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6278 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6279 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6280 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6281 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6282 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6283 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6284 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6285 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6286 | |
| 6287 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6288 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6289 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6290 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6291 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6292 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6293 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6294 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6295 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6296 | */ |
| 6297 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6298 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6299 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6300 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6301 | * this output to turn on an external amplifier. |
| 6302 | */ |
| 6303 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6304 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6305 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6306 | { } /* end */ |
| 6307 | }; |
| 6308 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6309 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6310 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6311 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6312 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6313 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6314 | /* Enable retasking pins as output, initially without power amp */ |
| 6315 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6316 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6317 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6318 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6319 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6320 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6321 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6322 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6323 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6324 | * payload also sets the generation to 0, output to be in "consumer" |
| 6325 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6326 | * control. |
| 6327 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6328 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6329 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6330 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6331 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6332 | * OUT1 sum bus when acting as an output. |
| 6333 | */ |
| 6334 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6335 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6336 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6337 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6338 | |
| 6339 | /* Start with output sum widgets muted and their output gains at min */ |
| 6340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6342 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6344 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6345 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6347 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6348 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6349 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6350 | /* Unmute retasking pin widget output buffers since the default |
| 6351 | * state appears to be output. As the pin mode is changed by the |
| 6352 | * user the pin mode control will take care of enabling the pin's |
| 6353 | * input/output buffers as needed. |
| 6354 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6355 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6356 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6358 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6359 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6360 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6361 | /* Also unmute the mono-out pin widget */ |
| 6362 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6363 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6364 | /* Mute capture amp left and right */ |
| 6365 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6366 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6367 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6368 | */ |
| 6369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6370 | |
| 6371 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6372 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6373 | */ |
| 6374 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6375 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6376 | |
| 6377 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6378 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6379 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6380 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6381 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6386 | |
| 6387 | { } |
| 6388 | }; |
| 6389 | #endif |
| 6390 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6391 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6392 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6393 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6394 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6395 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6396 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6397 | /* |
| 6398 | * for BIOS auto-configuration |
| 6399 | */ |
| 6400 | |
| 6401 | 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] | 6402 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6403 | { |
| 6404 | hda_nid_t nid_vol; |
| 6405 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | int err; |
| 6407 | |
| 6408 | if (nid >= 0x0f && nid < 0x11) { |
| 6409 | nid_vol = nid - 0x7; |
| 6410 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6411 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6412 | } else if (nid == 0x11) { |
| 6413 | nid_vol = nid - 0x7; |
| 6414 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6415 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6416 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6417 | nid_vol = 0x08; |
| 6418 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6419 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6420 | } else |
| 6421 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6422 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6423 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6424 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6425 | 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] | 6426 | if (err < 0) |
| 6427 | return err; |
| 6428 | *vol_bits |= (1 << nid_vol); |
| 6429 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6430 | 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] | 6431 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6432 | return err; |
| 6433 | return 1; |
| 6434 | } |
| 6435 | |
| 6436 | /* add playback controls from the parsed DAC table */ |
| 6437 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6438 | const struct auto_pin_cfg *cfg) |
| 6439 | { |
| 6440 | hda_nid_t nid; |
| 6441 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6442 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6443 | |
| 6444 | spec->multiout.num_dacs = 1; |
| 6445 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6446 | spec->multiout.dac_nids[0] = 0x02; |
| 6447 | |
| 6448 | nid = cfg->line_out_pins[0]; |
| 6449 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6450 | const char *pfx; |
| 6451 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6452 | pfx = "Master"; |
| 6453 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6454 | pfx = "Speaker"; |
| 6455 | else |
| 6456 | pfx = "Front"; |
| 6457 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6458 | if (err < 0) |
| 6459 | return err; |
| 6460 | } |
| 6461 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6462 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6463 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6464 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6465 | if (err < 0) |
| 6466 | return err; |
| 6467 | } |
| 6468 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6469 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6470 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6471 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6472 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6473 | if (err < 0) |
| 6474 | return err; |
| 6475 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6476 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6477 | } |
| 6478 | |
| 6479 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6480 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6481 | const struct auto_pin_cfg *cfg) |
| 6482 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6483 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6484 | } |
| 6485 | |
| 6486 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6487 | hda_nid_t nid, int pin_type, |
| 6488 | int sel_idx) |
| 6489 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6490 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6491 | /* need the manual connection? */ |
| 6492 | if (nid >= 0x12) { |
| 6493 | int idx = nid - 0x12; |
| 6494 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6495 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6496 | } |
| 6497 | } |
| 6498 | |
| 6499 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6500 | { |
| 6501 | struct alc_spec *spec = codec->spec; |
| 6502 | hda_nid_t nid; |
| 6503 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6504 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6505 | if (nid) { |
| 6506 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6507 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6508 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6509 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6510 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6511 | if (nid) |
| 6512 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6513 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6514 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6515 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6516 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6517 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6518 | |
| 6519 | #define ALC260_PIN_CD_NID 0x16 |
| 6520 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6521 | { |
| 6522 | struct alc_spec *spec = codec->spec; |
| 6523 | int i; |
| 6524 | |
| 6525 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6526 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6527 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6528 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6529 | if (nid != ALC260_PIN_CD_NID && |
| 6530 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6531 | snd_hda_codec_write(codec, nid, 0, |
| 6532 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6533 | AMP_OUT_MUTE); |
| 6534 | } |
| 6535 | } |
| 6536 | } |
| 6537 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6538 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6540 | /* |
| 6541 | * generic initialization of ADC, input mixers and output mixers |
| 6542 | */ |
| 6543 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6544 | /* |
| 6545 | * Unmute ADC0-1 and set the default input to mic-in |
| 6546 | */ |
| 6547 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6548 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6549 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6550 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6551 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6552 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6553 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6554 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6555 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6556 | */ |
| 6557 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6558 | /* mute analog inputs */ |
| 6559 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6564 | |
| 6565 | /* |
| 6566 | * Set up output mixers (0x08 - 0x0a) |
| 6567 | */ |
| 6568 | /* set vol=0 to output mixers */ |
| 6569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6570 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6571 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6572 | /* set up input amps for analog loopback */ |
| 6573 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6574 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6576 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6578 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6579 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6580 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | { } |
| 6582 | }; |
| 6583 | |
| 6584 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6585 | { |
| 6586 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6587 | int err; |
| 6588 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6589 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6590 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6591 | alc260_ignore); |
| 6592 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6593 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6594 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6595 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6596 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6597 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6598 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6599 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6600 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6601 | return err; |
| 6602 | |
| 6603 | spec->multiout.max_channels = 2; |
| 6604 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6605 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6606 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6607 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6608 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6609 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6610 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6611 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6612 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6613 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6614 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6615 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6617 | return 1; |
| 6618 | } |
| 6619 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6620 | /* additional initialization for auto-configuration model */ |
| 6621 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6622 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6623 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6624 | alc260_auto_init_multi_out(codec); |
| 6625 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6626 | alc260_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6627 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6628 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6629 | } |
| 6630 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6631 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6632 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6633 | { 0x07, HDA_INPUT, 0 }, |
| 6634 | { 0x07, HDA_INPUT, 1 }, |
| 6635 | { 0x07, HDA_INPUT, 2 }, |
| 6636 | { 0x07, HDA_INPUT, 3 }, |
| 6637 | { 0x07, HDA_INPUT, 4 }, |
| 6638 | { } /* end */ |
| 6639 | }; |
| 6640 | #endif |
| 6641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6642 | /* |
| 6643 | * ALC260 configurations |
| 6644 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6645 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6646 | [ALC260_BASIC] = "basic", |
| 6647 | [ALC260_HP] = "hp", |
| 6648 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6649 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6650 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6651 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6652 | [ALC260_WILL] = "will", |
| 6653 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6654 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6655 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6656 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6657 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6658 | [ALC260_AUTO] = "auto", |
| 6659 | }; |
| 6660 | |
| 6661 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6662 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6663 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6664 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6665 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6666 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6667 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6668 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6669 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6670 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6671 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6672 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6673 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6674 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6675 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6676 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6677 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6678 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6679 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6680 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6681 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6682 | {} |
| 6683 | }; |
| 6684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6685 | static struct alc_config_preset alc260_presets[] = { |
| 6686 | [ALC260_BASIC] = { |
| 6687 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6688 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6689 | .init_verbs = { alc260_init_verbs }, |
| 6690 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6691 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6692 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6693 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6694 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6695 | .channel_mode = alc260_modes, |
| 6696 | .input_mux = &alc260_capture_source, |
| 6697 | }, |
| 6698 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6699 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6700 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6701 | .init_verbs = { alc260_init_verbs, |
| 6702 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6703 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6704 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6705 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6706 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6707 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6708 | .channel_mode = alc260_modes, |
| 6709 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6710 | .unsol_event = alc260_hp_unsol_event, |
| 6711 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6712 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6713 | [ALC260_HP_DC7600] = { |
| 6714 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6715 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6716 | .init_verbs = { alc260_init_verbs, |
| 6717 | alc260_hp_dc7600_verbs }, |
| 6718 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6719 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6720 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6721 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6722 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6723 | .channel_mode = alc260_modes, |
| 6724 | .input_mux = &alc260_capture_source, |
| 6725 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6726 | .init_hook = alc260_hp_3012_automute, |
| 6727 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6728 | [ALC260_HP_3013] = { |
| 6729 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6730 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6731 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6732 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6733 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6734 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6735 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6736 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6737 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6738 | .channel_mode = alc260_modes, |
| 6739 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6740 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6741 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6742 | }, |
| 6743 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6744 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6745 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6746 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6747 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6748 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6749 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6750 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6751 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6752 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6753 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6754 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6755 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6756 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6757 | .init_verbs = { alc260_acer_init_verbs }, |
| 6758 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6759 | .dac_nids = alc260_dac_nids, |
| 6760 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6761 | .adc_nids = alc260_dual_adc_nids, |
| 6762 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6763 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6764 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6765 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6766 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6767 | [ALC260_FAVORIT100] = { |
| 6768 | .mixers = { alc260_favorit100_mixer }, |
| 6769 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6770 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6771 | .dac_nids = alc260_dac_nids, |
| 6772 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6773 | .adc_nids = alc260_dual_adc_nids, |
| 6774 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6775 | .channel_mode = alc260_modes, |
| 6776 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6777 | .input_mux = alc260_favorit100_capture_sources, |
| 6778 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6779 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6780 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6781 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6782 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6783 | .dac_nids = alc260_dac_nids, |
| 6784 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6785 | .adc_nids = alc260_adc_nids, |
| 6786 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6787 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6788 | .channel_mode = alc260_modes, |
| 6789 | .input_mux = &alc260_capture_source, |
| 6790 | }, |
| 6791 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6792 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6793 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6794 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6795 | .dac_nids = alc260_dac_nids, |
| 6796 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6797 | .adc_nids = alc260_adc_nids, |
| 6798 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6799 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6800 | .channel_mode = alc260_modes, |
| 6801 | .input_mux = &alc260_capture_source, |
| 6802 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6803 | .init_hook = alc260_replacer_672v_automute, |
| 6804 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6805 | #ifdef CONFIG_SND_DEBUG |
| 6806 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6807 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6808 | .init_verbs = { alc260_test_init_verbs }, |
| 6809 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6810 | .dac_nids = alc260_test_dac_nids, |
| 6811 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6812 | .adc_nids = alc260_test_adc_nids, |
| 6813 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6814 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6815 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6816 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6817 | }, |
| 6818 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6819 | }; |
| 6820 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6821 | static int patch_alc260(struct hda_codec *codec) |
| 6822 | { |
| 6823 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6824 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6825 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6826 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6827 | if (spec == NULL) |
| 6828 | return -ENOMEM; |
| 6829 | |
| 6830 | codec->spec = spec; |
| 6831 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6832 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6833 | alc260_models, |
| 6834 | alc260_cfg_tbl); |
| 6835 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6836 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6837 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6838 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6839 | } |
| 6840 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6841 | if (board_config == ALC260_AUTO) { |
| 6842 | /* automatic parse from the BIOS config */ |
| 6843 | err = alc260_parse_auto_config(codec); |
| 6844 | if (err < 0) { |
| 6845 | alc_free(codec); |
| 6846 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6847 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6848 | printk(KERN_INFO |
| 6849 | "hda_codec: Cannot set up configuration " |
| 6850 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6851 | board_config = ALC260_BASIC; |
| 6852 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6853 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6854 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6855 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6856 | if (err < 0) { |
| 6857 | alc_free(codec); |
| 6858 | return err; |
| 6859 | } |
| 6860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6861 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6862 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6863 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6864 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6865 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6866 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6867 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6868 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6869 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6870 | if (!spec->adc_nids && spec->input_mux) { |
| 6871 | /* check whether NID 0x04 is valid */ |
| 6872 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6873 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6874 | /* get type */ |
| 6875 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6876 | spec->adc_nids = alc260_adc_nids_alt; |
| 6877 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6878 | } else { |
| 6879 | spec->adc_nids = alc260_adc_nids; |
| 6880 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6881 | } |
| 6882 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6883 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6884 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6885 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6886 | spec->vmaster_nid = 0x08; |
| 6887 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6888 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6889 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6890 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6891 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6892 | if (!spec->loopback.amplist) |
| 6893 | spec->loopback.amplist = alc260_loopbacks; |
| 6894 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6895 | |
| 6896 | return 0; |
| 6897 | } |
| 6898 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6899 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6900 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6901 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6902 | * |
| 6903 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6904 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6905 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6906 | * 6-channel independent captures. |
| 6907 | * |
| 6908 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6909 | * driver yet). |
| 6910 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6911 | #define ALC882_DIGOUT_NID 0x06 |
| 6912 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6913 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6914 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6915 | #define ALC1200_DIGOUT_NID 0x10 |
| 6916 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6917 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6918 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6919 | { 8, NULL } |
| 6920 | }; |
| 6921 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6922 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6923 | static hda_nid_t alc882_dac_nids[4] = { |
| 6924 | /* front, rear, clfe, rear_surr */ |
| 6925 | 0x02, 0x03, 0x04, 0x05 |
| 6926 | }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6927 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6928 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6929 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6930 | #define alc882_adc_nids alc880_adc_nids |
| 6931 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6932 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6933 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6934 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6935 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6936 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6937 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6938 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6939 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6940 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6941 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6942 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6943 | /* input MUX */ |
| 6944 | /* FIXME: should be a matrix-type input source selection */ |
| 6945 | |
| 6946 | static struct hda_input_mux alc882_capture_source = { |
| 6947 | .num_items = 4, |
| 6948 | .items = { |
| 6949 | { "Mic", 0x0 }, |
| 6950 | { "Front Mic", 0x1 }, |
| 6951 | { "Line", 0x2 }, |
| 6952 | { "CD", 0x4 }, |
| 6953 | }, |
| 6954 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6955 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6956 | #define alc883_capture_source alc882_capture_source |
| 6957 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6958 | static struct hda_input_mux alc889_capture_source = { |
| 6959 | .num_items = 3, |
| 6960 | .items = { |
| 6961 | { "Front Mic", 0x0 }, |
| 6962 | { "Mic", 0x3 }, |
| 6963 | { "Line", 0x2 }, |
| 6964 | }, |
| 6965 | }; |
| 6966 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6967 | static struct hda_input_mux mb5_capture_source = { |
| 6968 | .num_items = 3, |
| 6969 | .items = { |
| 6970 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 6971 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6972 | { "CD", 0x4 }, |
| 6973 | }, |
| 6974 | }; |
| 6975 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 6976 | static struct hda_input_mux macmini3_capture_source = { |
| 6977 | .num_items = 2, |
| 6978 | .items = { |
| 6979 | { "Line", 0x2 }, |
| 6980 | { "CD", 0x4 }, |
| 6981 | }, |
| 6982 | }; |
| 6983 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6984 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6985 | .num_items = 4, |
| 6986 | .items = { |
| 6987 | { "Mic", 0x1 }, |
| 6988 | { "Front Mic", 0x0 }, |
| 6989 | { "Line", 0x2 }, |
| 6990 | { "CD", 0x4 }, |
| 6991 | }, |
| 6992 | }; |
| 6993 | |
| 6994 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6995 | .num_items = 2, |
| 6996 | .items = { |
| 6997 | { "Mic", 0x1 }, |
| 6998 | { "Line", 0x2 }, |
| 6999 | }, |
| 7000 | }; |
| 7001 | |
| 7002 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7003 | .num_items = 4, |
| 7004 | .items = { |
| 7005 | { "Mic", 0x0 }, |
| 7006 | { "iMic", 0x1 }, |
| 7007 | { "Line", 0x2 }, |
| 7008 | { "CD", 0x4 }, |
| 7009 | }, |
| 7010 | }; |
| 7011 | |
| 7012 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7013 | .num_items = 2, |
| 7014 | .items = { |
| 7015 | { "Mic", 0x0 }, |
| 7016 | { "Int Mic", 0x1 }, |
| 7017 | }, |
| 7018 | }; |
| 7019 | |
| 7020 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7021 | .num_items = 3, |
| 7022 | .items = { |
| 7023 | { "Mic", 0x0 }, |
| 7024 | { "Front Mic", 0x1 }, |
| 7025 | { "Line", 0x4 }, |
| 7026 | }, |
| 7027 | }; |
| 7028 | |
| 7029 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7030 | .num_items = 2, |
| 7031 | .items = { |
| 7032 | { "Mic", 0x0 }, |
| 7033 | { "Line", 0x2 }, |
| 7034 | }, |
| 7035 | }; |
| 7036 | |
| 7037 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7038 | .num_items = 2, |
| 7039 | .items = { |
| 7040 | { "Mic", 0x0 }, |
| 7041 | /* Front Mic (0x01) unused */ |
| 7042 | { "Line", 0x2 }, |
| 7043 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7044 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7045 | }, |
| 7046 | }; |
| 7047 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7048 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7049 | .num_items = 2, |
| 7050 | .items = { |
| 7051 | { "Mic", 0x01 }, |
| 7052 | { "Line", 0x2 }, /* Not sure! */ |
| 7053 | }, |
| 7054 | }; |
| 7055 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7056 | /* |
| 7057 | * 2ch mode |
| 7058 | */ |
| 7059 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7060 | { 2, NULL } |
| 7061 | }; |
| 7062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7063 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7064 | * 2ch mode |
| 7065 | */ |
| 7066 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7067 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7068 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7069 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7070 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7071 | { } /* end */ |
| 7072 | }; |
| 7073 | |
| 7074 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7075 | * 4ch mode |
| 7076 | */ |
| 7077 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7078 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7079 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7080 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7081 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7082 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7083 | { } /* end */ |
| 7084 | }; |
| 7085 | |
| 7086 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7087 | * 6ch mode |
| 7088 | */ |
| 7089 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7090 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7091 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7092 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7093 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7094 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7095 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7096 | { } /* end */ |
| 7097 | }; |
| 7098 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7099 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7100 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7101 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7102 | { 6, alc882_3ST_ch6_init }, |
| 7103 | }; |
| 7104 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7105 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7106 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7107 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7108 | * 2ch mode |
| 7109 | */ |
| 7110 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7111 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7112 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7113 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7114 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7115 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7116 | { } /* end */ |
| 7117 | }; |
| 7118 | |
| 7119 | /* |
| 7120 | * 4ch mode |
| 7121 | */ |
| 7122 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7123 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7124 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7125 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7126 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7127 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7128 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7129 | { } /* end */ |
| 7130 | }; |
| 7131 | |
| 7132 | /* |
| 7133 | * 6ch mode |
| 7134 | */ |
| 7135 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7136 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7137 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7138 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7139 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7140 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7141 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7142 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7143 | { } /* end */ |
| 7144 | }; |
| 7145 | |
| 7146 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7147 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7148 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7149 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7150 | }; |
| 7151 | |
| 7152 | |
| 7153 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7154 | * 6ch mode |
| 7155 | */ |
| 7156 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7157 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7158 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7159 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7160 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7161 | { } /* end */ |
| 7162 | }; |
| 7163 | |
| 7164 | /* |
| 7165 | * 8ch mode |
| 7166 | */ |
| 7167 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7168 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7169 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7170 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7171 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7172 | { } /* end */ |
| 7173 | }; |
| 7174 | |
| 7175 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7176 | { 6, alc882_sixstack_ch6_init }, |
| 7177 | { 8, alc882_sixstack_ch8_init }, |
| 7178 | }; |
| 7179 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7180 | |
| 7181 | /* Macbook Air 2,1 */ |
| 7182 | |
| 7183 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7184 | { 2, NULL }, |
| 7185 | }; |
| 7186 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7187 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7188 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7189 | */ |
| 7190 | |
| 7191 | /* |
| 7192 | * 2ch mode |
| 7193 | */ |
| 7194 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7195 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7196 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7197 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7198 | { } /* end */ |
| 7199 | }; |
| 7200 | |
| 7201 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7202 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7203 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7204 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7205 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7206 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7207 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7208 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7209 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7210 | { } /* end */ |
| 7211 | }; |
| 7212 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7213 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7214 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7215 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7216 | }; |
| 7217 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7218 | /* |
| 7219 | * 2ch |
| 7220 | * Speakers/Woofer/HP = Front |
| 7221 | * LineIn = Input |
| 7222 | */ |
| 7223 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7224 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7225 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7226 | { } /* end */ |
| 7227 | }; |
| 7228 | |
| 7229 | /* |
| 7230 | * 6ch mode |
| 7231 | * Speakers/HP = Front |
| 7232 | * Woofer = LFE |
| 7233 | * LineIn = Surround |
| 7234 | */ |
| 7235 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7239 | { } /* end */ |
| 7240 | }; |
| 7241 | |
| 7242 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7243 | { 2, alc885_mb5_ch2_init }, |
| 7244 | { 6, alc885_mb5_ch6_init }, |
| 7245 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7246 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7247 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7248 | |
| 7249 | /* |
| 7250 | * 2ch mode |
| 7251 | */ |
| 7252 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7253 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7254 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7255 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7256 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7257 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7258 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7259 | { } /* end */ |
| 7260 | }; |
| 7261 | |
| 7262 | /* |
| 7263 | * 4ch mode |
| 7264 | */ |
| 7265 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7266 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7267 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7268 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7269 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7270 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7271 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7272 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7273 | { } /* end */ |
| 7274 | }; |
| 7275 | |
| 7276 | /* |
| 7277 | * 6ch mode |
| 7278 | */ |
| 7279 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7280 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7281 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7282 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7283 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7284 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7285 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7286 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7287 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7288 | { } /* end */ |
| 7289 | }; |
| 7290 | |
| 7291 | /* |
| 7292 | * 8ch mode |
| 7293 | */ |
| 7294 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7295 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7296 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7297 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7298 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7299 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7300 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7301 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7302 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7303 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7304 | { } /* end */ |
| 7305 | }; |
| 7306 | |
| 7307 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7308 | { 2, alc883_4ST_ch2_init }, |
| 7309 | { 4, alc883_4ST_ch4_init }, |
| 7310 | { 6, alc883_4ST_ch6_init }, |
| 7311 | { 8, alc883_4ST_ch8_init }, |
| 7312 | }; |
| 7313 | |
| 7314 | |
| 7315 | /* |
| 7316 | * 2ch mode |
| 7317 | */ |
| 7318 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7319 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7320 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7321 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7322 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7323 | { } /* end */ |
| 7324 | }; |
| 7325 | |
| 7326 | /* |
| 7327 | * 4ch mode |
| 7328 | */ |
| 7329 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7330 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7331 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7332 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7333 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7334 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7335 | { } /* end */ |
| 7336 | }; |
| 7337 | |
| 7338 | /* |
| 7339 | * 6ch mode |
| 7340 | */ |
| 7341 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7342 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7343 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7344 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7345 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7346 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7347 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7348 | { } /* end */ |
| 7349 | }; |
| 7350 | |
| 7351 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7352 | { 2, alc883_3ST_ch2_intel_init }, |
| 7353 | { 4, alc883_3ST_ch4_intel_init }, |
| 7354 | { 6, alc883_3ST_ch6_intel_init }, |
| 7355 | }; |
| 7356 | |
| 7357 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7358 | * 2ch mode |
| 7359 | */ |
| 7360 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7361 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7362 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7363 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7364 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7365 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7366 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7367 | { } /* end */ |
| 7368 | }; |
| 7369 | |
| 7370 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7371 | * 6ch mode |
| 7372 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7373 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7374 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7375 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7376 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7377 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7378 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7379 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7380 | { } /* end */ |
| 7381 | }; |
| 7382 | |
| 7383 | /* |
| 7384 | * 8ch mode |
| 7385 | */ |
| 7386 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7387 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7388 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7389 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7390 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7391 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7392 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7393 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7394 | { } /* end */ |
| 7395 | }; |
| 7396 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7397 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7398 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7399 | { 6, alc889_ch6_intel_init }, |
| 7400 | { 8, alc889_ch8_intel_init }, |
| 7401 | }; |
| 7402 | |
| 7403 | /* |
| 7404 | * 6ch mode |
| 7405 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7406 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7407 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7408 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7409 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7410 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7411 | { } /* end */ |
| 7412 | }; |
| 7413 | |
| 7414 | /* |
| 7415 | * 8ch mode |
| 7416 | */ |
| 7417 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7418 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7419 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7420 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7421 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7422 | { } /* end */ |
| 7423 | }; |
| 7424 | |
| 7425 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7426 | { 6, alc883_sixstack_ch6_init }, |
| 7427 | { 8, alc883_sixstack_ch8_init }, |
| 7428 | }; |
| 7429 | |
| 7430 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7431 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7432 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7433 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7434 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7435 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7436 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7437 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7438 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7439 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7440 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7441 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7442 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7443 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7444 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7446 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7447 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7448 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7449 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7450 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7451 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7454 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7455 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7456 | { } /* end */ |
| 7457 | }; |
| 7458 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7459 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7460 | |
| 7461 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7463 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7464 | { } |
| 7465 | }; |
| 7466 | |
| 7467 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7468 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7469 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7470 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7471 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7472 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7473 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7475 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7477 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7478 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7480 | { } /* end */ |
| 7481 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7482 | |
| 7483 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7484 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7485 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7486 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7487 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7488 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7489 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7490 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7491 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7492 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7493 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7495 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7496 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7497 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7498 | { } /* end */ |
| 7499 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7500 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7501 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7503 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7504 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7505 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7506 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7507 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7508 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7509 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7510 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7511 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7512 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7513 | { } /* end */ |
| 7514 | }; |
| 7515 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7516 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7517 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7518 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7519 | { } /* end */ |
| 7520 | }; |
| 7521 | |
| 7522 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7523 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7524 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7525 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7526 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7527 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7528 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7529 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7530 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7531 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7533 | { } /* end */ |
| 7534 | }; |
| 7535 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7536 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7538 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7539 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7540 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7541 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7544 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7545 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7547 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7549 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7550 | { } /* end */ |
| 7551 | }; |
| 7552 | |
| 7553 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7554 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7555 | */ |
| 7556 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7557 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7558 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7559 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7560 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7561 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7562 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7563 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7564 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7565 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7566 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7567 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7568 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7569 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7570 | { } /* end */ |
| 7571 | }; |
| 7572 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7573 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7574 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7575 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7577 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7578 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7579 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7580 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7582 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7583 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7584 | { } /* end */ |
| 7585 | }; |
| 7586 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7587 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7588 | { |
| 7589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7590 | .name = "Channel Mode", |
| 7591 | .info = alc_ch_mode_info, |
| 7592 | .get = alc_ch_mode_get, |
| 7593 | .put = alc_ch_mode_put, |
| 7594 | }, |
| 7595 | { } /* end */ |
| 7596 | }; |
| 7597 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7598 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7599 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7600 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7601 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7602 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7603 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7604 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7605 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7606 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7607 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7608 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7611 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7612 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7613 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7614 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7615 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7616 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7617 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7618 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7619 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7620 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7621 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7622 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7623 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7624 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7625 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7626 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7627 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7628 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7629 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7630 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7631 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7632 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7634 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7637 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7638 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7639 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7640 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7641 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7642 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7643 | |
| 7644 | /* FIXME: use matrix-type input source selection */ |
| 7645 | /* 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] | 7646 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7647 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7648 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7649 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7650 | /* ADC2: mute amp left and right */ |
| 7651 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7652 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7653 | /* ADC3: mute amp left and right */ |
| 7654 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7655 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7656 | |
| 7657 | { } |
| 7658 | }; |
| 7659 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7660 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7661 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7666 | /* ADC1: mute amp left and right */ |
| 7667 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7668 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7669 | { } |
| 7670 | }; |
| 7671 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7672 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7673 | /* change to EAPD mode */ |
| 7674 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7675 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7676 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7677 | }; |
| 7678 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7679 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7680 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7681 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7682 | { } |
| 7683 | }; |
| 7684 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7685 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7686 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7688 | {} |
| 7689 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7690 | |
| 7691 | static struct hda_verb alc885_init_verbs[] = { |
| 7692 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7695 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7696 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7697 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7698 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7699 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7700 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7701 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7702 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7703 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7704 | |
| 7705 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7707 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7708 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7709 | /* Front Pin: output 0 (0x0c) */ |
| 7710 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7711 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7712 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7713 | /* Rear Pin: output 1 (0x0d) */ |
| 7714 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7715 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7716 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7717 | /* CLFE Pin: output 2 (0x0e) */ |
| 7718 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7719 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7720 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7721 | /* Side Pin: output 3 (0x0f) */ |
| 7722 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7723 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7724 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7725 | /* Mic (rear) pin: input vref at 80% */ |
| 7726 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7727 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7728 | /* Front Mic pin: input vref at 80% */ |
| 7729 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7730 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7731 | /* Line In pin: input */ |
| 7732 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7733 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7734 | |
| 7735 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7736 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7737 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7738 | /* Input mixer2 */ |
| 7739 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7740 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7742 | /* ADC2: mute amp left and right */ |
| 7743 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7744 | /* ADC3: mute amp left and right */ |
| 7745 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7746 | |
| 7747 | { } |
| 7748 | }; |
| 7749 | |
| 7750 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7754 | { } |
| 7755 | }; |
| 7756 | |
| 7757 | |
| 7758 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7759 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7760 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7762 | { } |
| 7763 | }; |
| 7764 | |
| 7765 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7766 | #define alc883_init_verbs alc882_base_init_verbs |
| 7767 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7768 | /* Mac Pro test */ |
| 7769 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7770 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7771 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7772 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7773 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7774 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7775 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7776 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7777 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7778 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7779 | { } /* end */ |
| 7780 | }; |
| 7781 | |
| 7782 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7783 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7787 | /* Front Pin: output 0 (0x0c) */ |
| 7788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7789 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7790 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7791 | /* Front Mic pin: input vref at 80% */ |
| 7792 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7793 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7794 | /* Speaker: output */ |
| 7795 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7796 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7797 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7798 | /* Headphone output (output 0 - 0x0c) */ |
| 7799 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7801 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7802 | |
| 7803 | /* FIXME: use matrix-type input source selection */ |
| 7804 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7805 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7809 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7810 | /* Input mixer2 */ |
| 7811 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7812 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7814 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7815 | /* Input mixer3 */ |
| 7816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7817 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7818 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7820 | /* ADC1: mute amp left and right */ |
| 7821 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7822 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7823 | /* ADC2: mute amp left and right */ |
| 7824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7825 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7826 | /* ADC3: mute amp left and right */ |
| 7827 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7828 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7829 | |
| 7830 | { } |
| 7831 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7832 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7833 | /* Macbook 5,1 */ |
| 7834 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7835 | /* DACs */ |
| 7836 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7837 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7838 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7839 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7840 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7841 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7842 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7843 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7844 | /* Surround mixer */ |
| 7845 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7846 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7848 | /* LFE mixer */ |
| 7849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7852 | /* HP mixer */ |
| 7853 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7854 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7855 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7856 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7857 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7858 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7859 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7860 | /* LFE Pin (0x0e) */ |
| 7861 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7862 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7863 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7864 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7865 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7866 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7867 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7868 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7869 | /* Front Mic pin: input vref at 80% */ |
| 7870 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7871 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7872 | /* Line In pin */ |
| 7873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7874 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7875 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7876 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 7877 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 7878 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7879 | { } |
| 7880 | }; |
| 7881 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7882 | /* Macmini 3,1 */ |
| 7883 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7884 | /* DACs */ |
| 7885 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7886 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7887 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7888 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7889 | /* Front mixer */ |
| 7890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7893 | /* Surround mixer */ |
| 7894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7897 | /* LFE mixer */ |
| 7898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7899 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7900 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7901 | /* HP mixer */ |
| 7902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7903 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7905 | /* Front Pin (0x0c) */ |
| 7906 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7907 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7908 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7909 | /* LFE Pin (0x0e) */ |
| 7910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7911 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7912 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7913 | /* HP Pin (0x0f) */ |
| 7914 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7915 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7916 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7918 | /* Line In pin */ |
| 7919 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7920 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7921 | |
| 7922 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7923 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7924 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7925 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7926 | { } |
| 7927 | }; |
| 7928 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7929 | |
| 7930 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 7931 | /*Internal and HP Speaker Mixer*/ |
| 7932 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7935 | /*Internal Speaker Pin (0x0c)*/ |
| 7936 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 7937 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7938 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7939 | /* HP Pin: output 0 (0x0e) */ |
| 7940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7941 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7942 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7943 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 7944 | /* Line in (is hp when jack connected)*/ |
| 7945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 7946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7947 | |
| 7948 | { } |
| 7949 | }; |
| 7950 | |
| 7951 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7952 | /* Macbook Pro rev3 */ |
| 7953 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7954 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7956 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7958 | /* Rear mixer */ |
| 7959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7962 | /* HP mixer */ |
| 7963 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7964 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7966 | /* Front Pin: output 0 (0x0c) */ |
| 7967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7969 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7970 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7974 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7975 | /* Mic (rear) pin: input vref at 80% */ |
| 7976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7978 | /* Front Mic pin: input vref at 80% */ |
| 7979 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7980 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7981 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7983 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7984 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7985 | |
| 7986 | /* FIXME: use matrix-type input source selection */ |
| 7987 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7988 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7993 | /* Input mixer2 */ |
| 7994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7998 | /* Input mixer3 */ |
| 7999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8003 | /* ADC1: mute amp left and right */ |
| 8004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8005 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | /* ADC2: mute amp left and right */ |
| 8007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8009 | /* ADC3: mute amp left and right */ |
| 8010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8012 | |
| 8013 | { } |
| 8014 | }; |
| 8015 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8016 | /* iMac 9,1 */ |
| 8017 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8018 | /* Internal Speaker Pin (0x0c) */ |
| 8019 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8021 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8022 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8023 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8024 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8025 | /* HP Pin: Rear */ |
| 8026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8027 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8028 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8029 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8030 | /* Line in Rear */ |
| 8031 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8032 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8033 | /* Front Mic pin: input vref at 80% */ |
| 8034 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8035 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8036 | /* Rear mixer */ |
| 8037 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8038 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8039 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8040 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8041 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8043 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8044 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8045 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8046 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8049 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8050 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8054 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8059 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8061 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8062 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8063 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8064 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8065 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8066 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8067 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8068 | { } |
| 8069 | }; |
| 8070 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8071 | /* iMac 24 mixer. */ |
| 8072 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8073 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8074 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8075 | { } /* end */ |
| 8076 | }; |
| 8077 | |
| 8078 | /* iMac 24 init verbs. */ |
| 8079 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8080 | /* Internal speakers: output 0 (0x0c) */ |
| 8081 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8082 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8083 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8084 | /* Internal speakers: output 0 (0x0c) */ |
| 8085 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8086 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8087 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8088 | /* Headphone: output 0 (0x0c) */ |
| 8089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8091 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8092 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8093 | /* Front Mic: input vref at 80% */ |
| 8094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8095 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8096 | { } |
| 8097 | }; |
| 8098 | |
| 8099 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8100 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8101 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8102 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8103 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8104 | spec->autocfg.hp_pins[0] = 0x14; |
| 8105 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8106 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8107 | } |
| 8108 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8109 | #define alc885_mb5_setup alc885_imac24_setup |
| 8110 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8111 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8112 | /* Macbook Air 2,1 */ |
| 8113 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8114 | { |
| 8115 | struct alc_spec *spec = codec->spec; |
| 8116 | |
| 8117 | spec->autocfg.hp_pins[0] = 0x14; |
| 8118 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8119 | } |
| 8120 | |
| 8121 | |
| 8122 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8123 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8124 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8125 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8126 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8127 | spec->autocfg.hp_pins[0] = 0x15; |
| 8128 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8129 | } |
| 8130 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8131 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8132 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8133 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8134 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8135 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8136 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8137 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8138 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8139 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8140 | static struct hda_verb alc882_targa_verbs[] = { |
| 8141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8143 | |
| 8144 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8145 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8146 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8147 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8148 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8149 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8150 | |
| 8151 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8152 | { } /* end */ |
| 8153 | }; |
| 8154 | |
| 8155 | /* toggle speaker-output according to the hp-jack state */ |
| 8156 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8157 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8158 | struct alc_spec *spec = codec->spec; |
| 8159 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8160 | 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] | 8161 | spec->jack_present ? 1 : 3); |
| 8162 | } |
| 8163 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8164 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8165 | { |
| 8166 | struct alc_spec *spec = codec->spec; |
| 8167 | |
| 8168 | spec->autocfg.hp_pins[0] = 0x14; |
| 8169 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8170 | } |
| 8171 | |
| 8172 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8173 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8174 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8175 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8176 | } |
| 8177 | |
| 8178 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8179 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8181 | |
| 8182 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8184 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8185 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8186 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8187 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8188 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8189 | |
| 8190 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8191 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8192 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8193 | { } /* end */ |
| 8194 | }; |
| 8195 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8196 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8197 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8198 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8199 | |
| 8200 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8201 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8202 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8203 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8204 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8205 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8206 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8207 | |
| 8208 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8209 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8210 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8211 | { } /* end */ |
| 8212 | }; |
| 8213 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8214 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8215 | { |
| 8216 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8217 | |
| 8218 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8219 | AC_VERB_GET_GPIO_DATA, 0); |
| 8220 | |
| 8221 | if (!muted) |
| 8222 | gpiostate |= (1 << pin); |
| 8223 | else |
| 8224 | gpiostate &= ~(1 << pin); |
| 8225 | |
| 8226 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8227 | AC_VERB_GET_GPIO_MASK, 0); |
| 8228 | gpiomask |= (1 << pin); |
| 8229 | |
| 8230 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8231 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8232 | gpiodir |= (1 << pin); |
| 8233 | |
| 8234 | |
| 8235 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8236 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8237 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8238 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8239 | |
| 8240 | msleep(1); |
| 8241 | |
| 8242 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8243 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8244 | } |
| 8245 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8246 | /* set up GPIO at initialization */ |
| 8247 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8248 | { |
| 8249 | alc882_gpio_mute(codec, 0, 0); |
| 8250 | alc882_gpio_mute(codec, 1, 0); |
| 8251 | } |
| 8252 | |
| 8253 | /* set up GPIO and update auto-muting at initialization */ |
| 8254 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8255 | { |
| 8256 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8257 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8258 | } |
| 8259 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8260 | /* |
| 8261 | * generic initialization of ADC, input mixers and output mixers |
| 8262 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8263 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8264 | /* |
| 8265 | * Unmute ADC0-2 and set the default input to mic-in |
| 8266 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8267 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8268 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8269 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8271 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8272 | /* |
| 8273 | * Set up output mixers (0x0c - 0x0f) |
| 8274 | */ |
| 8275 | /* set vol=0 to output mixers */ |
| 8276 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8277 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8279 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8280 | /* set up input amps for analog loopback */ |
| 8281 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8282 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8284 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8285 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8286 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8287 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8288 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8289 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8290 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8291 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8292 | |
| 8293 | /* FIXME: use matrix-type input source selection */ |
| 8294 | /* 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] | 8295 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8297 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8298 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8299 | { } |
| 8300 | }; |
| 8301 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8302 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8303 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8304 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8305 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8306 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8307 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8308 | { } /* end */ |
| 8309 | }; |
| 8310 | |
| 8311 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8312 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8313 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8314 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8315 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8316 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8317 | { } /* end */ |
| 8318 | }; |
| 8319 | |
| 8320 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8321 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8322 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8323 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8324 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8325 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8326 | { } /* end */ |
| 8327 | }; |
| 8328 | |
| 8329 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8330 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8331 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8332 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8333 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8334 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8335 | { } /* end */ |
| 8336 | }; |
| 8337 | |
| 8338 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8339 | { 2, alc889A_mb31_ch2_init }, |
| 8340 | { 4, alc889A_mb31_ch4_init }, |
| 8341 | { 5, alc889A_mb31_ch5_init }, |
| 8342 | { 6, alc889A_mb31_ch6_init }, |
| 8343 | }; |
| 8344 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8345 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8346 | /* eanable EAPD on medion laptop */ |
| 8347 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8348 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8349 | { } |
| 8350 | }; |
| 8351 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8352 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8353 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8354 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8355 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8356 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8357 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8358 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8359 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8360 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8361 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8362 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8363 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8364 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8365 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8366 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8367 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8368 | { } /* end */ |
| 8369 | }; |
| 8370 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8371 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8372 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8373 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8374 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8375 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8377 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8379 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8380 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8381 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8382 | { } /* end */ |
| 8383 | }; |
| 8384 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8385 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8386 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8387 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8388 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8389 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8390 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8391 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8392 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8393 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8394 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8395 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8396 | { } /* end */ |
| 8397 | }; |
| 8398 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8399 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8400 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8401 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8402 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8404 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8405 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8406 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8407 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8408 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8409 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8410 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8411 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8412 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8413 | { } /* end */ |
| 8414 | }; |
| 8415 | |
| 8416 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8417 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8418 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8419 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8420 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8421 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8422 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8423 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8424 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8429 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8431 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8432 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8434 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8436 | { } /* end */ |
| 8437 | }; |
| 8438 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8439 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8440 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8441 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8442 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8443 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8444 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8445 | HDA_OUTPUT), |
| 8446 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8447 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8448 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8449 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8450 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8451 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8452 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8453 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8454 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8455 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8456 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8457 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8458 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8460 | { } /* end */ |
| 8461 | }; |
| 8462 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8463 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8464 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8465 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8466 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8467 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8468 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8469 | HDA_OUTPUT), |
| 8470 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8471 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8472 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8473 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8474 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8475 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8476 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8477 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8479 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8480 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8481 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8482 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8483 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8484 | { } /* end */ |
| 8485 | }; |
| 8486 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8487 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8489 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8490 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8491 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8492 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8493 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8494 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8495 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8496 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8497 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8498 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8499 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8500 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8501 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8502 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8503 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8504 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8505 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8506 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8507 | { } /* end */ |
| 8508 | }; |
| 8509 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8510 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8511 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8512 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8513 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8514 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8515 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8516 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8517 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8518 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8519 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8520 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8521 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8522 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8523 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8524 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8526 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8528 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8529 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8530 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8531 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8532 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8533 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8534 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8535 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8536 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8537 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8538 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8539 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8540 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8541 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8542 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8543 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8544 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8545 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8546 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8547 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8548 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8549 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8550 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8551 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8552 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8553 | { } /* end */ |
| 8554 | }; |
| 8555 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8556 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8557 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8558 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8559 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8560 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8561 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8562 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8565 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8566 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8567 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8568 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8569 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8570 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8571 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8572 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8573 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8574 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8576 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8577 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8578 | { } /* end */ |
| 8579 | }; |
| 8580 | |
| 8581 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8582 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8583 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8584 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8585 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8586 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8587 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8588 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8589 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8590 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8591 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8592 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8593 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8594 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8595 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8596 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8597 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8598 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8599 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8600 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8601 | { } /* end */ |
| 8602 | }; |
| 8603 | |
| 8604 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8605 | /* Unmute front mixer */ |
| 8606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8608 | |
| 8609 | /* Set speaker pin to front mixer */ |
| 8610 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8611 | |
| 8612 | /* Init headphone pin */ |
| 8613 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8614 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8615 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8616 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8617 | |
| 8618 | { } /* end */ |
| 8619 | }; |
| 8620 | |
| 8621 | /* toggle speaker-output according to the hp-jack state */ |
| 8622 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8623 | { |
| 8624 | struct alc_spec *spec = codec->spec; |
| 8625 | |
| 8626 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8627 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8628 | } |
| 8629 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8630 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8633 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8634 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8635 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8636 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8637 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8639 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8640 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8641 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8642 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8643 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8644 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8647 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8648 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8650 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8651 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8652 | { } /* end */ |
| 8653 | }; |
| 8654 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8655 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8656 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8657 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8658 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8659 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8660 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8661 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8662 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8663 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8664 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8665 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8666 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8667 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8668 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8669 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8670 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8671 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8672 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8674 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8675 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8676 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8677 | { } /* end */ |
| 8678 | }; |
| 8679 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8680 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8681 | /* Output mixers */ |
| 8682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8683 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8684 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8685 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8686 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8687 | HDA_OUTPUT), |
| 8688 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8689 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8690 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8691 | /* Output switches */ |
| 8692 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8693 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8694 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8695 | /* Boost mixers */ |
| 8696 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8697 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8698 | /* Input mixers */ |
| 8699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8700 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8702 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8703 | { } /* end */ |
| 8704 | }; |
| 8705 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8706 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8707 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8708 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8709 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8710 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8711 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8712 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8713 | { } /* end */ |
| 8714 | }; |
| 8715 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8716 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8717 | .ops = &snd_hda_bind_vol, |
| 8718 | .values = { |
| 8719 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8720 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8721 | 0 |
| 8722 | }, |
| 8723 | }; |
| 8724 | |
| 8725 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8726 | .ops = &snd_hda_bind_sw, |
| 8727 | .values = { |
| 8728 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8729 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8730 | 0 |
| 8731 | }, |
| 8732 | }; |
| 8733 | |
| 8734 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8735 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8736 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8738 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8739 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8740 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8741 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8742 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8743 | { } /* end */ |
| 8744 | }; |
| 8745 | |
| 8746 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8747 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8748 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8749 | { |
| 8750 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8751 | /* .name = "Capture Source", */ |
| 8752 | .name = "Input Source", |
| 8753 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8754 | .info = alc_mux_enum_info, |
| 8755 | .get = alc_mux_enum_get, |
| 8756 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8757 | }, |
| 8758 | { } /* end */ |
| 8759 | }; |
| 8760 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8761 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8762 | { |
| 8763 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8764 | .name = "Channel Mode", |
| 8765 | .info = alc_ch_mode_info, |
| 8766 | .get = alc_ch_mode_get, |
| 8767 | .put = alc_ch_mode_put, |
| 8768 | }, |
| 8769 | { } /* end */ |
| 8770 | }; |
| 8771 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8772 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8773 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8774 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8775 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8776 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8777 | spec->autocfg.hp_pins[0] = 0x15; |
| 8778 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8779 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8780 | } |
| 8781 | |
| 8782 | /* auto-toggle front mic */ |
| 8783 | /* |
| 8784 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8785 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8786 | 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] | 8787 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8788 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8789 | } |
| 8790 | */ |
| 8791 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8792 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8793 | /* HP */ |
| 8794 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8795 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8796 | /* Subwoofer */ |
| 8797 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8798 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8799 | |
| 8800 | /* enable unsolicited event */ |
| 8801 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8802 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8803 | |
| 8804 | { } /* end */ |
| 8805 | }; |
| 8806 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8807 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8808 | /* HP */ |
| 8809 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8811 | /* Int speaker */ |
| 8812 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8813 | |
| 8814 | /* enable unsolicited event */ |
| 8815 | /* |
| 8816 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8817 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8818 | */ |
| 8819 | |
| 8820 | { } /* end */ |
| 8821 | }; |
| 8822 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8823 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8824 | /* HP */ |
| 8825 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8826 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8827 | /* Int speaker */ |
| 8828 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8829 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8830 | |
| 8831 | /* enable unsolicited event */ |
| 8832 | {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] | 8833 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8834 | |
| 8835 | { } /* end */ |
| 8836 | }; |
| 8837 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8838 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8839 | /* HP */ |
| 8840 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8841 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8842 | /* Subwoofer */ |
| 8843 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8845 | |
| 8846 | /* enable unsolicited event */ |
| 8847 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8848 | |
| 8849 | { } /* end */ |
| 8850 | }; |
| 8851 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8852 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8855 | |
| 8856 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8857 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8858 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8859 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8860 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8861 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8862 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8863 | /* Connect Mic jack to CLFE */ |
| 8864 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8865 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8866 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8867 | /* Connect Line-in jack to Surround */ |
| 8868 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8869 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8870 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8871 | /* Connect HP out jack to Front */ |
| 8872 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8873 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8874 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8875 | |
| 8876 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8877 | |
| 8878 | { } /* end */ |
| 8879 | }; |
| 8880 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8881 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8882 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8883 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8884 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8885 | { } /* end */ |
| 8886 | }; |
| 8887 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8888 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8889 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8890 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8891 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8893 | { } /* end */ |
| 8894 | }; |
| 8895 | |
| 8896 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8898 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8899 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8900 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8901 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8902 | { } /* end */ |
| 8903 | }; |
| 8904 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8905 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8906 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8907 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8908 | |
| 8909 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8910 | |
| 8911 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8912 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8913 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8914 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8915 | { } /* end */ |
| 8916 | }; |
| 8917 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8918 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8924 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8925 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8926 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8927 | { } /* end */ |
| 8928 | }; |
| 8929 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8930 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8931 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8932 | { } |
| 8933 | }; |
| 8934 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8935 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8936 | /* HP */ |
| 8937 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8938 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8939 | |
| 8940 | /* enable unsolicited event */ |
| 8941 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8942 | |
| 8943 | { } /* end */ |
| 8944 | }; |
| 8945 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8946 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8947 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8948 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8949 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8950 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8951 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8952 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8953 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8954 | } |
| 8955 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8956 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8957 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8958 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8959 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8960 | {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] | 8961 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8962 | }; |
| 8963 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8964 | /* |
| 8965 | * 2ch mode |
| 8966 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8967 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8968 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8969 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8970 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8971 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8972 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8973 | }; |
| 8974 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8975 | /* |
| 8976 | * 4ch mode |
| 8977 | */ |
| 8978 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8979 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8980 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8981 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8982 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8983 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8984 | { } /* end */ |
| 8985 | }; |
| 8986 | |
| 8987 | /* |
| 8988 | * 6ch mode |
| 8989 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8990 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8991 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8992 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8993 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8994 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8995 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8996 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8997 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8998 | }; |
| 8999 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9000 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9001 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9002 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9003 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9004 | }; |
| 9005 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9006 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9007 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9008 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9009 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9010 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9011 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9012 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9013 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9014 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9015 | } |
| 9016 | |
| 9017 | /* toggle RCA according to the front-jack state */ |
| 9018 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9019 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9020 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9021 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9022 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9023 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9024 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9025 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9026 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9027 | unsigned int res) |
| 9028 | { |
| 9029 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9030 | alc888_lenovo_ms7195_front_automute(codec); |
| 9031 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9032 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9033 | } |
| 9034 | |
| 9035 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9036 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9038 | |
| 9039 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9040 | |
| 9041 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9042 | { } /* end */ |
| 9043 | }; |
| 9044 | |
| 9045 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9046 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9047 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9048 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9049 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9050 | spec->autocfg.hp_pins[0] = 0x14; |
| 9051 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9052 | } |
| 9053 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9054 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9055 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9056 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9057 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9058 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9059 | { |
| 9060 | unsigned int present; |
| 9061 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9062 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9063 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9064 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9065 | } |
| 9066 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9067 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9068 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9069 | struct alc_spec *spec = codec->spec; |
| 9070 | |
| 9071 | spec->autocfg.hp_pins[0] = 0x15; |
| 9072 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9073 | } |
| 9074 | |
| 9075 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9076 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9077 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9078 | alc883_clevo_m720_mic_automute(codec); |
| 9079 | } |
| 9080 | |
| 9081 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9082 | unsigned int res) |
| 9083 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9084 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9085 | case ALC880_MIC_EVENT: |
| 9086 | alc883_clevo_m720_mic_automute(codec); |
| 9087 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9088 | default: |
| 9089 | alc_automute_amp_unsol_event(codec, res); |
| 9090 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9091 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9092 | } |
| 9093 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9094 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9095 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9096 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9097 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9098 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9099 | spec->autocfg.hp_pins[0] = 0x14; |
| 9100 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9101 | } |
| 9102 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9103 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9104 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9105 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9106 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9107 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9108 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9109 | } |
| 9110 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9111 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9112 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9113 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9114 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9115 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9116 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9117 | } |
| 9118 | |
| 9119 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9120 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9121 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9122 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9123 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9124 | HDA_AMP_MUTE, bits); |
| 9125 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9126 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9127 | } |
| 9128 | |
| 9129 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9130 | unsigned int res) |
| 9131 | { |
| 9132 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9133 | alc883_lenovo_101e_all_automute(codec); |
| 9134 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9135 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9136 | } |
| 9137 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9138 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9139 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9140 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9141 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9142 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9143 | spec->autocfg.hp_pins[0] = 0x14; |
| 9144 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9145 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9146 | } |
| 9147 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9148 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9149 | /* HP Pin: output 0 (0x0c) */ |
| 9150 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9151 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9152 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9153 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9154 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9155 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9156 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9157 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9158 | /* eanable EAPD on medion laptop */ |
| 9159 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9160 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9161 | /* enable unsolicited event */ |
| 9162 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9163 | { } |
| 9164 | }; |
| 9165 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9166 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9168 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9169 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9170 | { } /* end */ |
| 9171 | }; |
| 9172 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9173 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9174 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9175 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9176 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9177 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9178 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9179 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9180 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9181 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9182 | } |
| 9183 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9184 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9185 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9186 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9187 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9188 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9189 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9190 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9191 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9192 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9193 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9194 | } |
| 9195 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9196 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9197 | { |
| 9198 | struct alc_spec *spec = codec->spec; |
| 9199 | |
| 9200 | spec->autocfg.hp_pins[0] = 0x15; |
| 9201 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9202 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9203 | } |
| 9204 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9205 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9206 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9207 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9209 | /* enable unsolicited event */ |
| 9210 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9211 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9212 | { } /* end */ |
| 9213 | }; |
| 9214 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9215 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9216 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9217 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9218 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9219 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9220 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9221 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9222 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9223 | spec->ext_mic.pin = 0x18; |
| 9224 | spec->int_mic.pin = 0x19; |
| 9225 | spec->ext_mic.mux_idx = 0; |
| 9226 | spec->int_mic.mux_idx = 1; |
| 9227 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9228 | } |
| 9229 | |
| 9230 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9231 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9233 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9234 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9235 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9236 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9237 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9238 | /* enable unsolicited event */ |
| 9239 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9240 | { } /* end */ |
| 9241 | }; |
| 9242 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9243 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9244 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9245 | struct alc_spec *spec = codec->spec; |
| 9246 | |
| 9247 | spec->autocfg.hp_pins[0] = 0x14; |
| 9248 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9249 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9250 | } |
| 9251 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9252 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9253 | /* Init rear pin (used as headphone output) */ |
| 9254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9255 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9256 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9257 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9258 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9259 | /* Init line 2 pin (used as headphone out by default) */ |
| 9260 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9261 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9262 | { } /* end */ |
| 9263 | }; |
| 9264 | |
| 9265 | /* Mute speakers according to the headphone jack state */ |
| 9266 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9267 | { |
| 9268 | unsigned int present; |
| 9269 | |
| 9270 | /* Mute only in 2ch or 4ch mode */ |
| 9271 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9272 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9273 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9274 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9275 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9276 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9277 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9278 | } |
| 9279 | } |
| 9280 | |
| 9281 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9282 | { |
| 9283 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9284 | alc889A_mb31_automute(codec); |
| 9285 | } |
| 9286 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9287 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9289 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9290 | #endif |
| 9291 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9292 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9293 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9294 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9295 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9296 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9297 | |
| 9298 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9299 | ALC1200_DIGOUT_NID, 0, |
| 9300 | }; |
| 9301 | |
| 9302 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9303 | ALC883_DIGOUT_NID, 0, |
| 9304 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9305 | |
| 9306 | /* |
| 9307 | * configuration and preset |
| 9308 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9309 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9310 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9311 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9312 | [ALC882_ARIMA] = "arima", |
| 9313 | [ALC882_W2JC] = "w2jc", |
| 9314 | [ALC882_TARGA] = "targa", |
| 9315 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9316 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9317 | [ALC885_MACPRO] = "macpro", |
| 9318 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9319 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9320 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9321 | [ALC885_MBP3] = "mbp3", |
| 9322 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9323 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9324 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9325 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9326 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9327 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9328 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9329 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9330 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9331 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9332 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9333 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9334 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9335 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9336 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9337 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9338 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9339 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9340 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9341 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9342 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9343 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9344 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9345 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9346 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9347 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9348 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9349 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9350 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9351 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9352 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9353 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9354 | [ALC889A_INTEL] = "intel-alc889a", |
| 9355 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9356 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9357 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9358 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9359 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9360 | }; |
| 9361 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9362 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9363 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9364 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9365 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9366 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9367 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9368 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9369 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9370 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9371 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9372 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9373 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9374 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9375 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9376 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9377 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9378 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9379 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9380 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9381 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9382 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9383 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9384 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9385 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9386 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9387 | /* default Acer -- disabled as it causes more problems. |
| 9388 | * model=auto should work fine now |
| 9389 | */ |
| 9390 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9391 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9392 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9394 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9395 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9396 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9397 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9398 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9399 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9400 | |
| 9401 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9402 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9403 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9404 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9405 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9406 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9407 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9408 | 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] | 9409 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9410 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9411 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9412 | |
| 9413 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9414 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9415 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9416 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9417 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9418 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9419 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9420 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9421 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9422 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9423 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9424 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9425 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9426 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9427 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9428 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9429 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9430 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9431 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9432 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9433 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9434 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9435 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9436 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9437 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9438 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9439 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9440 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9441 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9442 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9443 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9444 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9445 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9446 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9447 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9448 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9449 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9450 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9451 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9452 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9453 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9454 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9455 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9456 | 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] | 9457 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9458 | 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] | 9459 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9460 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9461 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9462 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9463 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9464 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9465 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9466 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9467 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9468 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9469 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9470 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9471 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9472 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9473 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9474 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9475 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9476 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9477 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9478 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9479 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9480 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9481 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9482 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9483 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9484 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9485 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9486 | {} |
| 9487 | }; |
| 9488 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9489 | /* codec SSID table for Intel Mac */ |
| 9490 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9491 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9492 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9493 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9494 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9495 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9496 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9497 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9498 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9499 | 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] | 9500 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9501 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9502 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9503 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9504 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9506 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9507 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9508 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9509 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9510 | */ |
| 9511 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9512 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9514 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9515 | }; |
| 9516 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9517 | static struct alc_config_preset alc882_presets[] = { |
| 9518 | [ALC882_3ST_DIG] = { |
| 9519 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9520 | .init_verbs = { alc882_base_init_verbs, |
| 9521 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9522 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9523 | .dac_nids = alc882_dac_nids, |
| 9524 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9525 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9526 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9527 | .channel_mode = alc882_ch_modes, |
| 9528 | .need_dac_fix = 1, |
| 9529 | .input_mux = &alc882_capture_source, |
| 9530 | }, |
| 9531 | [ALC882_6ST_DIG] = { |
| 9532 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9533 | .init_verbs = { alc882_base_init_verbs, |
| 9534 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9535 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9536 | .dac_nids = alc882_dac_nids, |
| 9537 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9538 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9539 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9540 | .channel_mode = alc882_sixstack_modes, |
| 9541 | .input_mux = &alc882_capture_source, |
| 9542 | }, |
| 9543 | [ALC882_ARIMA] = { |
| 9544 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9545 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9546 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9547 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9548 | .dac_nids = alc882_dac_nids, |
| 9549 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9550 | .channel_mode = alc882_sixstack_modes, |
| 9551 | .input_mux = &alc882_capture_source, |
| 9552 | }, |
| 9553 | [ALC882_W2JC] = { |
| 9554 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9555 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9556 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9557 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9558 | .dac_nids = alc882_dac_nids, |
| 9559 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9560 | .channel_mode = alc880_threestack_modes, |
| 9561 | .need_dac_fix = 1, |
| 9562 | .input_mux = &alc882_capture_source, |
| 9563 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9564 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9565 | [ALC885_MBA21] = { |
| 9566 | .mixers = { alc885_mba21_mixer }, |
| 9567 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9568 | .num_dacs = 2, |
| 9569 | .dac_nids = alc882_dac_nids, |
| 9570 | .channel_mode = alc885_mba21_ch_modes, |
| 9571 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9572 | .input_mux = &alc882_capture_source, |
| 9573 | .unsol_event = alc_automute_amp_unsol_event, |
| 9574 | .setup = alc885_mba21_setup, |
| 9575 | .init_hook = alc_automute_amp, |
| 9576 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9577 | [ALC885_MBP3] = { |
| 9578 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9579 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9580 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9581 | .num_dacs = 2, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9582 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9583 | .hp_nid = 0x04, |
| 9584 | .channel_mode = alc885_mbp_4ch_modes, |
| 9585 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9586 | .input_mux = &alc882_capture_source, |
| 9587 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9588 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9589 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9590 | .setup = alc885_mbp3_setup, |
| 9591 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9592 | }, |
| 9593 | [ALC885_MB5] = { |
| 9594 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9595 | .init_verbs = { alc885_mb5_init_verbs, |
| 9596 | alc880_gpio1_init_verbs }, |
| 9597 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9598 | .dac_nids = alc882_dac_nids, |
| 9599 | .channel_mode = alc885_mb5_6ch_modes, |
| 9600 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9601 | .input_mux = &mb5_capture_source, |
| 9602 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9603 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9604 | .unsol_event = alc_automute_amp_unsol_event, |
| 9605 | .setup = alc885_mb5_setup, |
| 9606 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9607 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9608 | [ALC885_MACMINI3] = { |
| 9609 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9610 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9611 | alc880_gpio1_init_verbs }, |
| 9612 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9613 | .dac_nids = alc882_dac_nids, |
| 9614 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9615 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9616 | .input_mux = &macmini3_capture_source, |
| 9617 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9618 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9619 | .unsol_event = alc_automute_amp_unsol_event, |
| 9620 | .setup = alc885_macmini3_setup, |
| 9621 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9622 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9623 | [ALC885_MACPRO] = { |
| 9624 | .mixers = { alc882_macpro_mixer }, |
| 9625 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9626 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9627 | .dac_nids = alc882_dac_nids, |
| 9628 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9629 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9630 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9631 | .channel_mode = alc882_ch_modes, |
| 9632 | .input_mux = &alc882_capture_source, |
| 9633 | .init_hook = alc885_macpro_init_hook, |
| 9634 | }, |
| 9635 | [ALC885_IMAC24] = { |
| 9636 | .mixers = { alc885_imac24_mixer }, |
| 9637 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9638 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9639 | .dac_nids = alc882_dac_nids, |
| 9640 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9641 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9642 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9643 | .channel_mode = alc882_ch_modes, |
| 9644 | .input_mux = &alc882_capture_source, |
| 9645 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9646 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9647 | .init_hook = alc885_imac24_init_hook, |
| 9648 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9649 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9650 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9651 | .init_verbs = { alc885_imac91_init_verbs, |
| 9652 | alc880_gpio1_init_verbs }, |
| 9653 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9654 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9655 | .channel_mode = alc885_mba21_ch_modes, |
| 9656 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9657 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9658 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9659 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9660 | .unsol_event = alc_automute_amp_unsol_event, |
| 9661 | .setup = alc885_imac91_setup, |
| 9662 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9663 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9664 | [ALC882_TARGA] = { |
| 9665 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9666 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9667 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9668 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9669 | .dac_nids = alc882_dac_nids, |
| 9670 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9671 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9672 | .adc_nids = alc882_adc_nids, |
| 9673 | .capsrc_nids = alc882_capsrc_nids, |
| 9674 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9675 | .channel_mode = alc882_3ST_6ch_modes, |
| 9676 | .need_dac_fix = 1, |
| 9677 | .input_mux = &alc882_capture_source, |
| 9678 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9679 | .setup = alc882_targa_setup, |
| 9680 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9681 | }, |
| 9682 | [ALC882_ASUS_A7J] = { |
| 9683 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9684 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9685 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9686 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9687 | .dac_nids = alc882_dac_nids, |
| 9688 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9689 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9690 | .adc_nids = alc882_adc_nids, |
| 9691 | .capsrc_nids = alc882_capsrc_nids, |
| 9692 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9693 | .channel_mode = alc882_3ST_6ch_modes, |
| 9694 | .need_dac_fix = 1, |
| 9695 | .input_mux = &alc882_capture_source, |
| 9696 | }, |
| 9697 | [ALC882_ASUS_A7M] = { |
| 9698 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9699 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9700 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9701 | alc882_asus_a7m_verbs }, |
| 9702 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9703 | .dac_nids = alc882_dac_nids, |
| 9704 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9705 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9706 | .channel_mode = alc880_threestack_modes, |
| 9707 | .need_dac_fix = 1, |
| 9708 | .input_mux = &alc882_capture_source, |
| 9709 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9710 | [ALC883_3ST_2ch_DIG] = { |
| 9711 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9712 | .init_verbs = { alc883_init_verbs }, |
| 9713 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9714 | .dac_nids = alc883_dac_nids, |
| 9715 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9716 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9717 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9718 | .channel_mode = alc883_3ST_2ch_modes, |
| 9719 | .input_mux = &alc883_capture_source, |
| 9720 | }, |
| 9721 | [ALC883_3ST_6ch_DIG] = { |
| 9722 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9723 | .init_verbs = { alc883_init_verbs }, |
| 9724 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9725 | .dac_nids = alc883_dac_nids, |
| 9726 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9727 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9728 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9729 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9730 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9731 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9732 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9733 | [ALC883_3ST_6ch] = { |
| 9734 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9735 | .init_verbs = { alc883_init_verbs }, |
| 9736 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9737 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9738 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9739 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9740 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9741 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9742 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9743 | [ALC883_3ST_6ch_INTEL] = { |
| 9744 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9745 | .init_verbs = { alc883_init_verbs }, |
| 9746 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9747 | .dac_nids = alc883_dac_nids, |
| 9748 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9749 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9750 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9751 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9752 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9753 | .need_dac_fix = 1, |
| 9754 | .input_mux = &alc883_3stack_6ch_intel, |
| 9755 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9756 | [ALC889A_INTEL] = { |
| 9757 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9758 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9759 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9760 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9761 | .dac_nids = alc883_dac_nids, |
| 9762 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9763 | .adc_nids = alc889_adc_nids, |
| 9764 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9765 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9766 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9767 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9768 | .channel_mode = alc889_8ch_intel_modes, |
| 9769 | .capsrc_nids = alc889_capsrc_nids, |
| 9770 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9771 | .setup = alc889_automute_setup, |
| 9772 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9773 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9774 | .need_dac_fix = 1, |
| 9775 | }, |
| 9776 | [ALC889_INTEL] = { |
| 9777 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9778 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9779 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9780 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9781 | .dac_nids = alc883_dac_nids, |
| 9782 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9783 | .adc_nids = alc889_adc_nids, |
| 9784 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9785 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9786 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9787 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9788 | .channel_mode = alc889_8ch_intel_modes, |
| 9789 | .capsrc_nids = alc889_capsrc_nids, |
| 9790 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9791 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9792 | .init_hook = alc889_intel_init_hook, |
| 9793 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9794 | .need_dac_fix = 1, |
| 9795 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9796 | [ALC883_6ST_DIG] = { |
| 9797 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9798 | .init_verbs = { alc883_init_verbs }, |
| 9799 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9800 | .dac_nids = alc883_dac_nids, |
| 9801 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9802 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9803 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9804 | .channel_mode = alc883_sixstack_modes, |
| 9805 | .input_mux = &alc883_capture_source, |
| 9806 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9807 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9808 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9809 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9810 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9811 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9812 | .dac_nids = alc883_dac_nids, |
| 9813 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9814 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9815 | .channel_mode = alc883_3ST_6ch_modes, |
| 9816 | .need_dac_fix = 1, |
| 9817 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9818 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9819 | .setup = alc882_targa_setup, |
| 9820 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9821 | }, |
| 9822 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9823 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9824 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9825 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9826 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9827 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9828 | .adc_nids = alc883_adc_nids_alt, |
| 9829 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9830 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9831 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9832 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9833 | .channel_mode = alc883_3ST_2ch_modes, |
| 9834 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9835 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9836 | .setup = alc882_targa_setup, |
| 9837 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9838 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9839 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9840 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9841 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9842 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9843 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9844 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9845 | .dac_nids = alc883_dac_nids, |
| 9846 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9847 | .adc_nids = alc883_adc_nids_rev, |
| 9848 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9849 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9850 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9851 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9852 | .channel_mode = alc883_4ST_8ch_modes, |
| 9853 | .need_dac_fix = 1, |
| 9854 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9855 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9856 | .setup = alc882_targa_setup, |
| 9857 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9858 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9859 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9860 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9861 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9862 | * and the headphone jack. Turn this on and rely on the |
| 9863 | * standard mute methods whenever the user wants to turn |
| 9864 | * these outputs off. |
| 9865 | */ |
| 9866 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9867 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9868 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9869 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9870 | .channel_mode = alc883_3ST_2ch_modes, |
| 9871 | .input_mux = &alc883_capture_source, |
| 9872 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9873 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9874 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9875 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9876 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9877 | .dac_nids = alc883_dac_nids, |
| 9878 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9879 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9880 | .channel_mode = alc883_3ST_2ch_modes, |
| 9881 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9882 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9883 | .setup = alc883_acer_aspire_setup, |
| 9884 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9885 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9886 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9887 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9888 | alc883_chmode_mixer }, |
| 9889 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9890 | alc888_acer_aspire_4930g_verbs }, |
| 9891 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9892 | .dac_nids = alc883_dac_nids, |
| 9893 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9894 | .adc_nids = alc883_adc_nids_rev, |
| 9895 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9896 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9897 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9898 | .channel_mode = alc883_3ST_6ch_modes, |
| 9899 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9900 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9901 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9902 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9903 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9904 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9905 | .setup = alc888_acer_aspire_4930g_setup, |
| 9906 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9907 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9908 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9909 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9910 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9911 | alc888_acer_aspire_6530g_verbs }, |
| 9912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9913 | .dac_nids = alc883_dac_nids, |
| 9914 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9915 | .adc_nids = alc883_adc_nids_rev, |
| 9916 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9917 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9918 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9919 | .channel_mode = alc883_3ST_2ch_modes, |
| 9920 | .num_mux_defs = |
| 9921 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9922 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9923 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9924 | .setup = alc888_acer_aspire_6530g_setup, |
| 9925 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9926 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9927 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9928 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9929 | alc883_chmode_mixer }, |
| 9930 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9931 | alc889_acer_aspire_8930g_verbs, |
| 9932 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9933 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9934 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9935 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9936 | .adc_nids = alc889_adc_nids, |
| 9937 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9938 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9939 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9940 | .channel_mode = alc883_3ST_6ch_modes, |
| 9941 | .need_dac_fix = 1, |
| 9942 | .const_channel_count = 6, |
| 9943 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9944 | ARRAY_SIZE(alc889_capture_sources), |
| 9945 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9946 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9947 | .setup = alc889_acer_aspire_8930g_setup, |
| 9948 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9949 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 9950 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9951 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9952 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9953 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9954 | .mixers = { alc883_3ST_6ch_mixer, |
| 9955 | alc883_chmode_mixer }, |
| 9956 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9957 | alc888_acer_aspire_7730G_verbs }, |
| 9958 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9959 | .dac_nids = alc883_dac_nids, |
| 9960 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9961 | .adc_nids = alc883_adc_nids_rev, |
| 9962 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9963 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9964 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9965 | .channel_mode = alc883_3ST_6ch_modes, |
| 9966 | .need_dac_fix = 1, |
| 9967 | .const_channel_count = 6, |
| 9968 | .input_mux = &alc883_capture_source, |
| 9969 | .unsol_event = alc_automute_amp_unsol_event, |
| 9970 | .setup = alc888_acer_aspire_6530g_setup, |
| 9971 | .init_hook = alc_automute_amp, |
| 9972 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9973 | [ALC883_MEDION] = { |
| 9974 | .mixers = { alc883_fivestack_mixer, |
| 9975 | alc883_chmode_mixer }, |
| 9976 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9977 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9978 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9979 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9980 | .adc_nids = alc883_adc_nids_alt, |
| 9981 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9982 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9983 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9984 | .channel_mode = alc883_sixstack_modes, |
| 9985 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9986 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9987 | [ALC883_MEDION_MD2] = { |
| 9988 | .mixers = { alc883_medion_md2_mixer}, |
| 9989 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9990 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9991 | .dac_nids = alc883_dac_nids, |
| 9992 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9993 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9994 | .channel_mode = alc883_3ST_2ch_modes, |
| 9995 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9996 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9997 | .setup = alc883_medion_md2_setup, |
| 9998 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9999 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10000 | [ALC883_MEDION_WIM2160] = { |
| 10001 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10002 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10003 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10004 | .dac_nids = alc883_dac_nids, |
| 10005 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10006 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10007 | .adc_nids = alc883_adc_nids, |
| 10008 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10009 | .channel_mode = alc883_3ST_2ch_modes, |
| 10010 | .input_mux = &alc883_capture_source, |
| 10011 | .unsol_event = alc_automute_amp_unsol_event, |
| 10012 | .setup = alc883_medion_wim2160_setup, |
| 10013 | .init_hook = alc_automute_amp, |
| 10014 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10015 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10016 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10017 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10018 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10019 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10020 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10021 | .channel_mode = alc883_3ST_2ch_modes, |
| 10022 | .input_mux = &alc883_capture_source, |
| 10023 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10024 | [ALC883_CLEVO_M540R] = { |
| 10025 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10026 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10027 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10028 | .dac_nids = alc883_dac_nids, |
| 10029 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10030 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10031 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10032 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10033 | .need_dac_fix = 1, |
| 10034 | .input_mux = &alc883_capture_source, |
| 10035 | /* This machine has the hardware HP auto-muting, thus |
| 10036 | * we need no software mute via unsol event |
| 10037 | */ |
| 10038 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10039 | [ALC883_CLEVO_M720] = { |
| 10040 | .mixers = { alc883_clevo_m720_mixer }, |
| 10041 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10042 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10043 | .dac_nids = alc883_dac_nids, |
| 10044 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10045 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10046 | .channel_mode = alc883_3ST_2ch_modes, |
| 10047 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10048 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10049 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10050 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10051 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10052 | [ALC883_LENOVO_101E_2ch] = { |
| 10053 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10054 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10055 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10056 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10057 | .adc_nids = alc883_adc_nids_alt, |
| 10058 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10059 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10060 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10061 | .channel_mode = alc883_3ST_2ch_modes, |
| 10062 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10063 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10064 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10065 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10066 | [ALC883_LENOVO_NB0763] = { |
| 10067 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10068 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10069 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10070 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10071 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10072 | .channel_mode = alc883_3ST_2ch_modes, |
| 10073 | .need_dac_fix = 1, |
| 10074 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10075 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10076 | .setup = alc883_medion_md2_setup, |
| 10077 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10078 | }, |
| 10079 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10080 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10081 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10082 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10083 | .dac_nids = alc883_dac_nids, |
| 10084 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10085 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10086 | .channel_mode = alc883_3ST_6ch_modes, |
| 10087 | .need_dac_fix = 1, |
| 10088 | .input_mux = &alc883_capture_source, |
| 10089 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10090 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10091 | }, |
| 10092 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10093 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10094 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10095 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10096 | .dac_nids = alc883_dac_nids, |
| 10097 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10098 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10099 | .channel_mode = alc883_3ST_2ch_modes, |
| 10100 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10101 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10102 | .setup = alc883_haier_w66_setup, |
| 10103 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10104 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10105 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10106 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10107 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10108 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10109 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10110 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10111 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10112 | .need_dac_fix = 1, |
| 10113 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10114 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10115 | .setup = alc888_3st_hp_setup, |
| 10116 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10117 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10118 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10119 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10120 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10121 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10122 | .dac_nids = alc883_dac_nids, |
| 10123 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10124 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10125 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10126 | .channel_mode = alc883_sixstack_modes, |
| 10127 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10128 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10129 | .setup = alc888_6st_dell_setup, |
| 10130 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10131 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10132 | [ALC883_MITAC] = { |
| 10133 | .mixers = { alc883_mitac_mixer }, |
| 10134 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10135 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10136 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10137 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10138 | .channel_mode = alc883_3ST_2ch_modes, |
| 10139 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10140 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10141 | .setup = alc883_mitac_setup, |
| 10142 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10143 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10144 | [ALC883_FUJITSU_PI2515] = { |
| 10145 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10146 | .init_verbs = { alc883_init_verbs, |
| 10147 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10148 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10149 | .dac_nids = alc883_dac_nids, |
| 10150 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10151 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10152 | .channel_mode = alc883_3ST_2ch_modes, |
| 10153 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10154 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10155 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10156 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10157 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10158 | [ALC888_FUJITSU_XA3530] = { |
| 10159 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10160 | .init_verbs = { alc883_init_verbs, |
| 10161 | alc888_fujitsu_xa3530_verbs }, |
| 10162 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10163 | .dac_nids = alc883_dac_nids, |
| 10164 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10165 | .adc_nids = alc883_adc_nids_rev, |
| 10166 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10167 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10168 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10169 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10170 | .num_mux_defs = |
| 10171 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10172 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10173 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10174 | .setup = alc888_fujitsu_xa3530_setup, |
| 10175 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10176 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10177 | [ALC888_LENOVO_SKY] = { |
| 10178 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10179 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10180 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10181 | .dac_nids = alc883_dac_nids, |
| 10182 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10183 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10184 | .channel_mode = alc883_sixstack_modes, |
| 10185 | .need_dac_fix = 1, |
| 10186 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10187 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10188 | .setup = alc888_lenovo_sky_setup, |
| 10189 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10190 | }, |
| 10191 | [ALC888_ASUS_M90V] = { |
| 10192 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10193 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10194 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10195 | .dac_nids = alc883_dac_nids, |
| 10196 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10197 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10198 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10199 | .channel_mode = alc883_3ST_6ch_modes, |
| 10200 | .need_dac_fix = 1, |
| 10201 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10202 | .unsol_event = alc_sku_unsol_event, |
| 10203 | .setup = alc883_mode2_setup, |
| 10204 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10205 | }, |
| 10206 | [ALC888_ASUS_EEE1601] = { |
| 10207 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10208 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10209 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10210 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10211 | .dac_nids = alc883_dac_nids, |
| 10212 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10213 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10214 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10215 | .channel_mode = alc883_3ST_2ch_modes, |
| 10216 | .need_dac_fix = 1, |
| 10217 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10218 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10219 | .init_hook = alc883_eee1601_inithook, |
| 10220 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10221 | [ALC1200_ASUS_P5Q] = { |
| 10222 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10223 | .init_verbs = { alc883_init_verbs }, |
| 10224 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10225 | .dac_nids = alc883_dac_nids, |
| 10226 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10227 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10228 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10229 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10230 | .channel_mode = alc883_sixstack_modes, |
| 10231 | .input_mux = &alc883_capture_source, |
| 10232 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10233 | [ALC889A_MB31] = { |
| 10234 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10235 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10236 | alc880_gpio1_init_verbs }, |
| 10237 | .adc_nids = alc883_adc_nids, |
| 10238 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10239 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10240 | .dac_nids = alc883_dac_nids, |
| 10241 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10242 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10243 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10244 | .input_mux = &alc889A_mb31_capture_source, |
| 10245 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10246 | .unsol_event = alc889A_mb31_unsol_event, |
| 10247 | .init_hook = alc889A_mb31_automute, |
| 10248 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10249 | [ALC883_SONY_VAIO_TT] = { |
| 10250 | .mixers = { alc883_vaiott_mixer }, |
| 10251 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10252 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10253 | .dac_nids = alc883_dac_nids, |
| 10254 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10255 | .channel_mode = alc883_3ST_2ch_modes, |
| 10256 | .input_mux = &alc883_capture_source, |
| 10257 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10258 | .setup = alc883_vaiott_setup, |
| 10259 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10260 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10261 | }; |
| 10262 | |
| 10263 | |
| 10264 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10265 | * Pin config fixes |
| 10266 | */ |
| 10267 | enum { |
| 10268 | PINFIX_ABIT_AW9D_MAX |
| 10269 | }; |
| 10270 | |
| 10271 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10272 | { 0x15, 0x01080104 }, /* side */ |
| 10273 | { 0x16, 0x01011012 }, /* rear */ |
| 10274 | { 0x17, 0x01016011 }, /* clfe */ |
| 10275 | { } |
| 10276 | }; |
| 10277 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10278 | static const struct alc_fixup alc882_fixups[] = { |
| 10279 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10280 | .pins = alc882_abit_aw9d_pinfix |
| 10281 | }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10282 | }; |
| 10283 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10284 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10285 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10286 | {} |
| 10287 | }; |
| 10288 | |
| 10289 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10290 | * BIOS auto configuration |
| 10291 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10292 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10293 | const struct auto_pin_cfg *cfg) |
| 10294 | { |
| 10295 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10296 | } |
| 10297 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10298 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10299 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10300 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10301 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10302 | int idx; |
| 10303 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10304 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10305 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10306 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10307 | if (dac == 0x25) |
| 10308 | idx = 4; |
| 10309 | else if (dac >= 0x02 && dac <= 0x05) |
| 10310 | idx = dac - 2; |
| 10311 | else |
| 10312 | return; |
| 10313 | 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] | 10314 | } |
| 10315 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10316 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10317 | { |
| 10318 | struct alc_spec *spec = codec->spec; |
| 10319 | int i; |
| 10320 | |
| 10321 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10322 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10323 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10324 | if (nid) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10325 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10326 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10327 | } |
| 10328 | } |
| 10329 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10330 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10331 | { |
| 10332 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10333 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10334 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10335 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10336 | if (pin) { |
| 10337 | dac = spec->multiout.hp_nid; |
| 10338 | if (!dac) |
| 10339 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10340 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10341 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10342 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10343 | if (pin) { |
| 10344 | dac = spec->multiout.extra_out_nid[0]; |
| 10345 | if (!dac) |
| 10346 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10347 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10348 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10349 | } |
| 10350 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10351 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10352 | { |
| 10353 | struct alc_spec *spec = codec->spec; |
| 10354 | int i; |
| 10355 | |
| 10356 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10357 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10358 | if (!nid) |
| 10359 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10360 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10361 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10362 | snd_hda_codec_write(codec, nid, 0, |
| 10363 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10364 | AMP_OUT_MUTE); |
| 10365 | } |
| 10366 | } |
| 10367 | |
| 10368 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10369 | { |
| 10370 | struct alc_spec *spec = codec->spec; |
| 10371 | int c; |
| 10372 | |
| 10373 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10374 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10375 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10376 | unsigned int mux_idx; |
| 10377 | const struct hda_input_mux *imux; |
| 10378 | int conns, mute, idx, item; |
| 10379 | |
| 10380 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10381 | ARRAY_SIZE(conn_list)); |
| 10382 | if (conns < 0) |
| 10383 | continue; |
| 10384 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10385 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10386 | if (!imux->num_items && mux_idx > 0) |
| 10387 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10388 | for (idx = 0; idx < conns; idx++) { |
| 10389 | /* if the current connection is the selected one, |
| 10390 | * unmute it as default - otherwise mute it |
| 10391 | */ |
| 10392 | mute = AMP_IN_MUTE(idx); |
| 10393 | for (item = 0; item < imux->num_items; item++) { |
| 10394 | if (imux->items[item].index == idx) { |
| 10395 | if (spec->cur_mux[c] == item) |
| 10396 | mute = AMP_IN_UNMUTE(idx); |
| 10397 | break; |
| 10398 | } |
| 10399 | } |
| 10400 | /* check if we have a selector or mixer |
| 10401 | * we could check for the widget type instead, but |
| 10402 | * just check for Amp-In presence (in case of mixer |
| 10403 | * without amp-in there is something wrong, this |
| 10404 | * function shouldn't be used or capsrc nid is wrong) |
| 10405 | */ |
| 10406 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10407 | snd_hda_codec_write(codec, nid, 0, |
| 10408 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10409 | mute); |
| 10410 | else if (mute != AMP_IN_MUTE(idx)) |
| 10411 | snd_hda_codec_write(codec, nid, 0, |
| 10412 | AC_VERB_SET_CONNECT_SEL, |
| 10413 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10414 | } |
| 10415 | } |
| 10416 | } |
| 10417 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10418 | /* add mic boosts if needed */ |
| 10419 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10420 | { |
| 10421 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10422 | int err; |
| 10423 | hda_nid_t nid; |
| 10424 | |
| 10425 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10426 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10427 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10428 | "Mic Boost", |
| 10429 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10430 | if (err < 0) |
| 10431 | return err; |
| 10432 | } |
| 10433 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10434 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10435 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10436 | "Front Mic Boost", |
| 10437 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10438 | if (err < 0) |
| 10439 | return err; |
| 10440 | } |
| 10441 | return 0; |
| 10442 | } |
| 10443 | |
| 10444 | /* almost identical with ALC880 parser... */ |
| 10445 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10446 | { |
| 10447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10448 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10449 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10450 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10451 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10452 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10453 | if (err < 0) |
| 10454 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10455 | if (!spec->autocfg.line_outs) |
| 10456 | return 0; /* can't find valid BIOS pin config */ |
| 10457 | |
| 10458 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10459 | if (err < 0) |
| 10460 | return err; |
| 10461 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10462 | if (err < 0) |
| 10463 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10464 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10465 | "Headphone"); |
| 10466 | if (err < 0) |
| 10467 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10468 | err = alc880_auto_create_extra_out(spec, |
| 10469 | spec->autocfg.speaker_pins[0], |
| 10470 | "Speaker"); |
| 10471 | if (err < 0) |
| 10472 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10473 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10474 | if (err < 0) |
| 10475 | return err; |
| 10476 | |
| 10477 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10478 | |
| 10479 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10480 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10481 | hda_nid_t dig_nid; |
| 10482 | err = snd_hda_get_connections(codec, |
| 10483 | spec->autocfg.dig_out_pins[i], |
| 10484 | &dig_nid, 1); |
| 10485 | if (err < 0) |
| 10486 | continue; |
| 10487 | if (!i) |
| 10488 | spec->multiout.dig_out_nid = dig_nid; |
| 10489 | else { |
| 10490 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10491 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10492 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10493 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10494 | } |
| 10495 | } |
| 10496 | if (spec->autocfg.dig_in_pin) |
| 10497 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10498 | |
| 10499 | if (spec->kctls.list) |
| 10500 | add_mixer(spec, spec->kctls.list); |
| 10501 | |
| 10502 | add_verb(spec, alc883_auto_init_verbs); |
| 10503 | /* if ADC 0x07 is available, initialize it, too */ |
| 10504 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10505 | add_verb(spec, alc882_adc1_init_verbs); |
| 10506 | |
| 10507 | spec->num_mux_defs = 1; |
| 10508 | spec->input_mux = &spec->private_imux[0]; |
| 10509 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10510 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10511 | |
| 10512 | err = alc_auto_add_mic_boost(codec); |
| 10513 | if (err < 0) |
| 10514 | return err; |
| 10515 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10516 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10517 | } |
| 10518 | |
| 10519 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10520 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10521 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10522 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10523 | alc882_auto_init_multi_out(codec); |
| 10524 | alc882_auto_init_hp_out(codec); |
| 10525 | alc882_auto_init_analog_input(codec); |
| 10526 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10527 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10528 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10529 | } |
| 10530 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10531 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10532 | { |
| 10533 | struct alc_spec *spec; |
| 10534 | int err, board_config; |
| 10535 | |
| 10536 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10537 | if (spec == NULL) |
| 10538 | return -ENOMEM; |
| 10539 | |
| 10540 | codec->spec = spec; |
| 10541 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10542 | alc_auto_parse_customize_define(codec); |
| 10543 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10544 | switch (codec->vendor_id) { |
| 10545 | case 0x10ec0882: |
| 10546 | case 0x10ec0885: |
| 10547 | break; |
| 10548 | default: |
| 10549 | /* ALC883 and variants */ |
| 10550 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10551 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10552 | } |
| 10553 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10554 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10555 | alc882_models, |
| 10556 | alc882_cfg_tbl); |
| 10557 | |
| 10558 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10559 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10560 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10561 | |
| 10562 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10563 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10564 | codec->chip_name); |
| 10565 | board_config = ALC882_AUTO; |
| 10566 | } |
| 10567 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10568 | if (board_config == ALC882_AUTO) |
| 10569 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10570 | |
| 10571 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10572 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10573 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10574 | if (err < 0) { |
| 10575 | alc_free(codec); |
| 10576 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10577 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10578 | printk(KERN_INFO |
| 10579 | "hda_codec: Cannot set up configuration " |
| 10580 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10581 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10582 | } |
| 10583 | } |
| 10584 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 10585 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10586 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10587 | if (err < 0) { |
| 10588 | alc_free(codec); |
| 10589 | return err; |
| 10590 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10591 | } |
| 10592 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10593 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10594 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10595 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10596 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10597 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10598 | /* FIXME: setup DAC5 */ |
| 10599 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10600 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10601 | |
| 10602 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10603 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10604 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10605 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10606 | int i, j; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10607 | spec->num_adc_nids = 0; |
| 10608 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10609 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10610 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10611 | hda_nid_t items[16]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10612 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10613 | unsigned int wcap = get_wcaps(codec, nid); |
| 10614 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10615 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10616 | if (wcap != AC_WID_AUD_IN) |
| 10617 | continue; |
| 10618 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10619 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10620 | if (err < 0) |
| 10621 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10622 | err = snd_hda_get_connections(codec, cap, items, |
| 10623 | ARRAY_SIZE(items)); |
| 10624 | if (err < 0) |
| 10625 | continue; |
| 10626 | for (j = 0; j < imux->num_items; j++) |
| 10627 | if (imux->items[j].index >= err) |
| 10628 | break; |
| 10629 | if (j < imux->num_items) |
| 10630 | continue; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10631 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10632 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10633 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10634 | spec->adc_nids = spec->private_adc_nids; |
| 10635 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10636 | } |
| 10637 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10638 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10639 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 10640 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10641 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10642 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10643 | if (board_config == ALC882_AUTO) |
| 10644 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10645 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10646 | spec->vmaster_nid = 0x0c; |
| 10647 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10648 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10649 | if (board_config == ALC882_AUTO) |
| 10650 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10651 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10652 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10653 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10654 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10655 | |
| 10656 | return 0; |
| 10657 | } |
| 10658 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10659 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10660 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10661 | * ALC262 support |
| 10662 | */ |
| 10663 | |
| 10664 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10665 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10666 | |
| 10667 | #define alc262_dac_nids alc260_dac_nids |
| 10668 | #define alc262_adc_nids alc882_adc_nids |
| 10669 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10670 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10671 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10672 | |
| 10673 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10674 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10675 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10676 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10677 | /* ADC0 */ |
| 10678 | 0x09 |
| 10679 | }; |
| 10680 | |
| 10681 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10682 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10683 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10685 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10686 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10687 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10688 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10689 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10692 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10693 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10694 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10695 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10697 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10698 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10699 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10700 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10701 | }; |
| 10702 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10703 | /* update HP, line and mono-out pins according to the master switch */ |
| 10704 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10705 | { |
| 10706 | struct alc_spec *spec = codec->spec; |
| 10707 | int val = spec->master_sw; |
| 10708 | |
| 10709 | /* HP & line-out */ |
| 10710 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10711 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10712 | val ? PIN_HP : 0); |
| 10713 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10714 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10715 | val ? PIN_HP : 0); |
| 10716 | /* mono (speaker) depending on the HP jack sense */ |
| 10717 | val = val && !spec->jack_present; |
| 10718 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10719 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10720 | val ? PIN_OUT : 0); |
| 10721 | } |
| 10722 | |
| 10723 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10724 | { |
| 10725 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10726 | |
| 10727 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10728 | alc262_hp_master_update(codec); |
| 10729 | } |
| 10730 | |
| 10731 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10732 | { |
| 10733 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10734 | return; |
| 10735 | alc262_hp_bpc_automute(codec); |
| 10736 | } |
| 10737 | |
| 10738 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10739 | { |
| 10740 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10741 | |
| 10742 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10743 | alc262_hp_master_update(codec); |
| 10744 | } |
| 10745 | |
| 10746 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10747 | unsigned int res) |
| 10748 | { |
| 10749 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10750 | return; |
| 10751 | alc262_hp_wildwest_automute(codec); |
| 10752 | } |
| 10753 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10754 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10755 | |
| 10756 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10757 | struct snd_ctl_elem_value *ucontrol) |
| 10758 | { |
| 10759 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10760 | struct alc_spec *spec = codec->spec; |
| 10761 | int val = !!*ucontrol->value.integer.value; |
| 10762 | |
| 10763 | if (val == spec->master_sw) |
| 10764 | return 0; |
| 10765 | spec->master_sw = val; |
| 10766 | alc262_hp_master_update(codec); |
| 10767 | return 1; |
| 10768 | } |
| 10769 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10770 | #define ALC262_HP_MASTER_SWITCH \ |
| 10771 | { \ |
| 10772 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10773 | .name = "Master Playback Switch", \ |
| 10774 | .info = snd_ctl_boolean_mono_info, \ |
| 10775 | .get = alc262_hp_master_sw_get, \ |
| 10776 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10777 | }, \ |
| 10778 | { \ |
| 10779 | .iface = NID_MAPPING, \ |
| 10780 | .name = "Master Playback Switch", \ |
| 10781 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10782 | } |
| 10783 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10784 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10785 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10786 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10787 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10788 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10790 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10791 | HDA_OUTPUT), |
| 10792 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10793 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10797 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10798 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10799 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10800 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10801 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10804 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10805 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10806 | { } /* end */ |
| 10807 | }; |
| 10808 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10809 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10810 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10811 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10812 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10813 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10814 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10815 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10816 | HDA_OUTPUT), |
| 10817 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10818 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10819 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10820 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10821 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10822 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10823 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10824 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10825 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10826 | { } /* end */ |
| 10827 | }; |
| 10828 | |
| 10829 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10830 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10831 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10832 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10833 | { } /* end */ |
| 10834 | }; |
| 10835 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10836 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10837 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10838 | { |
| 10839 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10840 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10841 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10842 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10843 | } |
| 10844 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10845 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10846 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10847 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10848 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10849 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10852 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10853 | { } /* end */ |
| 10854 | }; |
| 10855 | |
| 10856 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10857 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10859 | |
| 10860 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10861 | { } |
| 10862 | }; |
| 10863 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10864 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10865 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10866 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10867 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10868 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10869 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10870 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10871 | { } /* end */ |
| 10872 | }; |
| 10873 | |
| 10874 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10875 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10876 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10877 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10878 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10879 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10880 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10884 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10885 | {} |
| 10886 | }; |
| 10887 | |
| 10888 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10889 | .num_items = 1, |
| 10890 | .items = { |
| 10891 | { "Line", 0x1 }, |
| 10892 | }, |
| 10893 | }; |
| 10894 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10895 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10896 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10897 | { |
| 10898 | struct alc_spec *spec = codec->spec; |
| 10899 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10900 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10901 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10902 | unsigned int mute; |
| 10903 | |
| 10904 | /* HP */ |
| 10905 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10906 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10907 | HDA_AMP_MUTE, mute); |
| 10908 | /* mute internal speaker per jack sense */ |
| 10909 | if (spec->jack_present) |
| 10910 | mute = HDA_AMP_MUTE; |
| 10911 | if (line_nid) |
| 10912 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10913 | HDA_AMP_MUTE, mute); |
| 10914 | if (speaker_nid && speaker_nid != line_nid) |
| 10915 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10916 | HDA_AMP_MUTE, mute); |
| 10917 | } |
| 10918 | |
| 10919 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10920 | |
| 10921 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10922 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10923 | { |
| 10924 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10925 | struct alc_spec *spec = codec->spec; |
| 10926 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10927 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10928 | if (val == spec->master_sw) |
| 10929 | return 0; |
| 10930 | spec->master_sw = val; |
| 10931 | alc262_hippo_master_update(codec); |
| 10932 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10933 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10934 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10935 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10936 | { \ |
| 10937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10938 | .name = "Master Playback Switch", \ |
| 10939 | .info = snd_ctl_boolean_mono_info, \ |
| 10940 | .get = alc262_hippo_master_sw_get, \ |
| 10941 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10942 | }, \ |
| 10943 | { \ |
| 10944 | .iface = NID_MAPPING, \ |
| 10945 | .name = "Master Playback Switch", \ |
| 10946 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 10947 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10948 | } |
| 10949 | |
| 10950 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10951 | ALC262_HIPPO_MASTER_SWITCH, |
| 10952 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10953 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10954 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10955 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10956 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10957 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10958 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10959 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10960 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10961 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10962 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10963 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10964 | { } /* end */ |
| 10965 | }; |
| 10966 | |
| 10967 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10968 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10969 | ALC262_HIPPO_MASTER_SWITCH, |
| 10970 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10971 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10972 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10973 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10977 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10978 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10979 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10980 | { } /* end */ |
| 10981 | }; |
| 10982 | |
| 10983 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10984 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10985 | { |
| 10986 | struct alc_spec *spec = codec->spec; |
| 10987 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10988 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10989 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10990 | alc262_hippo_master_update(codec); |
| 10991 | } |
| 10992 | |
| 10993 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10994 | { |
| 10995 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10996 | return; |
| 10997 | alc262_hippo_automute(codec); |
| 10998 | } |
| 10999 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11000 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11001 | { |
| 11002 | struct alc_spec *spec = codec->spec; |
| 11003 | |
| 11004 | spec->autocfg.hp_pins[0] = 0x15; |
| 11005 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11006 | } |
| 11007 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11008 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11009 | { |
| 11010 | struct alc_spec *spec = codec->spec; |
| 11011 | |
| 11012 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11013 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11014 | } |
| 11015 | |
| 11016 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11017 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11018 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11019 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11022 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11023 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11024 | { } /* end */ |
| 11025 | }; |
| 11026 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11027 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11028 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11029 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11031 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11032 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11033 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11034 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11035 | { } /* end */ |
| 11036 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11037 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11038 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11039 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11040 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11041 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11042 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11043 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11044 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11047 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11048 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11050 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11051 | { } /* end */ |
| 11052 | }; |
| 11053 | |
| 11054 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11055 | /* Headphone automute */ |
| 11056 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11057 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11058 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11059 | |
| 11060 | /* P11 AUX_IN, white 4-pin connector */ |
| 11061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11062 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11063 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11064 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11065 | |
| 11066 | {} |
| 11067 | }; |
| 11068 | |
| 11069 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11070 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11071 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11072 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11073 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11074 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11075 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11076 | } |
| 11077 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11078 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11079 | #define alc262_capture_mixer alc882_capture_mixer |
| 11080 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11081 | |
| 11082 | /* |
| 11083 | * generic initialization of ADC, input mixers and output mixers |
| 11084 | */ |
| 11085 | static struct hda_verb alc262_init_verbs[] = { |
| 11086 | /* |
| 11087 | * Unmute ADC0-2 and set the default input to mic-in |
| 11088 | */ |
| 11089 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11090 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11091 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11093 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11095 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11096 | /* 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] | 11097 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11098 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11099 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11100 | */ |
| 11101 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11106 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11107 | |
| 11108 | /* |
| 11109 | * Set up output mixers (0x0c - 0x0e) |
| 11110 | */ |
| 11111 | /* set vol=0 to output mixers */ |
| 11112 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11114 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11115 | /* set up input amps for analog loopback */ |
| 11116 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11117 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11118 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11119 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11120 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11121 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11122 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11123 | |
| 11124 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11125 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11126 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11127 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11128 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11129 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11130 | |
| 11131 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11133 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11134 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11135 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11136 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11137 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11138 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11139 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11140 | /* FIXME: use matrix-type input source selection */ |
| 11141 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11142 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11143 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11144 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11147 | /* Input mixer2 */ |
| 11148 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11149 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11152 | /* Input mixer3 */ |
| 11153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11154 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11157 | |
| 11158 | { } |
| 11159 | }; |
| 11160 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11161 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11162 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11163 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11164 | { } |
| 11165 | }; |
| 11166 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11167 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11168 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11169 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11170 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11171 | |
| 11172 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11173 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11174 | {} |
| 11175 | }; |
| 11176 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11177 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11178 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11179 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11180 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11181 | |
| 11182 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11183 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11184 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11185 | }; |
| 11186 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11187 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11188 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11189 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11190 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11191 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11192 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11193 | { } /* end */ |
| 11194 | }; |
| 11195 | |
| 11196 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11197 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11198 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11199 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11201 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11202 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11203 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11204 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11205 | {} |
| 11206 | }; |
| 11207 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11208 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11209 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11210 | struct alc_spec *spec = codec->spec; |
| 11211 | |
| 11212 | spec->autocfg.hp_pins[0] = 0x15; |
| 11213 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11214 | spec->ext_mic.pin = 0x18; |
| 11215 | spec->ext_mic.mux_idx = 0; |
| 11216 | spec->int_mic.pin = 0x12; |
| 11217 | spec->int_mic.mux_idx = 9; |
| 11218 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11219 | } |
| 11220 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11221 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11222 | * nec model |
| 11223 | * 0x15 = headphone |
| 11224 | * 0x16 = internal speaker |
| 11225 | * 0x18 = external mic |
| 11226 | */ |
| 11227 | |
| 11228 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11229 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11230 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11231 | |
| 11232 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11234 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11235 | |
| 11236 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11237 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11238 | { } /* end */ |
| 11239 | }; |
| 11240 | |
| 11241 | static struct hda_verb alc262_nec_verbs[] = { |
| 11242 | /* Unmute Speaker */ |
| 11243 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11244 | |
| 11245 | /* Headphone */ |
| 11246 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11248 | |
| 11249 | /* External mic to headphone */ |
| 11250 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11251 | /* External mic to speaker */ |
| 11252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11253 | {} |
| 11254 | }; |
| 11255 | |
| 11256 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11257 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11258 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11259 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11260 | */ |
| 11261 | |
| 11262 | #define ALC_HP_EVENT 0x37 |
| 11263 | |
| 11264 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11265 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11267 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11269 | {} |
| 11270 | }; |
| 11271 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11272 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11273 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11274 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11275 | {} |
| 11276 | }; |
| 11277 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11278 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11279 | /* Front Mic pin: input vref at 50% */ |
| 11280 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11282 | {} |
| 11283 | }; |
| 11284 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11285 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11286 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11287 | .items = { |
| 11288 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11289 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11290 | { "CD", 0x4 }, |
| 11291 | }, |
| 11292 | }; |
| 11293 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11294 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11295 | .num_items = 5, |
| 11296 | .items = { |
| 11297 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11298 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11299 | { "Line", 0x2 }, |
| 11300 | { "CD", 0x4 }, |
| 11301 | { "AUX IN", 0x6 }, |
| 11302 | }, |
| 11303 | }; |
| 11304 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11305 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11306 | .num_items = 4, |
| 11307 | .items = { |
| 11308 | { "Mic", 0x0 }, |
| 11309 | { "Front Mic", 0x2 }, |
| 11310 | { "Line", 0x1 }, |
| 11311 | { "CD", 0x4 }, |
| 11312 | }, |
| 11313 | }; |
| 11314 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11315 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11316 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11317 | { |
| 11318 | struct alc_spec *spec = codec->spec; |
| 11319 | unsigned int mute; |
| 11320 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11321 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11322 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11323 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11324 | spec->sense_updated = 1; |
| 11325 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11326 | /* unmute internal speaker only if both HPs are unplugged and |
| 11327 | * master switch is on |
| 11328 | */ |
| 11329 | if (spec->jack_present) |
| 11330 | mute = HDA_AMP_MUTE; |
| 11331 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11332 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11333 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11334 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11335 | } |
| 11336 | |
| 11337 | /* unsolicited event for HP jack sensing */ |
| 11338 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11339 | unsigned int res) |
| 11340 | { |
| 11341 | if ((res >> 26) != ALC_HP_EVENT) |
| 11342 | return; |
| 11343 | alc262_fujitsu_automute(codec, 1); |
| 11344 | } |
| 11345 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11346 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11347 | { |
| 11348 | alc262_fujitsu_automute(codec, 1); |
| 11349 | } |
| 11350 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11351 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11352 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11353 | .ops = &snd_hda_bind_vol, |
| 11354 | .values = { |
| 11355 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11356 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11357 | 0 |
| 11358 | }, |
| 11359 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11360 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11361 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11362 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11363 | { |
| 11364 | struct alc_spec *spec = codec->spec; |
| 11365 | unsigned int mute; |
| 11366 | |
| 11367 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11368 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11369 | spec->sense_updated = 1; |
| 11370 | } |
| 11371 | if (spec->jack_present) { |
| 11372 | /* mute internal speaker */ |
| 11373 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11374 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11375 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11376 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11377 | } else { |
| 11378 | /* unmute internal speaker if necessary */ |
| 11379 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11380 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11381 | HDA_AMP_MUTE, mute); |
| 11382 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11383 | HDA_AMP_MUTE, mute); |
| 11384 | } |
| 11385 | } |
| 11386 | |
| 11387 | /* unsolicited event for HP jack sensing */ |
| 11388 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11389 | unsigned int res) |
| 11390 | { |
| 11391 | if ((res >> 26) != ALC_HP_EVENT) |
| 11392 | return; |
| 11393 | alc262_lenovo_3000_automute(codec, 1); |
| 11394 | } |
| 11395 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11396 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11397 | int dir, int idx, long *valp) |
| 11398 | { |
| 11399 | int i, change = 0; |
| 11400 | |
| 11401 | for (i = 0; i < 2; i++, valp++) |
| 11402 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11403 | HDA_AMP_MUTE, |
| 11404 | *valp ? 0 : HDA_AMP_MUTE); |
| 11405 | return change; |
| 11406 | } |
| 11407 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11408 | /* bind hp and internal speaker mute (with plug check) */ |
| 11409 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11410 | struct snd_ctl_elem_value *ucontrol) |
| 11411 | { |
| 11412 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11413 | long *valp = ucontrol->value.integer.value; |
| 11414 | int change; |
| 11415 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11416 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11417 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11418 | if (change) |
| 11419 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11420 | return change; |
| 11421 | } |
| 11422 | |
| 11423 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11424 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11425 | { |
| 11426 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11427 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11428 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11429 | .info = snd_hda_mixer_amp_switch_info, |
| 11430 | .get = snd_hda_mixer_amp_switch_get, |
| 11431 | .put = alc262_fujitsu_master_sw_put, |
| 11432 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11433 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11434 | { |
| 11435 | .iface = NID_MAPPING, |
| 11436 | .name = "Master Playback Switch", |
| 11437 | .private_value = 0x1b, |
| 11438 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11441 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11442 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11443 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11444 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11445 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11446 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11447 | { } /* end */ |
| 11448 | }; |
| 11449 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11450 | /* bind hp and internal speaker mute (with plug check) */ |
| 11451 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11452 | struct snd_ctl_elem_value *ucontrol) |
| 11453 | { |
| 11454 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11455 | long *valp = ucontrol->value.integer.value; |
| 11456 | int change; |
| 11457 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11458 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11459 | if (change) |
| 11460 | alc262_lenovo_3000_automute(codec, 0); |
| 11461 | return change; |
| 11462 | } |
| 11463 | |
| 11464 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11465 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11466 | { |
| 11467 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11468 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11469 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11470 | .info = snd_hda_mixer_amp_switch_info, |
| 11471 | .get = snd_hda_mixer_amp_switch_get, |
| 11472 | .put = alc262_lenovo_3000_master_sw_put, |
| 11473 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11474 | }, |
| 11475 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11476 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11477 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11480 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11481 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11482 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11483 | { } /* end */ |
| 11484 | }; |
| 11485 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11486 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11487 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11488 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11489 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11490 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11491 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11492 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11493 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11494 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11495 | { } /* end */ |
| 11496 | }; |
| 11497 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11498 | /* additional init verbs for Benq laptops */ |
| 11499 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11500 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11501 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11502 | {} |
| 11503 | }; |
| 11504 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11505 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11506 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11507 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11508 | |
| 11509 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11510 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11511 | {} |
| 11512 | }; |
| 11513 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11514 | /* Samsung Q1 Ultra Vista model setup */ |
| 11515 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11516 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11517 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11518 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11519 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11520 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11521 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11522 | { } /* end */ |
| 11523 | }; |
| 11524 | |
| 11525 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11526 | /* output mixer */ |
| 11527 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11528 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11530 | /* speaker */ |
| 11531 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11532 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11533 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11534 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11535 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11536 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11537 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11540 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11541 | /* internal mic */ |
| 11542 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11544 | /* ADC, choose mic */ |
| 11545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11546 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11547 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11549 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11555 | {} |
| 11556 | }; |
| 11557 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11558 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11559 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11560 | { |
| 11561 | struct alc_spec *spec = codec->spec; |
| 11562 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11563 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11564 | mute = 0; |
| 11565 | /* auto-mute only when HP is used as HP */ |
| 11566 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11567 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11568 | if (spec->jack_present) |
| 11569 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11570 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11571 | /* mute/unmute internal speaker */ |
| 11572 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11573 | HDA_AMP_MUTE, mute); |
| 11574 | /* mute/unmute HP */ |
| 11575 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11576 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11577 | } |
| 11578 | |
| 11579 | /* unsolicited event for HP jack sensing */ |
| 11580 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11581 | unsigned int res) |
| 11582 | { |
| 11583 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11584 | return; |
| 11585 | alc262_ultra_automute(codec); |
| 11586 | } |
| 11587 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11588 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11589 | .num_items = 2, |
| 11590 | .items = { |
| 11591 | { "Mic", 0x1 }, |
| 11592 | { "Headphone", 0x7 }, |
| 11593 | }, |
| 11594 | }; |
| 11595 | |
| 11596 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11597 | struct snd_ctl_elem_value *ucontrol) |
| 11598 | { |
| 11599 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11600 | struct alc_spec *spec = codec->spec; |
| 11601 | int ret; |
| 11602 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11603 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11604 | if (!ret) |
| 11605 | return 0; |
| 11606 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11607 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11608 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11609 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11610 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11611 | return ret; |
| 11612 | } |
| 11613 | |
| 11614 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11615 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11616 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11617 | { |
| 11618 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11619 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11620 | .info = alc_mux_enum_info, |
| 11621 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11622 | .put = alc262_ultra_mux_enum_put, |
| 11623 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11624 | { |
| 11625 | .iface = NID_MAPPING, |
| 11626 | .name = "Capture Source", |
| 11627 | .private_value = 0x15, |
| 11628 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11629 | { } /* end */ |
| 11630 | }; |
| 11631 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11632 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11633 | * and thus it's bound with a different mixer. |
| 11634 | * This function returns which mixer amp should be used. |
| 11635 | */ |
| 11636 | static int alc262_check_volbit(hda_nid_t nid) |
| 11637 | { |
| 11638 | if (!nid) |
| 11639 | return 0; |
| 11640 | else if (nid == 0x16) |
| 11641 | return 2; |
| 11642 | else |
| 11643 | return 1; |
| 11644 | } |
| 11645 | |
| 11646 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11647 | const char *pfx, int *vbits) |
| 11648 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11649 | unsigned long val; |
| 11650 | int vbit; |
| 11651 | |
| 11652 | vbit = alc262_check_volbit(nid); |
| 11653 | if (!vbit) |
| 11654 | return 0; |
| 11655 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11656 | return 0; |
| 11657 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11658 | if (vbit == 2) |
| 11659 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11660 | else |
| 11661 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11662 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11663 | } |
| 11664 | |
| 11665 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11666 | const char *pfx) |
| 11667 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11668 | unsigned long val; |
| 11669 | |
| 11670 | if (!nid) |
| 11671 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11672 | if (nid == 0x16) |
| 11673 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11674 | else |
| 11675 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11676 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11677 | } |
| 11678 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11679 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11680 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11681 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11682 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11683 | const char *pfx; |
| 11684 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11685 | int err; |
| 11686 | |
| 11687 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11688 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11689 | spec->multiout.dac_nids[0] = 2; |
| 11690 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11691 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11692 | pfx = "Master"; |
| 11693 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11694 | pfx = "Speaker"; |
| 11695 | else |
| 11696 | pfx = "Front"; |
| 11697 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11698 | if (err < 0) |
| 11699 | return err; |
| 11700 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11701 | if (err < 0) |
| 11702 | return err; |
| 11703 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11704 | if (err < 0) |
| 11705 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11706 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11707 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11708 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11709 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11710 | if (vbits == 1 || vbits == 2) |
| 11711 | pfx = "Master"; /* only one mixer is used */ |
| 11712 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11713 | pfx = "Speaker"; |
| 11714 | else |
| 11715 | pfx = "Front"; |
| 11716 | vbits = 0; |
| 11717 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11718 | if (err < 0) |
| 11719 | return err; |
| 11720 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11721 | &vbits); |
| 11722 | if (err < 0) |
| 11723 | return err; |
| 11724 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11725 | &vbits); |
| 11726 | if (err < 0) |
| 11727 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11728 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11729 | } |
| 11730 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11731 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11732 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11733 | |
| 11734 | /* |
| 11735 | * generic initialization of ADC, input mixers and output mixers |
| 11736 | */ |
| 11737 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11738 | /* |
| 11739 | * Unmute ADC0-2 and set the default input to mic-in |
| 11740 | */ |
| 11741 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11743 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11744 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11745 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11746 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11747 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11748 | /* 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] | 11749 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11750 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11751 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11752 | */ |
| 11753 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11754 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11755 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11759 | |
| 11760 | /* |
| 11761 | * Set up output mixers (0x0c - 0x0f) |
| 11762 | */ |
| 11763 | /* set vol=0 to output mixers */ |
| 11764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11766 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11768 | /* set up input amps for analog loopback */ |
| 11769 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11770 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11771 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11772 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11773 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11774 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11775 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11776 | |
| 11777 | /* FIXME: use matrix-type input source selection */ |
| 11778 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11779 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11780 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11781 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11782 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11783 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11784 | /* Input mixer2 */ |
| 11785 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11786 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11787 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11788 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11789 | /* Input mixer3 */ |
| 11790 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11791 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11794 | |
| 11795 | { } |
| 11796 | }; |
| 11797 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11798 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11799 | /* |
| 11800 | * Unmute ADC0-2 and set the default input to mic-in |
| 11801 | */ |
| 11802 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11803 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11804 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11805 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11806 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11807 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11808 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11809 | /* 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] | 11810 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11811 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11812 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11813 | */ |
| 11814 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11815 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11816 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11817 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11818 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11819 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11820 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11821 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11822 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11823 | /* |
| 11824 | * Set up output mixers (0x0c - 0x0e) |
| 11825 | */ |
| 11826 | /* set vol=0 to output mixers */ |
| 11827 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11828 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11829 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11830 | |
| 11831 | /* set up input amps for analog loopback */ |
| 11832 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11833 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11834 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11835 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11836 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11837 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11838 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11839 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11840 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11841 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11842 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11843 | |
| 11844 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11845 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11846 | |
| 11847 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11848 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11849 | |
| 11850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11851 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11852 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11853 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11854 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11855 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11856 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11857 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11859 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11860 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11861 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11862 | |
| 11863 | |
| 11864 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11865 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11866 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11867 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11868 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11869 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11870 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11871 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11872 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11873 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11874 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11875 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11876 | /* Input mixer2 */ |
| 11877 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11878 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11879 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11880 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11882 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11884 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11886 | /* Input mixer3 */ |
| 11887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11896 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11897 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11898 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11899 | { } |
| 11900 | }; |
| 11901 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11902 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11903 | /* |
| 11904 | * Unmute ADC0-2 and set the default input to mic-in |
| 11905 | */ |
| 11906 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11907 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11908 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11910 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11911 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11912 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11913 | /* 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] | 11914 | * mixer widget |
| 11915 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11916 | * panel mic (mic 2) |
| 11917 | */ |
| 11918 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11919 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11922 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11923 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11927 | /* |
| 11928 | * Set up output mixers (0x0c - 0x0e) |
| 11929 | */ |
| 11930 | /* set vol=0 to output mixers */ |
| 11931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11932 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11934 | |
| 11935 | /* set up input amps for analog loopback */ |
| 11936 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11938 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11939 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11940 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11941 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11942 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11943 | |
| 11944 | |
| 11945 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11946 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11947 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11948 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11949 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11951 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11952 | |
| 11953 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11955 | |
| 11956 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11957 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11958 | |
| 11959 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11960 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11961 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11962 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11963 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11964 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11965 | |
| 11966 | /* FIXME: use matrix-type input source selection */ |
| 11967 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11968 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11974 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11976 | /* Input mixer2 */ |
| 11977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11982 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11983 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11984 | /* Input mixer3 */ |
| 11985 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11986 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11990 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11992 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11993 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11994 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11995 | { } |
| 11996 | }; |
| 11997 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11998 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11999 | |
| 12000 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12001 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12002 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12003 | |
| 12004 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12005 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12006 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12007 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12008 | |
| 12009 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12011 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12012 | {} |
| 12013 | }; |
| 12014 | |
| 12015 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12016 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12017 | #define alc262_loopbacks alc880_loopbacks |
| 12018 | #endif |
| 12019 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12020 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12021 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12022 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12023 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12024 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12025 | |
| 12026 | /* |
| 12027 | * BIOS auto configuration |
| 12028 | */ |
| 12029 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12030 | { |
| 12031 | struct alc_spec *spec = codec->spec; |
| 12032 | int err; |
| 12033 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12034 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12035 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12036 | alc262_ignore); |
| 12037 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12038 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12039 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12040 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12041 | spec->multiout.max_channels = 2; |
| 12042 | spec->no_analog = 1; |
| 12043 | goto dig_only; |
| 12044 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12045 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12046 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12047 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12048 | if (err < 0) |
| 12049 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12050 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12051 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12052 | return err; |
| 12053 | |
| 12054 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12055 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12056 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12057 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12058 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12059 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12060 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12061 | if (spec->autocfg.dig_in_pin) |
| 12062 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 12063 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12064 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12065 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12066 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12067 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12068 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12069 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12070 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12071 | err = alc_auto_add_mic_boost(codec); |
| 12072 | if (err < 0) |
| 12073 | return err; |
| 12074 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12075 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12076 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12077 | return 1; |
| 12078 | } |
| 12079 | |
| 12080 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12081 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12082 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12083 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12084 | |
| 12085 | |
| 12086 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12087 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12088 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12089 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12090 | alc262_auto_init_multi_out(codec); |
| 12091 | alc262_auto_init_hp_out(codec); |
| 12092 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12093 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12094 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12095 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12096 | } |
| 12097 | |
| 12098 | /* |
| 12099 | * configuration and preset |
| 12100 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12101 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12102 | [ALC262_BASIC] = "basic", |
| 12103 | [ALC262_HIPPO] = "hippo", |
| 12104 | [ALC262_HIPPO_1] = "hippo_1", |
| 12105 | [ALC262_FUJITSU] = "fujitsu", |
| 12106 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12107 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12108 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12109 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12110 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12111 | [ALC262_BENQ_T31] = "benq-t31", |
| 12112 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12113 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12114 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12115 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12116 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12117 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12118 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12119 | [ALC262_AUTO] = "auto", |
| 12120 | }; |
| 12121 | |
| 12122 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12123 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12124 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12125 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12126 | ALC262_HP_BPC), |
| 12127 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12128 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12129 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12130 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12131 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12132 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12133 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12134 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12135 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12136 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12137 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12138 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12139 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12140 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12141 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12142 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12143 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12144 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12145 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12146 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12147 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12148 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12149 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12150 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12151 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12152 | #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] | 12153 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12154 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12155 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12156 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12157 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12158 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12159 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12160 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12161 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12162 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12163 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12164 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12165 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12166 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12167 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12168 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12169 | {} |
| 12170 | }; |
| 12171 | |
| 12172 | static struct alc_config_preset alc262_presets[] = { |
| 12173 | [ALC262_BASIC] = { |
| 12174 | .mixers = { alc262_base_mixer }, |
| 12175 | .init_verbs = { alc262_init_verbs }, |
| 12176 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12177 | .dac_nids = alc262_dac_nids, |
| 12178 | .hp_nid = 0x03, |
| 12179 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12180 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12181 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12182 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12183 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12184 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12185 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12186 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12187 | .dac_nids = alc262_dac_nids, |
| 12188 | .hp_nid = 0x03, |
| 12189 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12190 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12191 | .channel_mode = alc262_modes, |
| 12192 | .input_mux = &alc262_capture_source, |
| 12193 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12194 | .setup = alc262_hippo_setup, |
| 12195 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12196 | }, |
| 12197 | [ALC262_HIPPO_1] = { |
| 12198 | .mixers = { alc262_hippo1_mixer }, |
| 12199 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12200 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12201 | .dac_nids = alc262_dac_nids, |
| 12202 | .hp_nid = 0x02, |
| 12203 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12204 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12205 | .channel_mode = alc262_modes, |
| 12206 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12207 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12208 | .setup = alc262_hippo1_setup, |
| 12209 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12210 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12211 | [ALC262_FUJITSU] = { |
| 12212 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12213 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12214 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12215 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12216 | .dac_nids = alc262_dac_nids, |
| 12217 | .hp_nid = 0x03, |
| 12218 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12219 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12220 | .channel_mode = alc262_modes, |
| 12221 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12222 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12223 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12224 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12225 | [ALC262_HP_BPC] = { |
| 12226 | .mixers = { alc262_HP_BPC_mixer }, |
| 12227 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12228 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12229 | .dac_nids = alc262_dac_nids, |
| 12230 | .hp_nid = 0x03, |
| 12231 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12232 | .channel_mode = alc262_modes, |
| 12233 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12234 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12235 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12236 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12237 | [ALC262_HP_BPC_D7000_WF] = { |
| 12238 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12239 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12240 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12241 | .dac_nids = alc262_dac_nids, |
| 12242 | .hp_nid = 0x03, |
| 12243 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12244 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12245 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12246 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12247 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12248 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12249 | [ALC262_HP_BPC_D7000_WL] = { |
| 12250 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12251 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12252 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12253 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12254 | .dac_nids = alc262_dac_nids, |
| 12255 | .hp_nid = 0x03, |
| 12256 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12257 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12258 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12259 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12260 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12261 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12262 | [ALC262_HP_TC_T5735] = { |
| 12263 | .mixers = { alc262_hp_t5735_mixer }, |
| 12264 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12265 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12266 | .dac_nids = alc262_dac_nids, |
| 12267 | .hp_nid = 0x03, |
| 12268 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12269 | .channel_mode = alc262_modes, |
| 12270 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12271 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12272 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12273 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12274 | }, |
| 12275 | [ALC262_HP_RP5700] = { |
| 12276 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12277 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12278 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12279 | .dac_nids = alc262_dac_nids, |
| 12280 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12281 | .channel_mode = alc262_modes, |
| 12282 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12283 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12284 | [ALC262_BENQ_ED8] = { |
| 12285 | .mixers = { alc262_base_mixer }, |
| 12286 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12287 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12288 | .dac_nids = alc262_dac_nids, |
| 12289 | .hp_nid = 0x03, |
| 12290 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12291 | .channel_mode = alc262_modes, |
| 12292 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12293 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12294 | [ALC262_SONY_ASSAMD] = { |
| 12295 | .mixers = { alc262_sony_mixer }, |
| 12296 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12297 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12298 | .dac_nids = alc262_dac_nids, |
| 12299 | .hp_nid = 0x02, |
| 12300 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12301 | .channel_mode = alc262_modes, |
| 12302 | .input_mux = &alc262_capture_source, |
| 12303 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12304 | .setup = alc262_hippo_setup, |
| 12305 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12306 | }, |
| 12307 | [ALC262_BENQ_T31] = { |
| 12308 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12309 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12310 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12311 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12312 | .dac_nids = alc262_dac_nids, |
| 12313 | .hp_nid = 0x03, |
| 12314 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12315 | .channel_mode = alc262_modes, |
| 12316 | .input_mux = &alc262_capture_source, |
| 12317 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12318 | .setup = alc262_hippo_setup, |
| 12319 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12320 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12321 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12322 | .mixers = { alc262_ultra_mixer }, |
| 12323 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12324 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12325 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12326 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12327 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12328 | .channel_mode = alc262_modes, |
| 12329 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12330 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12331 | .capsrc_nids = alc262_capsrc_nids, |
| 12332 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12333 | .unsol_event = alc262_ultra_unsol_event, |
| 12334 | .init_hook = alc262_ultra_automute, |
| 12335 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12336 | [ALC262_LENOVO_3000] = { |
| 12337 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12338 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12339 | alc262_lenovo_3000_unsol_verbs, |
| 12340 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12341 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12342 | .dac_nids = alc262_dac_nids, |
| 12343 | .hp_nid = 0x03, |
| 12344 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12345 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12346 | .channel_mode = alc262_modes, |
| 12347 | .input_mux = &alc262_fujitsu_capture_source, |
| 12348 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12349 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12350 | [ALC262_NEC] = { |
| 12351 | .mixers = { alc262_nec_mixer }, |
| 12352 | .init_verbs = { alc262_nec_verbs }, |
| 12353 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12354 | .dac_nids = alc262_dac_nids, |
| 12355 | .hp_nid = 0x03, |
| 12356 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12357 | .channel_mode = alc262_modes, |
| 12358 | .input_mux = &alc262_capture_source, |
| 12359 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12360 | [ALC262_TOSHIBA_S06] = { |
| 12361 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12362 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12363 | alc262_eapd_verbs }, |
| 12364 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12365 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12366 | .dac_nids = alc262_dac_nids, |
| 12367 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12368 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12369 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12370 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12371 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12372 | .unsol_event = alc_sku_unsol_event, |
| 12373 | .setup = alc262_toshiba_s06_setup, |
| 12374 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12375 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12376 | [ALC262_TOSHIBA_RX1] = { |
| 12377 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12378 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12379 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12380 | .dac_nids = alc262_dac_nids, |
| 12381 | .hp_nid = 0x03, |
| 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, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12388 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12389 | [ALC262_TYAN] = { |
| 12390 | .mixers = { alc262_tyan_mixer }, |
| 12391 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12392 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12393 | .dac_nids = alc262_dac_nids, |
| 12394 | .hp_nid = 0x02, |
| 12395 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12396 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12397 | .channel_mode = alc262_modes, |
| 12398 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12399 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12400 | .setup = alc262_tyan_setup, |
| 12401 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12402 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12403 | }; |
| 12404 | |
| 12405 | static int patch_alc262(struct hda_codec *codec) |
| 12406 | { |
| 12407 | struct alc_spec *spec; |
| 12408 | int board_config; |
| 12409 | int err; |
| 12410 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12411 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12412 | if (spec == NULL) |
| 12413 | return -ENOMEM; |
| 12414 | |
| 12415 | codec->spec = spec; |
| 12416 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12417 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12418 | * under-run |
| 12419 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12420 | { |
| 12421 | int tmp; |
| 12422 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12423 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12424 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12425 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12426 | } |
| 12427 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12428 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12429 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12430 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12431 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12432 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12433 | alc262_models, |
| 12434 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12435 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12436 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12437 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12438 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12439 | board_config = ALC262_AUTO; |
| 12440 | } |
| 12441 | |
| 12442 | if (board_config == ALC262_AUTO) { |
| 12443 | /* automatic parse from the BIOS config */ |
| 12444 | err = alc262_parse_auto_config(codec); |
| 12445 | if (err < 0) { |
| 12446 | alc_free(codec); |
| 12447 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12448 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12449 | printk(KERN_INFO |
| 12450 | "hda_codec: Cannot set up configuration " |
| 12451 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12452 | board_config = ALC262_BASIC; |
| 12453 | } |
| 12454 | } |
| 12455 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 12456 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12457 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12458 | if (err < 0) { |
| 12459 | alc_free(codec); |
| 12460 | return err; |
| 12461 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12462 | } |
| 12463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12464 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12465 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12466 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12467 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12468 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12469 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12470 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12471 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12472 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12473 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12474 | int i; |
| 12475 | /* check whether the digital-mic has to be supported */ |
| 12476 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12477 | if (spec->input_mux->items[i].index >= 9) |
| 12478 | break; |
| 12479 | } |
| 12480 | if (i < spec->input_mux->num_items) { |
| 12481 | /* use only ADC0 */ |
| 12482 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12483 | spec->num_adc_nids = 1; |
| 12484 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12485 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12486 | /* all analog inputs */ |
| 12487 | /* check whether NID 0x07 is valid */ |
| 12488 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12489 | |
| 12490 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12491 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12492 | if (wcap != AC_WID_AUD_IN) { |
| 12493 | spec->adc_nids = alc262_adc_nids_alt; |
| 12494 | spec->num_adc_nids = |
| 12495 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12496 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12497 | } else { |
| 12498 | spec->adc_nids = alc262_adc_nids; |
| 12499 | spec->num_adc_nids = |
| 12500 | ARRAY_SIZE(alc262_adc_nids); |
| 12501 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12502 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12503 | } |
| 12504 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12505 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12506 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 12507 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12508 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12509 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12510 | spec->vmaster_nid = 0x0c; |
| 12511 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12512 | codec->patch_ops = alc_patch_ops; |
| 12513 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12514 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12515 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12516 | if (!spec->loopback.amplist) |
| 12517 | spec->loopback.amplist = alc262_loopbacks; |
| 12518 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12519 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12520 | return 0; |
| 12521 | } |
| 12522 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12523 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12524 | * ALC268 channel source setting (2 channel) |
| 12525 | */ |
| 12526 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12527 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12528 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12529 | static hda_nid_t alc268_dac_nids[2] = { |
| 12530 | /* front, hp */ |
| 12531 | 0x02, 0x03 |
| 12532 | }; |
| 12533 | |
| 12534 | static hda_nid_t alc268_adc_nids[2] = { |
| 12535 | /* ADC0-1 */ |
| 12536 | 0x08, 0x07 |
| 12537 | }; |
| 12538 | |
| 12539 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12540 | /* ADC0 */ |
| 12541 | 0x08 |
| 12542 | }; |
| 12543 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12544 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12545 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12546 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12547 | /* output mixer control */ |
| 12548 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12549 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12550 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12551 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12552 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12553 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12554 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12555 | { } |
| 12556 | }; |
| 12557 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12558 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12559 | /* output mixer control */ |
| 12560 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12561 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12562 | ALC262_HIPPO_MASTER_SWITCH, |
| 12563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12564 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12565 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12566 | { } |
| 12567 | }; |
| 12568 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12569 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12570 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12571 | .ops = &snd_hda_bind_sw, |
| 12572 | .values = { |
| 12573 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12574 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12575 | 0 |
| 12576 | }, |
| 12577 | }; |
| 12578 | |
| 12579 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12580 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12581 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12582 | { } |
| 12583 | }; |
| 12584 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12585 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12586 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12587 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12588 | { } |
| 12589 | }; |
| 12590 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12591 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12592 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12593 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12594 | { } /* end */ |
| 12595 | }; |
| 12596 | |
| 12597 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12598 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12599 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12600 | .ops = &snd_hda_bind_vol, |
| 12601 | .values = { |
| 12602 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12603 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12604 | 0 |
| 12605 | }, |
| 12606 | }; |
| 12607 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12608 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12609 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12610 | { |
| 12611 | struct alc_spec *spec = codec->spec; |
| 12612 | unsigned int mute; |
| 12613 | |
| 12614 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12615 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12616 | spec->sense_updated = 1; |
| 12617 | } |
| 12618 | if (spec->jack_present) |
| 12619 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12620 | else /* unmute internal speaker if necessary */ |
| 12621 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12622 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12623 | HDA_AMP_MUTE, mute); |
| 12624 | } |
| 12625 | |
| 12626 | |
| 12627 | /* bind hp and internal speaker mute (with plug check) */ |
| 12628 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12629 | struct snd_ctl_elem_value *ucontrol) |
| 12630 | { |
| 12631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12632 | long *valp = ucontrol->value.integer.value; |
| 12633 | int change; |
| 12634 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12635 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12636 | if (change) |
| 12637 | alc268_acer_automute(codec, 0); |
| 12638 | return change; |
| 12639 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12640 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12641 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12642 | /* output mixer control */ |
| 12643 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12644 | { |
| 12645 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12646 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12647 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12648 | .info = snd_hda_mixer_amp_switch_info, |
| 12649 | .get = snd_hda_mixer_amp_switch_get, |
| 12650 | .put = alc268_acer_master_sw_put, |
| 12651 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12652 | }, |
| 12653 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12654 | { } |
| 12655 | }; |
| 12656 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12657 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12658 | /* output mixer control */ |
| 12659 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12660 | { |
| 12661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12662 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12663 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12664 | .info = snd_hda_mixer_amp_switch_info, |
| 12665 | .get = snd_hda_mixer_amp_switch_get, |
| 12666 | .put = alc268_acer_master_sw_put, |
| 12667 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12668 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12670 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12671 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12672 | { } |
| 12673 | }; |
| 12674 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12675 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12676 | /* output mixer control */ |
| 12677 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12678 | { |
| 12679 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12680 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12681 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12682 | .info = snd_hda_mixer_amp_switch_info, |
| 12683 | .get = snd_hda_mixer_amp_switch_get, |
| 12684 | .put = alc268_acer_master_sw_put, |
| 12685 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12686 | }, |
| 12687 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12688 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12689 | { } |
| 12690 | }; |
| 12691 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12692 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12693 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12695 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12696 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12697 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12698 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12699 | { } |
| 12700 | }; |
| 12701 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12702 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12703 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12704 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12707 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12708 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12709 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12710 | { } |
| 12711 | }; |
| 12712 | |
| 12713 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12714 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12715 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12716 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12717 | |
| 12718 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12719 | unsigned int res) |
| 12720 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12721 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12722 | return; |
| 12723 | alc268_acer_automute(codec, 1); |
| 12724 | } |
| 12725 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12726 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12727 | { |
| 12728 | alc268_acer_automute(codec, 1); |
| 12729 | } |
| 12730 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12731 | /* toggle speaker-output according to the hp-jack state */ |
| 12732 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12733 | { |
| 12734 | unsigned int present; |
| 12735 | unsigned char bits; |
| 12736 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12737 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12738 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12739 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12740 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12741 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12742 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12743 | } |
| 12744 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12745 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12746 | unsigned int res) |
| 12747 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12748 | switch (res >> 26) { |
| 12749 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12750 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12751 | break; |
| 12752 | case ALC880_MIC_EVENT: |
| 12753 | alc_mic_automute(codec); |
| 12754 | break; |
| 12755 | } |
| 12756 | } |
| 12757 | |
| 12758 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12759 | { |
| 12760 | struct alc_spec *spec = codec->spec; |
| 12761 | spec->ext_mic.pin = 0x18; |
| 12762 | spec->ext_mic.mux_idx = 0; |
| 12763 | spec->int_mic.pin = 0x12; |
| 12764 | spec->int_mic.mux_idx = 6; |
| 12765 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12766 | } |
| 12767 | |
| 12768 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12769 | { |
| 12770 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12771 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12772 | } |
| 12773 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12774 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12775 | /* output mixer control */ |
| 12776 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12777 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12778 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12780 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12781 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12782 | { } |
| 12783 | }; |
| 12784 | |
| 12785 | static struct hda_verb alc268_dell_verbs[] = { |
| 12786 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12788 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12789 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12790 | { } |
| 12791 | }; |
| 12792 | |
| 12793 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12794 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12795 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12796 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12797 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12798 | spec->autocfg.hp_pins[0] = 0x15; |
| 12799 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12800 | spec->ext_mic.pin = 0x18; |
| 12801 | spec->ext_mic.mux_idx = 0; |
| 12802 | spec->int_mic.pin = 0x19; |
| 12803 | spec->int_mic.mux_idx = 1; |
| 12804 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12805 | } |
| 12806 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12807 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12808 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12809 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12810 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12811 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12812 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12813 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12814 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12815 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12816 | { } |
| 12817 | }; |
| 12818 | |
| 12819 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12820 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12821 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12822 | { } |
| 12823 | }; |
| 12824 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12825 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12826 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12827 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12828 | spec->autocfg.hp_pins[0] = 0x15; |
| 12829 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12830 | spec->ext_mic.pin = 0x18; |
| 12831 | spec->ext_mic.mux_idx = 0; |
| 12832 | spec->int_mic.pin = 0x19; |
| 12833 | spec->int_mic.mux_idx = 1; |
| 12834 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12835 | } |
| 12836 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12837 | /* |
| 12838 | * generic initialization of ADC, input mixers and output mixers |
| 12839 | */ |
| 12840 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12841 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12842 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12843 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12844 | |
| 12845 | /* |
| 12846 | * Set up output mixers (0x0c - 0x0e) |
| 12847 | */ |
| 12848 | /* set vol=0 to output mixers */ |
| 12849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12850 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12851 | |
| 12852 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12853 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12854 | |
| 12855 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12856 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12857 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12858 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12859 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12860 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12861 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12862 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12863 | |
| 12864 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12866 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12867 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12868 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12869 | |
| 12870 | /* set PCBEEP vol = 0, mute connections */ |
| 12871 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12872 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12873 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12874 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12875 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12876 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12877 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12878 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12879 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12880 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12881 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12882 | { } |
| 12883 | }; |
| 12884 | |
| 12885 | /* |
| 12886 | * generic initialization of ADC, input mixers and output mixers |
| 12887 | */ |
| 12888 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12889 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12890 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12891 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12892 | |
| 12893 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12894 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12896 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12897 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12898 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12899 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12901 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12902 | |
| 12903 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12905 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12906 | /* set PCBEEP vol = 0, mute connections */ |
| 12907 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12908 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12909 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12910 | |
| 12911 | { } |
| 12912 | }; |
| 12913 | |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12914 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12915 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12916 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12917 | { } /* end */ |
| 12918 | }; |
| 12919 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12920 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12921 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12922 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12923 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12924 | { } /* end */ |
| 12925 | }; |
| 12926 | |
| 12927 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12928 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12929 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12930 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12931 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12932 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12933 | { } /* end */ |
| 12934 | }; |
| 12935 | |
| 12936 | static struct hda_input_mux alc268_capture_source = { |
| 12937 | .num_items = 4, |
| 12938 | .items = { |
| 12939 | { "Mic", 0x0 }, |
| 12940 | { "Front Mic", 0x1 }, |
| 12941 | { "Line", 0x2 }, |
| 12942 | { "CD", 0x3 }, |
| 12943 | }, |
| 12944 | }; |
| 12945 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12946 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12947 | .num_items = 3, |
| 12948 | .items = { |
| 12949 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12950 | { "Internal Mic", 0x1 }, |
| 12951 | { "Line", 0x2 }, |
| 12952 | }, |
| 12953 | }; |
| 12954 | |
| 12955 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12956 | .num_items = 3, |
| 12957 | .items = { |
| 12958 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12959 | { "Internal Mic", 0x6 }, |
| 12960 | { "Line", 0x2 }, |
| 12961 | }, |
| 12962 | }; |
| 12963 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12964 | #ifdef CONFIG_SND_DEBUG |
| 12965 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12966 | /* Volume widgets */ |
| 12967 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12968 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12969 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12970 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12971 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12972 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12973 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12974 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12975 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12976 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12977 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12978 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12979 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12980 | /* The below appears problematic on some hardwares */ |
| 12981 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12982 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12983 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12984 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12985 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12986 | |
| 12987 | /* Modes for retasking pin widgets */ |
| 12988 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12989 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12990 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12991 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12992 | |
| 12993 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12994 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12995 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12996 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12997 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12998 | |
| 12999 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13000 | * The ALC268 does not have an SPDIF input. |
| 13001 | */ |
| 13002 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13003 | |
| 13004 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13005 | * this output to turn on an external amplifier. |
| 13006 | */ |
| 13007 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13008 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13009 | |
| 13010 | { } /* end */ |
| 13011 | }; |
| 13012 | #endif |
| 13013 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13014 | /* create input playback/capture controls for the given pin */ |
| 13015 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13016 | const char *ctlname, int idx) |
| 13017 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13018 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13019 | int err; |
| 13020 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13021 | switch (nid) { |
| 13022 | case 0x14: |
| 13023 | case 0x16: |
| 13024 | dac = 0x02; |
| 13025 | break; |
| 13026 | case 0x15: |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13027 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13028 | dac = 0x03; |
| 13029 | break; |
| 13030 | default: |
| 13031 | return 0; |
| 13032 | } |
| 13033 | if (spec->multiout.dac_nids[0] != dac && |
| 13034 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13035 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13036 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13037 | HDA_OUTPUT)); |
| 13038 | if (err < 0) |
| 13039 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13040 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13041 | } |
| 13042 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13043 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13044 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13045 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13046 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13047 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13048 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13049 | if (err < 0) |
| 13050 | return err; |
| 13051 | return 0; |
| 13052 | } |
| 13053 | |
| 13054 | /* add playback controls from the parsed DAC table */ |
| 13055 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13056 | const struct auto_pin_cfg *cfg) |
| 13057 | { |
| 13058 | hda_nid_t nid; |
| 13059 | int err; |
| 13060 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13061 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13062 | |
| 13063 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13064 | if (nid) { |
| 13065 | const char *name; |
| 13066 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13067 | name = "Speaker"; |
| 13068 | else |
| 13069 | name = "Front"; |
| 13070 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13071 | if (err < 0) |
| 13072 | return err; |
| 13073 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13074 | |
| 13075 | nid = cfg->speaker_pins[0]; |
| 13076 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13077 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13078 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13079 | if (err < 0) |
| 13080 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13081 | } else { |
| 13082 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13083 | if (err < 0) |
| 13084 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13085 | } |
| 13086 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13087 | if (nid) { |
| 13088 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13089 | if (err < 0) |
| 13090 | return err; |
| 13091 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13092 | |
| 13093 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13094 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13095 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13096 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13097 | if (err < 0) |
| 13098 | return err; |
| 13099 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13100 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13101 | } |
| 13102 | |
| 13103 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13104 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13105 | const struct auto_pin_cfg *cfg) |
| 13106 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13107 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13108 | } |
| 13109 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13110 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13111 | hda_nid_t nid, int pin_type) |
| 13112 | { |
| 13113 | int idx; |
| 13114 | |
| 13115 | alc_set_pin_output(codec, nid, pin_type); |
| 13116 | if (nid == 0x14 || nid == 0x16) |
| 13117 | idx = 0; |
| 13118 | else |
| 13119 | idx = 1; |
| 13120 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13121 | } |
| 13122 | |
| 13123 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13124 | { |
| 13125 | struct alc_spec *spec = codec->spec; |
| 13126 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13127 | if (nid) { |
| 13128 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13129 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13130 | } |
| 13131 | } |
| 13132 | |
| 13133 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13134 | { |
| 13135 | struct alc_spec *spec = codec->spec; |
| 13136 | hda_nid_t pin; |
| 13137 | |
| 13138 | pin = spec->autocfg.hp_pins[0]; |
| 13139 | if (pin) |
| 13140 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13141 | pin = spec->autocfg.speaker_pins[0]; |
| 13142 | if (pin) |
| 13143 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13144 | } |
| 13145 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13146 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13147 | { |
| 13148 | struct alc_spec *spec = codec->spec; |
| 13149 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13150 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13151 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13152 | unsigned int dac_vol1, dac_vol2; |
| 13153 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13154 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13155 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13156 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13157 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13158 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13159 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13160 | AMP_IN_UNMUTE(1)); |
| 13161 | snd_hda_codec_write(codec, 0x10, 0, |
| 13162 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13163 | AMP_IN_UNMUTE(1)); |
| 13164 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13165 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13166 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13167 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13168 | snd_hda_codec_write(codec, 0x10, 0, |
| 13169 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13170 | } |
| 13171 | |
| 13172 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13173 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13174 | dac_vol2 = AMP_OUT_ZERO; |
| 13175 | else if (line_nid == 0x15) |
| 13176 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13177 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13178 | dac_vol2 = AMP_OUT_ZERO; |
| 13179 | else if (hp_nid == 0x15) |
| 13180 | dac_vol1 = AMP_OUT_ZERO; |
| 13181 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13182 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13183 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13184 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13185 | |
| 13186 | snd_hda_codec_write(codec, 0x02, 0, |
| 13187 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13188 | snd_hda_codec_write(codec, 0x03, 0, |
| 13189 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13190 | } |
| 13191 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13192 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13193 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13194 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13195 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13196 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13197 | |
| 13198 | /* |
| 13199 | * BIOS auto configuration |
| 13200 | */ |
| 13201 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13202 | { |
| 13203 | struct alc_spec *spec = codec->spec; |
| 13204 | int err; |
| 13205 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13206 | |
| 13207 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13208 | alc268_ignore); |
| 13209 | if (err < 0) |
| 13210 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13211 | if (!spec->autocfg.line_outs) { |
| 13212 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13213 | spec->multiout.max_channels = 2; |
| 13214 | spec->no_analog = 1; |
| 13215 | goto dig_only; |
| 13216 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13217 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13218 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13219 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13220 | if (err < 0) |
| 13221 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13222 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13223 | if (err < 0) |
| 13224 | return err; |
| 13225 | |
| 13226 | spec->multiout.max_channels = 2; |
| 13227 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13228 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13229 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13230 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13231 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13232 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13233 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13234 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13235 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13236 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13237 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13238 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13239 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13240 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13241 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13242 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13243 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13244 | err = alc_auto_add_mic_boost(codec); |
| 13245 | if (err < 0) |
| 13246 | return err; |
| 13247 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13248 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13249 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13250 | return 1; |
| 13251 | } |
| 13252 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13253 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13254 | |
| 13255 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13256 | static void alc268_auto_init(struct hda_codec *codec) |
| 13257 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13258 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13259 | alc268_auto_init_multi_out(codec); |
| 13260 | alc268_auto_init_hp_out(codec); |
| 13261 | alc268_auto_init_mono_speaker_out(codec); |
| 13262 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13263 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13264 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13265 | } |
| 13266 | |
| 13267 | /* |
| 13268 | * configuration and preset |
| 13269 | */ |
| 13270 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13271 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13272 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13273 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13274 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13275 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13276 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13277 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13278 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13279 | #ifdef CONFIG_SND_DEBUG |
| 13280 | [ALC268_TEST] = "test", |
| 13281 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13282 | [ALC268_AUTO] = "auto", |
| 13283 | }; |
| 13284 | |
| 13285 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13286 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13287 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13288 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13289 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13290 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13291 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13292 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13293 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13294 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13295 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13296 | /* almost compatible with toshiba but with optional digital outs; |
| 13297 | * auto-probing seems working fine |
| 13298 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13299 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13300 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13301 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13302 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13303 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13304 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13305 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13306 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13307 | {} |
| 13308 | }; |
| 13309 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13310 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13311 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13312 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13313 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13314 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13315 | ALC268_TOSHIBA), |
| 13316 | {} |
| 13317 | }; |
| 13318 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13319 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13320 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13321 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13322 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13323 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13324 | alc267_quanta_il1_verbs }, |
| 13325 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13326 | .dac_nids = alc268_dac_nids, |
| 13327 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13328 | .adc_nids = alc268_adc_nids_alt, |
| 13329 | .hp_nid = 0x03, |
| 13330 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13331 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13332 | .unsol_event = alc_sku_unsol_event, |
| 13333 | .setup = alc267_quanta_il1_setup, |
| 13334 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13335 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13336 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13337 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13338 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13339 | .init_verbs = { alc268_base_init_verbs }, |
| 13340 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13341 | .dac_nids = alc268_dac_nids, |
| 13342 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13343 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13344 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13345 | .hp_nid = 0x03, |
| 13346 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13347 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13348 | .channel_mode = alc268_modes, |
| 13349 | .input_mux = &alc268_capture_source, |
| 13350 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13351 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13352 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13353 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13354 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13355 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13356 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13357 | .dac_nids = alc268_dac_nids, |
| 13358 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13359 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13360 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13361 | .hp_nid = 0x03, |
| 13362 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13363 | .channel_mode = alc268_modes, |
| 13364 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13365 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13366 | .setup = alc268_toshiba_setup, |
| 13367 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13368 | }, |
| 13369 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13370 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13371 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13372 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13373 | alc268_acer_verbs }, |
| 13374 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13375 | .dac_nids = alc268_dac_nids, |
| 13376 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13377 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13378 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13379 | .hp_nid = 0x02, |
| 13380 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13381 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13382 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13383 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13384 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13385 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13386 | [ALC268_ACER_DMIC] = { |
| 13387 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13388 | alc268_beep_mixer }, |
| 13389 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13390 | alc268_acer_verbs }, |
| 13391 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13392 | .dac_nids = alc268_dac_nids, |
| 13393 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13394 | .adc_nids = alc268_adc_nids_alt, |
| 13395 | .capsrc_nids = alc268_capsrc_nids, |
| 13396 | .hp_nid = 0x02, |
| 13397 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13398 | .channel_mode = alc268_modes, |
| 13399 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13400 | .unsol_event = alc268_acer_unsol_event, |
| 13401 | .init_hook = alc268_acer_init_hook, |
| 13402 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13403 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13404 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13405 | alc268_beep_mixer, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13406 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13407 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13408 | alc268_acer_aspire_one_verbs }, |
| 13409 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13410 | .dac_nids = alc268_dac_nids, |
| 13411 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13412 | .adc_nids = alc268_adc_nids_alt, |
| 13413 | .capsrc_nids = alc268_capsrc_nids, |
| 13414 | .hp_nid = 0x03, |
| 13415 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13416 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13417 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13418 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13419 | .init_hook = alc268_acer_lc_init_hook, |
| 13420 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13421 | [ALC268_DELL] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13422 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13423 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13424 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13425 | alc268_dell_verbs }, |
| 13426 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13427 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13428 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13429 | .adc_nids = alc268_adc_nids_alt, |
| 13430 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13431 | .hp_nid = 0x02, |
| 13432 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13433 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13434 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13435 | .setup = alc268_dell_setup, |
| 13436 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13437 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13438 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13439 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13440 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13441 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13442 | alc268_toshiba_verbs }, |
| 13443 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13444 | .dac_nids = alc268_dac_nids, |
| 13445 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13446 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13447 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13448 | .hp_nid = 0x03, |
| 13449 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13450 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13451 | .channel_mode = alc268_modes, |
| 13452 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13453 | .setup = alc268_toshiba_setup, |
| 13454 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13455 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13456 | #ifdef CONFIG_SND_DEBUG |
| 13457 | [ALC268_TEST] = { |
| 13458 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13459 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13460 | alc268_volume_init_verbs }, |
| 13461 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13462 | .dac_nids = alc268_dac_nids, |
| 13463 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13464 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13465 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13466 | .hp_nid = 0x03, |
| 13467 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13468 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13469 | .channel_mode = alc268_modes, |
| 13470 | .input_mux = &alc268_capture_source, |
| 13471 | }, |
| 13472 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13473 | }; |
| 13474 | |
| 13475 | static int patch_alc268(struct hda_codec *codec) |
| 13476 | { |
| 13477 | struct alc_spec *spec; |
| 13478 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13479 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13480 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13481 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13482 | if (spec == NULL) |
| 13483 | return -ENOMEM; |
| 13484 | |
| 13485 | codec->spec = spec; |
| 13486 | |
| 13487 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13488 | alc268_models, |
| 13489 | alc268_cfg_tbl); |
| 13490 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13491 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13492 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13493 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13494 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13495 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13496 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13497 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13498 | board_config = ALC268_AUTO; |
| 13499 | } |
| 13500 | |
| 13501 | if (board_config == ALC268_AUTO) { |
| 13502 | /* automatic parse from the BIOS config */ |
| 13503 | err = alc268_parse_auto_config(codec); |
| 13504 | if (err < 0) { |
| 13505 | alc_free(codec); |
| 13506 | return err; |
| 13507 | } else if (!err) { |
| 13508 | printk(KERN_INFO |
| 13509 | "hda_codec: Cannot set up configuration " |
| 13510 | "from BIOS. Using base mode...\n"); |
| 13511 | board_config = ALC268_3ST; |
| 13512 | } |
| 13513 | } |
| 13514 | |
| 13515 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13516 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13517 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13518 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13519 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13520 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13521 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13522 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13523 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13524 | has_beep = 0; |
| 13525 | for (i = 0; i < spec->num_mixers; i++) { |
| 13526 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13527 | has_beep = 1; |
| 13528 | break; |
| 13529 | } |
| 13530 | } |
| 13531 | |
| 13532 | if (has_beep) { |
| 13533 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13534 | if (err < 0) { |
| 13535 | alc_free(codec); |
| 13536 | return err; |
| 13537 | } |
| 13538 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13539 | /* override the amp caps for beep generator */ |
| 13540 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13541 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13542 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13543 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13544 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13545 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13546 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13547 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13548 | /* check whether NID 0x07 is valid */ |
| 13549 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13550 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13551 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13552 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13553 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13554 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13555 | if (spec->auto_mic || |
| 13556 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13557 | spec->adc_nids = alc268_adc_nids_alt; |
| 13558 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13559 | if (spec->auto_mic) |
| 13560 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13561 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13562 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13563 | else |
| 13564 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13565 | } else { |
| 13566 | spec->adc_nids = alc268_adc_nids; |
| 13567 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13568 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13569 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13570 | /* set default input source */ |
| 13571 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13572 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13573 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13574 | i < spec->num_mux_defs ? |
| 13575 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13576 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13577 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13578 | |
| 13579 | spec->vmaster_nid = 0x02; |
| 13580 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13581 | codec->patch_ops = alc_patch_ops; |
| 13582 | if (board_config == ALC268_AUTO) |
| 13583 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13584 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13585 | return 0; |
| 13586 | } |
| 13587 | |
| 13588 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13589 | * ALC269 channel source setting (2 channel) |
| 13590 | */ |
| 13591 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13592 | |
| 13593 | #define alc269_dac_nids alc260_dac_nids |
| 13594 | |
| 13595 | static hda_nid_t alc269_adc_nids[1] = { |
| 13596 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13597 | 0x08, |
| 13598 | }; |
| 13599 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13600 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13601 | 0x23, |
| 13602 | }; |
| 13603 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13604 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13605 | /* ADC1 */ |
| 13606 | 0x09, |
| 13607 | }; |
| 13608 | |
| 13609 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13610 | 0x22, |
| 13611 | }; |
| 13612 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13613 | static hda_nid_t alc269_adc_candidates[] = { |
| 13614 | 0x08, 0x09, 0x07, |
| 13615 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13616 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13617 | #define alc269_modes alc260_modes |
| 13618 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13619 | |
| 13620 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13621 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13622 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13623 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13624 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13626 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13627 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13630 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13631 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13632 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13633 | { } /* end */ |
| 13634 | }; |
| 13635 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13636 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13637 | /* output mixer control */ |
| 13638 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13639 | { |
| 13640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13641 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13642 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13643 | .info = snd_hda_mixer_amp_switch_info, |
| 13644 | .get = snd_hda_mixer_amp_switch_get, |
| 13645 | .put = alc268_acer_master_sw_put, |
| 13646 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13647 | }, |
| 13648 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13649 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13650 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13651 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13652 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13653 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13654 | { } |
| 13655 | }; |
| 13656 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13657 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13658 | /* output mixer control */ |
| 13659 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13660 | { |
| 13661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13662 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13663 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13664 | .info = snd_hda_mixer_amp_switch_info, |
| 13665 | .get = snd_hda_mixer_amp_switch_get, |
| 13666 | .put = alc268_acer_master_sw_put, |
| 13667 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13668 | }, |
| 13669 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13670 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13671 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13672 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13673 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13674 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13675 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13676 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13677 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13678 | { } |
| 13679 | }; |
| 13680 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13681 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13682 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13683 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13684 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13685 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13686 | { } /* end */ |
| 13687 | }; |
| 13688 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13689 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13691 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13693 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13694 | { } /* end */ |
| 13695 | }; |
| 13696 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13697 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13698 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13699 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13700 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13701 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13702 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13703 | { } /* end */ |
| 13704 | }; |
| 13705 | |
| 13706 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13707 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13708 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13709 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13710 | { } /* end */ |
| 13711 | }; |
| 13712 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13713 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13714 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13715 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13716 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13717 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13718 | { } /* end */ |
| 13719 | }; |
| 13720 | |
| 13721 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13722 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13723 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13725 | { } /* end */ |
| 13726 | }; |
| 13727 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13728 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13729 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13730 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13731 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13732 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13733 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13734 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13735 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13736 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13737 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13738 | { } |
| 13739 | }; |
| 13740 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13741 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13743 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13744 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13745 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13746 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13747 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13748 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13749 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13750 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13751 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13752 | { } |
| 13753 | }; |
| 13754 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13755 | /* toggle speaker-output according to the hp-jack state */ |
| 13756 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13757 | { |
| 13758 | unsigned int present; |
| 13759 | unsigned char bits; |
| 13760 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13761 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13762 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13763 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13764 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13765 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13766 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13767 | |
| 13768 | snd_hda_codec_write(codec, 0x20, 0, |
| 13769 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13770 | snd_hda_codec_write(codec, 0x20, 0, |
| 13771 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13772 | |
| 13773 | snd_hda_codec_write(codec, 0x20, 0, |
| 13774 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13775 | snd_hda_codec_write(codec, 0x20, 0, |
| 13776 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13777 | } |
| 13778 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13779 | /* toggle speaker-output according to the hp-jacks state */ |
| 13780 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13781 | { |
| 13782 | unsigned int present; |
| 13783 | unsigned char bits; |
| 13784 | |
| 13785 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13786 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13787 | |
| 13788 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13789 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13790 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13791 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13792 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13793 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13794 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13795 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13796 | |
| 13797 | snd_hda_codec_write(codec, 0x20, 0, |
| 13798 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13799 | snd_hda_codec_write(codec, 0x20, 0, |
| 13800 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13801 | |
| 13802 | snd_hda_codec_write(codec, 0x20, 0, |
| 13803 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13804 | snd_hda_codec_write(codec, 0x20, 0, |
| 13805 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13806 | } |
| 13807 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13808 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13809 | { |
| 13810 | unsigned int present_laptop; |
| 13811 | unsigned int present_dock; |
| 13812 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13813 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13814 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13815 | |
| 13816 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13817 | if (present_dock) |
| 13818 | snd_hda_codec_write(codec, 0x23, 0, |
| 13819 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13820 | if (present_laptop) |
| 13821 | snd_hda_codec_write(codec, 0x23, 0, |
| 13822 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13823 | if (!present_dock && !present_laptop) |
| 13824 | snd_hda_codec_write(codec, 0x23, 0, |
| 13825 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13826 | } |
| 13827 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13828 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13829 | unsigned int res) |
| 13830 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13831 | switch (res >> 26) { |
| 13832 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13833 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13834 | break; |
| 13835 | case ALC880_MIC_EVENT: |
| 13836 | alc_mic_automute(codec); |
| 13837 | break; |
| 13838 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13839 | } |
| 13840 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13841 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13842 | unsigned int res) |
| 13843 | { |
| 13844 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13845 | alc269_lifebook_speaker_automute(codec); |
| 13846 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13847 | alc269_lifebook_mic_autoswitch(codec); |
| 13848 | } |
| 13849 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13850 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13851 | { |
| 13852 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13853 | spec->autocfg.hp_pins[0] = 0x15; |
| 13854 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13855 | spec->ext_mic.pin = 0x18; |
| 13856 | spec->ext_mic.mux_idx = 0; |
| 13857 | spec->int_mic.pin = 0x19; |
| 13858 | spec->int_mic.mux_idx = 1; |
| 13859 | spec->auto_mic = 1; |
| 13860 | } |
| 13861 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13862 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13863 | { |
| 13864 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13865 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13866 | } |
| 13867 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13868 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13869 | { |
| 13870 | alc269_lifebook_speaker_automute(codec); |
| 13871 | alc269_lifebook_mic_autoswitch(codec); |
| 13872 | } |
| 13873 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13874 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13875 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13876 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13877 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13878 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13879 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13880 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13881 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13882 | {} |
| 13883 | }; |
| 13884 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13885 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13886 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13887 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13888 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13890 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13891 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13892 | {} |
| 13893 | }; |
| 13894 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13895 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13896 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13897 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13898 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13899 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13900 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13901 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13902 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13903 | {} |
| 13904 | }; |
| 13905 | |
| 13906 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13907 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13908 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13909 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13910 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13911 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13912 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13913 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13914 | {} |
| 13915 | }; |
| 13916 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13917 | /* toggle speaker-output according to the hp-jack state */ |
| 13918 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13919 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13920 | struct alc_spec *spec = codec->spec; |
| 13921 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13922 | unsigned int present; |
| 13923 | unsigned char bits; |
| 13924 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13925 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13926 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13927 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13928 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13929 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13930 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13931 | } |
| 13932 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13933 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13934 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13935 | unsigned int res) |
| 13936 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13937 | switch (res >> 26) { |
| 13938 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13939 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13940 | break; |
| 13941 | case ALC880_MIC_EVENT: |
| 13942 | alc_mic_automute(codec); |
| 13943 | break; |
| 13944 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13945 | } |
| 13946 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13947 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 13948 | { |
| 13949 | struct alc_spec *spec = codec->spec; |
| 13950 | spec->autocfg.hp_pins[0] = 0x15; |
| 13951 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13952 | spec->ext_mic.pin = 0x18; |
| 13953 | spec->ext_mic.mux_idx = 0; |
| 13954 | spec->int_mic.pin = 0x19; |
| 13955 | spec->int_mic.mux_idx = 1; |
| 13956 | spec->auto_mic = 1; |
| 13957 | } |
| 13958 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13959 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13960 | { |
| 13961 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13962 | spec->autocfg.hp_pins[0] = 0x15; |
| 13963 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13964 | spec->ext_mic.pin = 0x18; |
| 13965 | spec->ext_mic.mux_idx = 0; |
| 13966 | spec->int_mic.pin = 0x12; |
| 13967 | spec->int_mic.mux_idx = 5; |
| 13968 | spec->auto_mic = 1; |
| 13969 | } |
| 13970 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13971 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13972 | { |
| 13973 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13974 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13975 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13976 | spec->ext_mic.pin = 0x18; |
| 13977 | spec->ext_mic.mux_idx = 0; |
| 13978 | spec->int_mic.pin = 0x19; |
| 13979 | spec->int_mic.mux_idx = 1; |
| 13980 | spec->auto_mic = 1; |
| 13981 | } |
| 13982 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 13983 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 13984 | { |
| 13985 | struct alc_spec *spec = codec->spec; |
| 13986 | spec->autocfg.hp_pins[0] = 0x21; |
| 13987 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13988 | spec->ext_mic.pin = 0x18; |
| 13989 | spec->ext_mic.mux_idx = 0; |
| 13990 | spec->int_mic.pin = 0x12; |
| 13991 | spec->int_mic.mux_idx = 6; |
| 13992 | spec->auto_mic = 1; |
| 13993 | } |
| 13994 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13995 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13996 | { |
| 13997 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13998 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13999 | } |
| 14000 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14001 | /* |
| 14002 | * generic initialization of ADC, input mixers and output mixers |
| 14003 | */ |
| 14004 | static struct hda_verb alc269_init_verbs[] = { |
| 14005 | /* |
| 14006 | * Unmute ADC0 and set the default input to mic-in |
| 14007 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14008 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14009 | |
| 14010 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14011 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14012 | */ |
| 14013 | /* set vol=0 to output mixers */ |
| 14014 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14015 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14016 | |
| 14017 | /* set up input amps for analog loopback */ |
| 14018 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14023 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14025 | |
| 14026 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14027 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14028 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14029 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14030 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14031 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14033 | |
| 14034 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14036 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14037 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14038 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14039 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14040 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14041 | |
| 14042 | /* set EAPD */ |
| 14043 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14044 | { } |
| 14045 | }; |
| 14046 | |
| 14047 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14048 | /* |
| 14049 | * Unmute ADC0 and set the default input to mic-in |
| 14050 | */ |
| 14051 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14052 | |
| 14053 | /* |
| 14054 | * Set up output mixers (0x02 - 0x03) |
| 14055 | */ |
| 14056 | /* set vol=0 to output mixers */ |
| 14057 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14058 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14059 | |
| 14060 | /* set up input amps for analog loopback */ |
| 14061 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14062 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14063 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14064 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14065 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14066 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14067 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14068 | |
| 14069 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14070 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14071 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14072 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14073 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14074 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14076 | |
| 14077 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14078 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14079 | |
| 14080 | /* FIXME: use Mux-type input source selection */ |
| 14081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14082 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14083 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14084 | |
| 14085 | /* set EAPD */ |
| 14086 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14087 | { } |
| 14088 | }; |
| 14089 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14090 | #define alc269_auto_create_multi_out_ctls \ |
| 14091 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14092 | #define alc269_auto_create_input_ctls \ |
| 14093 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14094 | |
| 14095 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14096 | #define alc269_loopbacks alc880_loopbacks |
| 14097 | #endif |
| 14098 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14099 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14100 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14101 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14102 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14103 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14104 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14105 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14106 | .substreams = 1, |
| 14107 | .channels_min = 2, |
| 14108 | .channels_max = 8, |
| 14109 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14110 | /* NID is set in alc_build_pcms */ |
| 14111 | .ops = { |
| 14112 | .open = alc880_playback_pcm_open, |
| 14113 | .prepare = alc880_playback_pcm_prepare, |
| 14114 | .cleanup = alc880_playback_pcm_cleanup |
| 14115 | }, |
| 14116 | }; |
| 14117 | |
| 14118 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14119 | .substreams = 1, |
| 14120 | .channels_min = 2, |
| 14121 | .channels_max = 2, |
| 14122 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14123 | /* NID is set in alc_build_pcms */ |
| 14124 | }; |
| 14125 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14126 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14127 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14128 | { |
| 14129 | switch (codec->subsystem_id) { |
| 14130 | case 0x103c1586: |
| 14131 | return 1; |
| 14132 | } |
| 14133 | return 0; |
| 14134 | } |
| 14135 | |
| 14136 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14137 | { |
| 14138 | /* update mute-LED according to the speaker mute state */ |
| 14139 | if (nid == 0x01 || nid == 0x14) { |
| 14140 | int pinval; |
| 14141 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14142 | HDA_AMP_MUTE) |
| 14143 | pinval = 0x24; |
| 14144 | else |
| 14145 | pinval = 0x20; |
| 14146 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14147 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14148 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14149 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14150 | } |
| 14151 | return alc_check_power_status(codec, nid); |
| 14152 | } |
| 14153 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14154 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14155 | /* |
| 14156 | * BIOS auto configuration |
| 14157 | */ |
| 14158 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14159 | { |
| 14160 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14161 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14162 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14163 | |
| 14164 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14165 | alc269_ignore); |
| 14166 | if (err < 0) |
| 14167 | return err; |
| 14168 | |
| 14169 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14170 | if (err < 0) |
| 14171 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14172 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14173 | if (err < 0) |
| 14174 | return err; |
| 14175 | |
| 14176 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14177 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14178 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14179 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14180 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14181 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14182 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14183 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14184 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14185 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14186 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14187 | } else { |
| 14188 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14189 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14190 | } |
| 14191 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14192 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14193 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14194 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14195 | sizeof(alc269_adc_candidates)); |
| 14196 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14197 | /* set default input source */ |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14198 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14199 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14200 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14201 | |
| 14202 | err = alc_auto_add_mic_boost(codec); |
| 14203 | if (err < 0) |
| 14204 | return err; |
| 14205 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14206 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14207 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14208 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14209 | return 1; |
| 14210 | } |
| 14211 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14212 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14213 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14214 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14215 | |
| 14216 | |
| 14217 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14218 | static void alc269_auto_init(struct hda_codec *codec) |
| 14219 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14220 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14221 | alc269_auto_init_multi_out(codec); |
| 14222 | alc269_auto_init_hp_out(codec); |
| 14223 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14224 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14225 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14226 | } |
| 14227 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14228 | enum { |
| 14229 | ALC269_FIXUP_SONY_VAIO, |
| 14230 | }; |
| 14231 | |
Tobias Klauser | fbc2566 | 2010-05-20 10:40:55 +0200 | [diff] [blame] | 14232 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14233 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14234 | {} |
| 14235 | }; |
| 14236 | |
| 14237 | static const struct alc_fixup alc269_fixups[] = { |
| 14238 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14239 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14240 | }, |
| 14241 | }; |
| 14242 | |
| 14243 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14244 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14245 | {} |
| 14246 | }; |
| 14247 | |
| 14248 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14249 | /* |
| 14250 | * configuration and preset |
| 14251 | */ |
| 14252 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14253 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14254 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14255 | [ALC269_AMIC] = "laptop-amic", |
| 14256 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14257 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14258 | [ALC269_LIFEBOOK] = "lifebook", |
| 14259 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14260 | }; |
| 14261 | |
| 14262 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14263 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14264 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14265 | ALC269_AMIC), |
| 14266 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14267 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14268 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14269 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14270 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14271 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14272 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14273 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14274 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14275 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14276 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14277 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14278 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14279 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14280 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14281 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14282 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14283 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14284 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14285 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14286 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14287 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14288 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14289 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14290 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14291 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14292 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14293 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14294 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14295 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14296 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14297 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14298 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14299 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14300 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14301 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14302 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14303 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14304 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14305 | ALC269_DMIC), |
| 14306 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14307 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14308 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14309 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14310 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14311 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14312 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14313 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14314 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14315 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14316 | {} |
| 14317 | }; |
| 14318 | |
| 14319 | static struct alc_config_preset alc269_presets[] = { |
| 14320 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14321 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14322 | .init_verbs = { alc269_init_verbs }, |
| 14323 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14324 | .dac_nids = alc269_dac_nids, |
| 14325 | .hp_nid = 0x03, |
| 14326 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14327 | .channel_mode = alc269_modes, |
| 14328 | .input_mux = &alc269_capture_source, |
| 14329 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14330 | [ALC269_QUANTA_FL1] = { |
| 14331 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14332 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14333 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14334 | .dac_nids = alc269_dac_nids, |
| 14335 | .hp_nid = 0x03, |
| 14336 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14337 | .channel_mode = alc269_modes, |
| 14338 | .input_mux = &alc269_capture_source, |
| 14339 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14340 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14341 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14342 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14343 | [ALC269_AMIC] = { |
| 14344 | .mixers = { alc269_laptop_mixer }, |
| 14345 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14346 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14347 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14348 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14349 | .dac_nids = alc269_dac_nids, |
| 14350 | .hp_nid = 0x03, |
| 14351 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14352 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14353 | .unsol_event = alc269_laptop_unsol_event, |
| 14354 | .setup = alc269_laptop_amic_setup, |
| 14355 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14356 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14357 | [ALC269_DMIC] = { |
| 14358 | .mixers = { alc269_laptop_mixer }, |
| 14359 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14360 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14361 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14362 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14363 | .dac_nids = alc269_dac_nids, |
| 14364 | .hp_nid = 0x03, |
| 14365 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14366 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14367 | .unsol_event = alc269_laptop_unsol_event, |
| 14368 | .setup = alc269_laptop_dmic_setup, |
| 14369 | .init_hook = alc269_laptop_inithook, |
| 14370 | }, |
| 14371 | [ALC269VB_AMIC] = { |
| 14372 | .mixers = { alc269vb_laptop_mixer }, |
| 14373 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14374 | .init_verbs = { alc269vb_init_verbs, |
| 14375 | alc269vb_laptop_amic_init_verbs }, |
| 14376 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14377 | .dac_nids = alc269_dac_nids, |
| 14378 | .hp_nid = 0x03, |
| 14379 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14380 | .channel_mode = alc269_modes, |
| 14381 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14382 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14383 | .init_hook = alc269_laptop_inithook, |
| 14384 | }, |
| 14385 | [ALC269VB_DMIC] = { |
| 14386 | .mixers = { alc269vb_laptop_mixer }, |
| 14387 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14388 | .init_verbs = { alc269vb_init_verbs, |
| 14389 | alc269vb_laptop_dmic_init_verbs }, |
| 14390 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14391 | .dac_nids = alc269_dac_nids, |
| 14392 | .hp_nid = 0x03, |
| 14393 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14394 | .channel_mode = alc269_modes, |
| 14395 | .unsol_event = alc269_laptop_unsol_event, |
| 14396 | .setup = alc269vb_laptop_dmic_setup, |
| 14397 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14398 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14399 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14400 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14401 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14402 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14403 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14404 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14405 | .dac_nids = alc269_dac_nids, |
| 14406 | .hp_nid = 0x03, |
| 14407 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14408 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14409 | .unsol_event = alc269_laptop_unsol_event, |
| 14410 | .setup = alc269_laptop_dmic_setup, |
| 14411 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14412 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14413 | [ALC269_LIFEBOOK] = { |
| 14414 | .mixers = { alc269_lifebook_mixer }, |
| 14415 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14416 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14417 | .dac_nids = alc269_dac_nids, |
| 14418 | .hp_nid = 0x03, |
| 14419 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14420 | .channel_mode = alc269_modes, |
| 14421 | .input_mux = &alc269_capture_source, |
| 14422 | .unsol_event = alc269_lifebook_unsol_event, |
| 14423 | .init_hook = alc269_lifebook_init_hook, |
| 14424 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14425 | }; |
| 14426 | |
| 14427 | static int patch_alc269(struct hda_codec *codec) |
| 14428 | { |
| 14429 | struct alc_spec *spec; |
| 14430 | int board_config; |
| 14431 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14432 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14433 | |
| 14434 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14435 | if (spec == NULL) |
| 14436 | return -ENOMEM; |
| 14437 | |
| 14438 | codec->spec = spec; |
| 14439 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14440 | alc_auto_parse_customize_define(codec); |
| 14441 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14442 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14443 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14444 | spec->cdefine.platform_type == 1) |
| 14445 | alc_codec_rename(codec, "ALC271X"); |
| 14446 | else |
| 14447 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14448 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14449 | } else |
| 14450 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14451 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14452 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14453 | alc269_models, |
| 14454 | alc269_cfg_tbl); |
| 14455 | |
| 14456 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14457 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14458 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14459 | board_config = ALC269_AUTO; |
| 14460 | } |
| 14461 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14462 | if (board_config == ALC269_AUTO) |
| 14463 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14464 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14465 | if (board_config == ALC269_AUTO) { |
| 14466 | /* automatic parse from the BIOS config */ |
| 14467 | err = alc269_parse_auto_config(codec); |
| 14468 | if (err < 0) { |
| 14469 | alc_free(codec); |
| 14470 | return err; |
| 14471 | } else if (!err) { |
| 14472 | printk(KERN_INFO |
| 14473 | "hda_codec: Cannot set up configuration " |
| 14474 | "from BIOS. Using base mode...\n"); |
| 14475 | board_config = ALC269_BASIC; |
| 14476 | } |
| 14477 | } |
| 14478 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 14479 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14480 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14481 | if (err < 0) { |
| 14482 | alc_free(codec); |
| 14483 | return err; |
| 14484 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14485 | } |
| 14486 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14487 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14488 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14489 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14490 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14491 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14492 | * fix the sample rate of analog I/O to 44.1kHz |
| 14493 | */ |
| 14494 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14495 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 14496 | } else { |
| 14497 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14498 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14499 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14500 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14501 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14502 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14503 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14504 | if (!is_alc269vb) { |
| 14505 | spec->adc_nids = alc269_adc_nids; |
| 14506 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14507 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14508 | } else { |
| 14509 | spec->adc_nids = alc269vb_adc_nids; |
| 14510 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14511 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14512 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14513 | } |
| 14514 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14515 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14516 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 14517 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14518 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14519 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14520 | if (board_config == ALC269_AUTO) |
| 14521 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14522 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14523 | spec->vmaster_nid = 0x02; |
| 14524 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14525 | codec->patch_ops = alc_patch_ops; |
| 14526 | if (board_config == ALC269_AUTO) |
| 14527 | spec->init_hook = alc269_auto_init; |
| 14528 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14529 | if (!spec->loopback.amplist) |
| 14530 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14531 | if (alc269_mic2_for_mute_led(codec)) |
| 14532 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14533 | #endif |
| 14534 | |
| 14535 | return 0; |
| 14536 | } |
| 14537 | |
| 14538 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14539 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14540 | */ |
| 14541 | |
| 14542 | /* |
| 14543 | * set the path ways for 2 channel output |
| 14544 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14545 | */ |
| 14546 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14547 | /* set pin widget 1Ah (line in) for input */ |
| 14548 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14549 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14550 | * the vref |
| 14551 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14552 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14553 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14554 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14555 | #if 0 |
| 14556 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14557 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14558 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14559 | { } /* end */ |
| 14560 | }; |
| 14561 | /* |
| 14562 | * 6ch mode |
| 14563 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14564 | */ |
| 14565 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14566 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14567 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14568 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14569 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14570 | |
| 14571 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14572 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14573 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14574 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14575 | #if 0 |
| 14576 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14577 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14578 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14579 | { } /* end */ |
| 14580 | }; |
| 14581 | |
| 14582 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14583 | { 2, alc861_threestack_ch2_init }, |
| 14584 | { 6, alc861_threestack_ch6_init }, |
| 14585 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14586 | /* Set mic1 as input and unmute the mixer */ |
| 14587 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14588 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14589 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14590 | { } /* end */ |
| 14591 | }; |
| 14592 | /* Set mic1 as output and mute mixer */ |
| 14593 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14594 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14595 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14596 | { } /* end */ |
| 14597 | }; |
| 14598 | |
| 14599 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14600 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14601 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14602 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14603 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14604 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14605 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14606 | /* set pin widget 1Ah (line in) for input */ |
| 14607 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14608 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14609 | * the vref |
| 14610 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14611 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14612 | |
| 14613 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14614 | #if 0 |
| 14615 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14616 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14617 | #endif |
| 14618 | { } /* end */ |
| 14619 | }; |
| 14620 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14621 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14622 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14623 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14624 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14625 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14626 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14627 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14628 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14629 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14630 | |
| 14631 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14632 | #if 0 |
| 14633 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14634 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14635 | #endif |
| 14636 | { } /* end */ |
| 14637 | }; |
| 14638 | |
| 14639 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14640 | { 2, alc861_asus_ch2_init }, |
| 14641 | { 6, alc861_asus_ch6_init }, |
| 14642 | }; |
| 14643 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14644 | /* patch-ALC861 */ |
| 14645 | |
| 14646 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14647 | /* output mixer control */ |
| 14648 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14649 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14650 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14651 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14652 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14653 | |
| 14654 | /*Input mixer control */ |
| 14655 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14656 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14657 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14659 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14660 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14661 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14662 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14663 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14664 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14666 | { } /* end */ |
| 14667 | }; |
| 14668 | |
| 14669 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14670 | /* output mixer control */ |
| 14671 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14672 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14673 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14674 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14675 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14676 | |
| 14677 | /* Input mixer control */ |
| 14678 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14679 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14680 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14681 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14682 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14683 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14684 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14686 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14687 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14688 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14689 | { |
| 14690 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14691 | .name = "Channel Mode", |
| 14692 | .info = alc_ch_mode_info, |
| 14693 | .get = alc_ch_mode_get, |
| 14694 | .put = alc_ch_mode_put, |
| 14695 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14696 | }, |
| 14697 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14698 | }; |
| 14699 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14700 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14701 | /* output mixer control */ |
| 14702 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14705 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14706 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14707 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14708 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14709 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14710 | /* output mixer control */ |
| 14711 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14712 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14713 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14714 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14715 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14716 | |
| 14717 | /* Input mixer control */ |
| 14718 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14719 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14720 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14721 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14722 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14723 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14724 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14725 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14726 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14727 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14728 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14729 | { |
| 14730 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14731 | .name = "Channel Mode", |
| 14732 | .info = alc_ch_mode_info, |
| 14733 | .get = alc_ch_mode_get, |
| 14734 | .put = alc_ch_mode_put, |
| 14735 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14736 | }, |
| 14737 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14738 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14739 | |
| 14740 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14741 | /* output mixer control */ |
| 14742 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14743 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14744 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14745 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14746 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14747 | |
| 14748 | /* Input mixer control */ |
| 14749 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14750 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14752 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14753 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14754 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14756 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14757 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14759 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14760 | { |
| 14761 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14762 | .name = "Channel Mode", |
| 14763 | .info = alc_ch_mode_info, |
| 14764 | .get = alc_ch_mode_get, |
| 14765 | .put = alc_ch_mode_put, |
| 14766 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14767 | }, |
| 14768 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14769 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14770 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14771 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14772 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14773 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14774 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14775 | { } |
| 14776 | }; |
| 14777 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14778 | /* |
| 14779 | * generic initialization of ADC, input mixers and output mixers |
| 14780 | */ |
| 14781 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14782 | /* |
| 14783 | * Unmute ADC0 and set the default input to mic-in |
| 14784 | */ |
| 14785 | /* port-A for surround (rear panel) */ |
| 14786 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14787 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14788 | /* port-B for mic-in (rear panel) with vref */ |
| 14789 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14790 | /* port-C for line-in (rear panel) */ |
| 14791 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14792 | /* port-D for Front */ |
| 14793 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14794 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14795 | /* port-E for HP out (front panel) */ |
| 14796 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14797 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14798 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14799 | /* port-F for mic-in (front panel) with vref */ |
| 14800 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14801 | /* port-G for CLFE (rear panel) */ |
| 14802 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14803 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14804 | /* port-H for side (rear panel) */ |
| 14805 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14806 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14807 | /* CD-in */ |
| 14808 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14809 | /* route front mic to ADC1*/ |
| 14810 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14811 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14812 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14813 | /* Unmute DAC0~3 & spdif out*/ |
| 14814 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14815 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14816 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14817 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14820 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14821 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14822 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14823 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14824 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14826 | /* Unmute Stereo Mixer 15 */ |
| 14827 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14828 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14830 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14831 | |
| 14832 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14834 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14835 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14836 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14837 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14838 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14839 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14840 | /* hp used DAC 3 (Front) */ |
| 14841 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14842 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14843 | |
| 14844 | { } |
| 14845 | }; |
| 14846 | |
| 14847 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14848 | /* |
| 14849 | * Unmute ADC0 and set the default input to mic-in |
| 14850 | */ |
| 14851 | /* port-A for surround (rear panel) */ |
| 14852 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14853 | /* port-B for mic-in (rear panel) with vref */ |
| 14854 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14855 | /* port-C for line-in (rear panel) */ |
| 14856 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14857 | /* port-D for Front */ |
| 14858 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14859 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14860 | /* port-E for HP out (front panel) */ |
| 14861 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14862 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14863 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14864 | /* port-F for mic-in (front panel) with vref */ |
| 14865 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14866 | /* port-G for CLFE (rear panel) */ |
| 14867 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14868 | /* port-H for side (rear panel) */ |
| 14869 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14870 | /* CD-in */ |
| 14871 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14872 | /* route front mic to ADC1*/ |
| 14873 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14874 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14875 | /* Unmute DAC0~3 & spdif out*/ |
| 14876 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14877 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14878 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14879 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14880 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14881 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14882 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14883 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14884 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14885 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14886 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14887 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14888 | /* Unmute Stereo Mixer 15 */ |
| 14889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14891 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14892 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14893 | |
| 14894 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14895 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14896 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14897 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14898 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14899 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14900 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14901 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14902 | /* hp used DAC 3 (Front) */ |
| 14903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14905 | { } |
| 14906 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14907 | |
| 14908 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14909 | /* |
| 14910 | * Unmute ADC0 and set the default input to mic-in |
| 14911 | */ |
| 14912 | /* port-A for surround (rear panel) */ |
| 14913 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14914 | /* port-B for mic-in (rear panel) with vref */ |
| 14915 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14916 | /* port-C for line-in (rear panel) */ |
| 14917 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14918 | /* port-D for Front */ |
| 14919 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14920 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14921 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14922 | /* this has to be set to VREF80 */ |
| 14923 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14924 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14925 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14926 | /* port-F for mic-in (front panel) with vref */ |
| 14927 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14928 | /* port-G for CLFE (rear panel) */ |
| 14929 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14930 | /* port-H for side (rear panel) */ |
| 14931 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14932 | /* CD-in */ |
| 14933 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14934 | /* route front mic to ADC1*/ |
| 14935 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14936 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14937 | /* Unmute DAC0~3 & spdif out*/ |
| 14938 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14939 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14940 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14941 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14942 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14943 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14944 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14945 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14946 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14947 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14948 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14949 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14950 | /* Unmute Stereo Mixer 15 */ |
| 14951 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14952 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14953 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14955 | |
| 14956 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14957 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14958 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14959 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14960 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14961 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14962 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14963 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14964 | /* hp used DAC 3 (Front) */ |
| 14965 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14966 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14967 | { } |
| 14968 | }; |
| 14969 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14970 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14971 | /* |
| 14972 | * Unmute ADC0 and set the default input to mic-in |
| 14973 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14974 | /* port-A for surround (rear panel) |
| 14975 | * according to codec#0 this is the HP jack |
| 14976 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14977 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14978 | /* route front PCM to HP */ |
| 14979 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14980 | /* port-B for mic-in (rear panel) with vref */ |
| 14981 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14982 | /* port-C for line-in (rear panel) */ |
| 14983 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14984 | /* port-D for Front */ |
| 14985 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14986 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14987 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14988 | /* this has to be set to VREF80 */ |
| 14989 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14990 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14991 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14992 | /* port-F for mic-in (front panel) with vref */ |
| 14993 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14994 | /* port-G for CLFE (rear panel) */ |
| 14995 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14996 | /* port-H for side (rear panel) */ |
| 14997 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14998 | /* CD-in */ |
| 14999 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15000 | /* route front mic to ADC1*/ |
| 15001 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15003 | /* Unmute DAC0~3 & spdif out*/ |
| 15004 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15005 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15006 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15007 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15008 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15009 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15010 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15011 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15012 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15013 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15014 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15015 | /* Unmute Stereo Mixer 15 */ |
| 15016 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15017 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15018 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15019 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15020 | |
| 15021 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15022 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15023 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15024 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15025 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15026 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15027 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15028 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15029 | /* hp used DAC 3 (Front) */ |
| 15030 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15031 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15032 | { } |
| 15033 | }; |
| 15034 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15035 | /* additional init verbs for ASUS laptops */ |
| 15036 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15037 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15038 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15039 | { } |
| 15040 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15041 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15042 | /* |
| 15043 | * generic initialization of ADC, input mixers and output mixers |
| 15044 | */ |
| 15045 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15046 | /* |
| 15047 | * Unmute ADC0 and set the default input to mic-in |
| 15048 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15049 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15050 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15051 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15052 | /* Unmute DAC0~3 & spdif out*/ |
| 15053 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15054 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15055 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15056 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15058 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15059 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15060 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15061 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15062 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15063 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15064 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15065 | /* Unmute Stereo Mixer 15 */ |
| 15066 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15067 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15068 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15070 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15071 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15072 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15073 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15074 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15075 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15076 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15077 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15078 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15079 | |
| 15080 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15081 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15082 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15084 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15085 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15086 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15087 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15088 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15089 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15090 | |
| 15091 | { } |
| 15092 | }; |
| 15093 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15094 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15095 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15096 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15097 | { } |
| 15098 | }; |
| 15099 | |
| 15100 | /* toggle speaker-output according to the hp-jack state */ |
| 15101 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15102 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15103 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15104 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15105 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15106 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15107 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15108 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15109 | } |
| 15110 | |
| 15111 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15112 | unsigned int res) |
| 15113 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15114 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15115 | alc861_toshiba_automute(codec); |
| 15116 | } |
| 15117 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15118 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15119 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15120 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15121 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15122 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15123 | |
| 15124 | |
| 15125 | #define ALC861_DIGOUT_NID 0x07 |
| 15126 | |
| 15127 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15128 | { 8, NULL } |
| 15129 | }; |
| 15130 | |
| 15131 | static hda_nid_t alc861_dac_nids[4] = { |
| 15132 | /* front, surround, clfe, side */ |
| 15133 | 0x03, 0x06, 0x05, 0x04 |
| 15134 | }; |
| 15135 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15136 | static hda_nid_t alc660_dac_nids[3] = { |
| 15137 | /* front, clfe, surround */ |
| 15138 | 0x03, 0x05, 0x06 |
| 15139 | }; |
| 15140 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15141 | static hda_nid_t alc861_adc_nids[1] = { |
| 15142 | /* ADC0-2 */ |
| 15143 | 0x08, |
| 15144 | }; |
| 15145 | |
| 15146 | static struct hda_input_mux alc861_capture_source = { |
| 15147 | .num_items = 5, |
| 15148 | .items = { |
| 15149 | { "Mic", 0x0 }, |
| 15150 | { "Front Mic", 0x3 }, |
| 15151 | { "Line", 0x1 }, |
| 15152 | { "CD", 0x4 }, |
| 15153 | { "Mixer", 0x5 }, |
| 15154 | }, |
| 15155 | }; |
| 15156 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15157 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15158 | { |
| 15159 | struct alc_spec *spec = codec->spec; |
| 15160 | hda_nid_t mix, srcs[5]; |
| 15161 | int i, j, num; |
| 15162 | |
| 15163 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15164 | return 0; |
| 15165 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15166 | if (num < 0) |
| 15167 | return 0; |
| 15168 | for (i = 0; i < num; i++) { |
| 15169 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15170 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15171 | if (type != AC_WID_AUD_OUT) |
| 15172 | continue; |
| 15173 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15174 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15175 | break; |
| 15176 | if (j >= spec->multiout.num_dacs) |
| 15177 | return srcs[i]; |
| 15178 | } |
| 15179 | return 0; |
| 15180 | } |
| 15181 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15182 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15183 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15184 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15185 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15186 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15187 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15188 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15189 | |
| 15190 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15191 | for (i = 0; i < cfg->line_outs; i++) { |
| 15192 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15193 | dac = alc861_look_for_dac(codec, nid); |
| 15194 | if (!dac) |
| 15195 | continue; |
| 15196 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15197 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15198 | return 0; |
| 15199 | } |
| 15200 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15201 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15202 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15203 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15204 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15205 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15206 | } |
| 15207 | |
| 15208 | /* add playback controls from the parsed DAC table */ |
| 15209 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15210 | const struct auto_pin_cfg *cfg) |
| 15211 | { |
| 15212 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15213 | static const char *chname[4] = { |
| 15214 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15215 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15216 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15217 | int i, err; |
| 15218 | |
| 15219 | if (cfg->line_outs == 1) { |
| 15220 | const char *pfx = NULL; |
| 15221 | if (!cfg->hp_outs) |
| 15222 | pfx = "Master"; |
| 15223 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15224 | pfx = "Speaker"; |
| 15225 | if (pfx) { |
| 15226 | nid = spec->multiout.dac_nids[0]; |
| 15227 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15228 | } |
| 15229 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15230 | |
| 15231 | for (i = 0; i < cfg->line_outs; i++) { |
| 15232 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15233 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15234 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15235 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15236 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15237 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15238 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15239 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15240 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15241 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15242 | return err; |
| 15243 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15244 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15245 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15246 | return err; |
| 15247 | } |
| 15248 | } |
| 15249 | return 0; |
| 15250 | } |
| 15251 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15252 | 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] | 15253 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15254 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15255 | int err; |
| 15256 | hda_nid_t nid; |
| 15257 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15258 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15259 | return 0; |
| 15260 | |
| 15261 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15262 | nid = alc861_look_for_dac(codec, pin); |
| 15263 | if (nid) { |
| 15264 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15265 | if (err < 0) |
| 15266 | return err; |
| 15267 | spec->multiout.hp_nid = nid; |
| 15268 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15269 | } |
| 15270 | return 0; |
| 15271 | } |
| 15272 | |
| 15273 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15274 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15275 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15276 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15277 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15278 | } |
| 15279 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15280 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15281 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15282 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15283 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15284 | hda_nid_t mix, srcs[5]; |
| 15285 | int i, num; |
| 15286 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15287 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15288 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15289 | 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] | 15290 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15291 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15292 | return; |
| 15293 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15294 | if (num < 0) |
| 15295 | return; |
| 15296 | for (i = 0; i < num; i++) { |
| 15297 | unsigned int mute; |
| 15298 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15299 | mute = AMP_IN_UNMUTE(i); |
| 15300 | else |
| 15301 | mute = AMP_IN_MUTE(i); |
| 15302 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15303 | mute); |
| 15304 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15305 | } |
| 15306 | |
| 15307 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15308 | { |
| 15309 | struct alc_spec *spec = codec->spec; |
| 15310 | int i; |
| 15311 | |
| 15312 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15313 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15314 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15315 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15316 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15317 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15318 | } |
| 15319 | } |
| 15320 | |
| 15321 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15322 | { |
| 15323 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15324 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15325 | if (spec->autocfg.hp_outs) |
| 15326 | alc861_auto_set_output_and_unmute(codec, |
| 15327 | spec->autocfg.hp_pins[0], |
| 15328 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15329 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15330 | if (spec->autocfg.speaker_outs) |
| 15331 | alc861_auto_set_output_and_unmute(codec, |
| 15332 | spec->autocfg.speaker_pins[0], |
| 15333 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15334 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15335 | } |
| 15336 | |
| 15337 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15338 | { |
| 15339 | struct alc_spec *spec = codec->spec; |
| 15340 | int i; |
| 15341 | |
| 15342 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15343 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15344 | if (nid >= 0x0c && nid <= 0x11) |
| 15345 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15346 | } |
| 15347 | } |
| 15348 | |
| 15349 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15350 | /* return 1 if successful, 0 if the proper config is not found, |
| 15351 | * or a negative error code |
| 15352 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15353 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15354 | { |
| 15355 | struct alc_spec *spec = codec->spec; |
| 15356 | int err; |
| 15357 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15358 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15359 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15360 | alc861_ignore); |
| 15361 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15362 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15363 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15364 | return 0; /* can't find valid BIOS pin config */ |
| 15365 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15366 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15367 | if (err < 0) |
| 15368 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15369 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15370 | if (err < 0) |
| 15371 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15372 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15373 | if (err < 0) |
| 15374 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15375 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15376 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15377 | return err; |
| 15378 | |
| 15379 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15380 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15381 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15382 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15383 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15384 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15385 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15386 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15387 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15388 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15389 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15390 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15391 | |
| 15392 | spec->adc_nids = alc861_adc_nids; |
| 15393 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15394 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15395 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15396 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15397 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15398 | return 1; |
| 15399 | } |
| 15400 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15401 | /* additional initialization for auto-configuration model */ |
| 15402 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15403 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15404 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15405 | alc861_auto_init_multi_out(codec); |
| 15406 | alc861_auto_init_hp_out(codec); |
| 15407 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15408 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15409 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15410 | } |
| 15411 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15413 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15414 | { 0x15, HDA_INPUT, 0 }, |
| 15415 | { 0x15, HDA_INPUT, 1 }, |
| 15416 | { 0x15, HDA_INPUT, 2 }, |
| 15417 | { 0x15, HDA_INPUT, 3 }, |
| 15418 | { } /* end */ |
| 15419 | }; |
| 15420 | #endif |
| 15421 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15422 | |
| 15423 | /* |
| 15424 | * configuration and preset |
| 15425 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15426 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15427 | [ALC861_3ST] = "3stack", |
| 15428 | [ALC660_3ST] = "3stack-660", |
| 15429 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15430 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15431 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15432 | [ALC861_TOSHIBA] = "toshiba", |
| 15433 | [ALC861_ASUS] = "asus", |
| 15434 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15435 | [ALC861_AUTO] = "auto", |
| 15436 | }; |
| 15437 | |
| 15438 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15439 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15440 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15441 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15442 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15443 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15444 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15445 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15446 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15447 | * Any other models that need this preset? |
| 15448 | */ |
| 15449 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15450 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15451 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15452 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15453 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15454 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15455 | /* FIXME: the below seems conflict */ |
| 15456 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15457 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15458 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15459 | {} |
| 15460 | }; |
| 15461 | |
| 15462 | static struct alc_config_preset alc861_presets[] = { |
| 15463 | [ALC861_3ST] = { |
| 15464 | .mixers = { alc861_3ST_mixer }, |
| 15465 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15466 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15467 | .dac_nids = alc861_dac_nids, |
| 15468 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15469 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15470 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15471 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15472 | .adc_nids = alc861_adc_nids, |
| 15473 | .input_mux = &alc861_capture_source, |
| 15474 | }, |
| 15475 | [ALC861_3ST_DIG] = { |
| 15476 | .mixers = { alc861_base_mixer }, |
| 15477 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15478 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15479 | .dac_nids = alc861_dac_nids, |
| 15480 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15481 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15482 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15483 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15484 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15485 | .adc_nids = alc861_adc_nids, |
| 15486 | .input_mux = &alc861_capture_source, |
| 15487 | }, |
| 15488 | [ALC861_6ST_DIG] = { |
| 15489 | .mixers = { alc861_base_mixer }, |
| 15490 | .init_verbs = { alc861_base_init_verbs }, |
| 15491 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15492 | .dac_nids = alc861_dac_nids, |
| 15493 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15494 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15495 | .channel_mode = alc861_8ch_modes, |
| 15496 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15497 | .adc_nids = alc861_adc_nids, |
| 15498 | .input_mux = &alc861_capture_source, |
| 15499 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15500 | [ALC660_3ST] = { |
| 15501 | .mixers = { alc861_3ST_mixer }, |
| 15502 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15503 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15504 | .dac_nids = alc660_dac_nids, |
| 15505 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15506 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15507 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15508 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15509 | .adc_nids = alc861_adc_nids, |
| 15510 | .input_mux = &alc861_capture_source, |
| 15511 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15512 | [ALC861_UNIWILL_M31] = { |
| 15513 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15514 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15515 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15516 | .dac_nids = alc861_dac_nids, |
| 15517 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15518 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15519 | .channel_mode = alc861_uniwill_m31_modes, |
| 15520 | .need_dac_fix = 1, |
| 15521 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15522 | .adc_nids = alc861_adc_nids, |
| 15523 | .input_mux = &alc861_capture_source, |
| 15524 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15525 | [ALC861_TOSHIBA] = { |
| 15526 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15527 | .init_verbs = { alc861_base_init_verbs, |
| 15528 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15529 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15530 | .dac_nids = alc861_dac_nids, |
| 15531 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15532 | .channel_mode = alc883_3ST_2ch_modes, |
| 15533 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15534 | .adc_nids = alc861_adc_nids, |
| 15535 | .input_mux = &alc861_capture_source, |
| 15536 | .unsol_event = alc861_toshiba_unsol_event, |
| 15537 | .init_hook = alc861_toshiba_automute, |
| 15538 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15539 | [ALC861_ASUS] = { |
| 15540 | .mixers = { alc861_asus_mixer }, |
| 15541 | .init_verbs = { alc861_asus_init_verbs }, |
| 15542 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15543 | .dac_nids = alc861_dac_nids, |
| 15544 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15545 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15546 | .channel_mode = alc861_asus_modes, |
| 15547 | .need_dac_fix = 1, |
| 15548 | .hp_nid = 0x06, |
| 15549 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15550 | .adc_nids = alc861_adc_nids, |
| 15551 | .input_mux = &alc861_capture_source, |
| 15552 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15553 | [ALC861_ASUS_LAPTOP] = { |
| 15554 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15555 | .init_verbs = { alc861_asus_init_verbs, |
| 15556 | alc861_asus_laptop_init_verbs }, |
| 15557 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15558 | .dac_nids = alc861_dac_nids, |
| 15559 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15560 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15561 | .channel_mode = alc883_3ST_2ch_modes, |
| 15562 | .need_dac_fix = 1, |
| 15563 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15564 | .adc_nids = alc861_adc_nids, |
| 15565 | .input_mux = &alc861_capture_source, |
| 15566 | }, |
| 15567 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15568 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15569 | /* Pin config fixes */ |
| 15570 | enum { |
| 15571 | PINFIX_FSC_AMILO_PI1505, |
| 15572 | }; |
| 15573 | |
| 15574 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15575 | { 0x0b, 0x0221101f }, /* HP */ |
| 15576 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15577 | { } |
| 15578 | }; |
| 15579 | |
| 15580 | static const struct alc_fixup alc861_fixups[] = { |
| 15581 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15582 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15583 | }, |
| 15584 | }; |
| 15585 | |
| 15586 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15587 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15588 | {} |
| 15589 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15590 | |
| 15591 | static int patch_alc861(struct hda_codec *codec) |
| 15592 | { |
| 15593 | struct alc_spec *spec; |
| 15594 | int board_config; |
| 15595 | int err; |
| 15596 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15597 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15598 | if (spec == NULL) |
| 15599 | return -ENOMEM; |
| 15600 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15601 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15602 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15603 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15604 | alc861_models, |
| 15605 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15606 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15607 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15608 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15609 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15610 | board_config = ALC861_AUTO; |
| 15611 | } |
| 15612 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15613 | if (board_config == ALC861_AUTO) |
| 15614 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15615 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15616 | if (board_config == ALC861_AUTO) { |
| 15617 | /* automatic parse from the BIOS config */ |
| 15618 | err = alc861_parse_auto_config(codec); |
| 15619 | if (err < 0) { |
| 15620 | alc_free(codec); |
| 15621 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15622 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15623 | printk(KERN_INFO |
| 15624 | "hda_codec: Cannot set up configuration " |
| 15625 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15626 | board_config = ALC861_3ST_DIG; |
| 15627 | } |
| 15628 | } |
| 15629 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15630 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15631 | if (err < 0) { |
| 15632 | alc_free(codec); |
| 15633 | return err; |
| 15634 | } |
| 15635 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15636 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15637 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15638 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15639 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15640 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15642 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15643 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15644 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15645 | if (!spec->cap_mixer) |
| 15646 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15647 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15648 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15649 | spec->vmaster_nid = 0x03; |
| 15650 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15651 | if (board_config == ALC861_AUTO) |
| 15652 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15653 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15654 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15655 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15656 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15657 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15658 | spec->power_hook = alc_power_eapd; |
| 15659 | #endif |
| 15660 | } |
| 15661 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15662 | if (!spec->loopback.amplist) |
| 15663 | spec->loopback.amplist = alc861_loopbacks; |
| 15664 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15665 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15666 | return 0; |
| 15667 | } |
| 15668 | |
| 15669 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15670 | * ALC861-VD support |
| 15671 | * |
| 15672 | * Based on ALC882 |
| 15673 | * |
| 15674 | * In addition, an independent DAC |
| 15675 | */ |
| 15676 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15677 | |
| 15678 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15679 | /* front, surr, clfe, side surr */ |
| 15680 | 0x02, 0x03, 0x04, 0x05 |
| 15681 | }; |
| 15682 | |
| 15683 | /* dac_nids for ALC660vd are in a different order - according to |
| 15684 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15685 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15686 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15687 | * - and it is the same as in 861vd. |
| 15688 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15689 | */ |
| 15690 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15691 | /* front, rear, clfe, rear_surr */ |
| 15692 | 0x02, 0x04, 0x03 |
| 15693 | }; |
| 15694 | |
| 15695 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15696 | /* ADC0 */ |
| 15697 | 0x09, |
| 15698 | }; |
| 15699 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15700 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15701 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15702 | /* input MUX */ |
| 15703 | /* FIXME: should be a matrix-type input source selection */ |
| 15704 | static struct hda_input_mux alc861vd_capture_source = { |
| 15705 | .num_items = 4, |
| 15706 | .items = { |
| 15707 | { "Mic", 0x0 }, |
| 15708 | { "Front Mic", 0x1 }, |
| 15709 | { "Line", 0x2 }, |
| 15710 | { "CD", 0x4 }, |
| 15711 | }, |
| 15712 | }; |
| 15713 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15714 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15715 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15716 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15717 | { "Ext Mic", 0x0 }, |
| 15718 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15719 | }, |
| 15720 | }; |
| 15721 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15722 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15723 | .num_items = 2, |
| 15724 | .items = { |
| 15725 | { "Front Mic", 0x0 }, |
| 15726 | { "ATAPI Mic", 0x1 }, |
| 15727 | }, |
| 15728 | }; |
| 15729 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15730 | /* |
| 15731 | * 2ch mode |
| 15732 | */ |
| 15733 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15734 | { 2, NULL } |
| 15735 | }; |
| 15736 | |
| 15737 | /* |
| 15738 | * 6ch mode |
| 15739 | */ |
| 15740 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15741 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15742 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15743 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15744 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15745 | { } /* end */ |
| 15746 | }; |
| 15747 | |
| 15748 | /* |
| 15749 | * 8ch mode |
| 15750 | */ |
| 15751 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15752 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15753 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15754 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15755 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15756 | { } /* end */ |
| 15757 | }; |
| 15758 | |
| 15759 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15760 | { 6, alc861vd_6stack_ch6_init }, |
| 15761 | { 8, alc861vd_6stack_ch8_init }, |
| 15762 | }; |
| 15763 | |
| 15764 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15765 | { |
| 15766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15767 | .name = "Channel Mode", |
| 15768 | .info = alc_ch_mode_info, |
| 15769 | .get = alc_ch_mode_get, |
| 15770 | .put = alc_ch_mode_put, |
| 15771 | }, |
| 15772 | { } /* end */ |
| 15773 | }; |
| 15774 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15775 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15776 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15777 | */ |
| 15778 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15779 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15780 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15781 | |
| 15782 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15783 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15784 | |
| 15785 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15786 | HDA_OUTPUT), |
| 15787 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15788 | HDA_OUTPUT), |
| 15789 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15790 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15791 | |
| 15792 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15793 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15794 | |
| 15795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15796 | |
| 15797 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15800 | |
| 15801 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15802 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15803 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15804 | |
| 15805 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15806 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15807 | |
| 15808 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15809 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15810 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15811 | { } /* end */ |
| 15812 | }; |
| 15813 | |
| 15814 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15815 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15816 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15817 | |
| 15818 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15819 | |
| 15820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15823 | |
| 15824 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15825 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15826 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15827 | |
| 15828 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15829 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15830 | |
| 15831 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15832 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15833 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15834 | { } /* end */ |
| 15835 | }; |
| 15836 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15837 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15838 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15839 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15840 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15841 | |
| 15842 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15843 | |
| 15844 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15847 | |
| 15848 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15849 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15850 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15851 | |
| 15852 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15853 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15854 | |
| 15855 | { } /* end */ |
| 15856 | }; |
| 15857 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15858 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15859 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15860 | */ |
| 15861 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15862 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15863 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15864 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15865 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15866 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15867 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15868 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15869 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15870 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15871 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15872 | { } /* end */ |
| 15873 | }; |
| 15874 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15875 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15876 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15877 | */ |
| 15878 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15880 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15881 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15882 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15883 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15884 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15885 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15886 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15887 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15888 | { } /* end */ |
| 15889 | }; |
| 15890 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15891 | /* |
| 15892 | * generic initialization of ADC, input mixers and output mixers |
| 15893 | */ |
| 15894 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15895 | /* |
| 15896 | * Unmute ADC0 and set the default input to mic-in |
| 15897 | */ |
| 15898 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15899 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15900 | |
| 15901 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15902 | * the analog-loopback mixer widget |
| 15903 | */ |
| 15904 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15910 | |
| 15911 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15912 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15913 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15914 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15915 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15916 | |
| 15917 | /* |
| 15918 | * Set up output mixers (0x02 - 0x05) |
| 15919 | */ |
| 15920 | /* set vol=0 to output mixers */ |
| 15921 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15922 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15923 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15924 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15925 | |
| 15926 | /* set up input amps for analog loopback */ |
| 15927 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15928 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15929 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15930 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15931 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15932 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15933 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15934 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15936 | |
| 15937 | { } |
| 15938 | }; |
| 15939 | |
| 15940 | /* |
| 15941 | * 3-stack pin configuration: |
| 15942 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15943 | */ |
| 15944 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15945 | /* |
| 15946 | * Set pin mode and muting |
| 15947 | */ |
| 15948 | /* set front pin widgets 0x14 for output */ |
| 15949 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15950 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15951 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15952 | |
| 15953 | /* Mic (rear) pin: input vref at 80% */ |
| 15954 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15955 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15956 | /* Front Mic pin: input vref at 80% */ |
| 15957 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15959 | /* Line In pin: input */ |
| 15960 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15961 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15962 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15964 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15965 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15966 | /* CD pin widget for input */ |
| 15967 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15968 | |
| 15969 | { } |
| 15970 | }; |
| 15971 | |
| 15972 | /* |
| 15973 | * 6-stack pin configuration: |
| 15974 | */ |
| 15975 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15976 | /* |
| 15977 | * Set pin mode and muting |
| 15978 | */ |
| 15979 | /* set front pin widgets 0x14 for output */ |
| 15980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15982 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15983 | |
| 15984 | /* Rear Pin: output 1 (0x0d) */ |
| 15985 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15986 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15987 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15988 | /* CLFE Pin: output 2 (0x0e) */ |
| 15989 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15990 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15991 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15992 | /* Side Pin: output 3 (0x0f) */ |
| 15993 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15994 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15995 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15996 | |
| 15997 | /* Mic (rear) pin: input vref at 80% */ |
| 15998 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15999 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16000 | /* Front Mic pin: input vref at 80% */ |
| 16001 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16002 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16003 | /* Line In pin: input */ |
| 16004 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16005 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16006 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16007 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16008 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16009 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16010 | /* CD pin widget for input */ |
| 16011 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16012 | |
| 16013 | { } |
| 16014 | }; |
| 16015 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16016 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16017 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16018 | { } |
| 16019 | }; |
| 16020 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16021 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16022 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16023 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16024 | { } |
| 16025 | }; |
| 16026 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16027 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16031 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16032 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16033 | {} |
| 16034 | }; |
| 16035 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16036 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16037 | { |
| 16038 | unsigned int present; |
| 16039 | unsigned char bits; |
| 16040 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16041 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16042 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16043 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16044 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16045 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16046 | } |
| 16047 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16048 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16049 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16050 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16051 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16052 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16053 | } |
| 16054 | |
| 16055 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16056 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16057 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16058 | alc861vd_lenovo_mic_automute(codec); |
| 16059 | } |
| 16060 | |
| 16061 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16062 | unsigned int res) |
| 16063 | { |
| 16064 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16065 | case ALC880_MIC_EVENT: |
| 16066 | alc861vd_lenovo_mic_automute(codec); |
| 16067 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16068 | default: |
| 16069 | alc_automute_amp_unsol_event(codec, res); |
| 16070 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16071 | } |
| 16072 | } |
| 16073 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16074 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16075 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16076 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16077 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16078 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16079 | |
| 16080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16082 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16083 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16084 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16085 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16086 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16087 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16088 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16091 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16092 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16093 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16095 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16096 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16097 | |
| 16098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16099 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16100 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16101 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16102 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16103 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16104 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16105 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16106 | |
| 16107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16111 | |
| 16112 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16113 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16114 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16115 | |
| 16116 | { } /* end */ |
| 16117 | }; |
| 16118 | |
| 16119 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16120 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16121 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16122 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16123 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16124 | spec->autocfg.hp_pins[0] = 0x15; |
| 16125 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16126 | } |
| 16127 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16128 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16129 | #define alc861vd_loopbacks alc880_loopbacks |
| 16130 | #endif |
| 16131 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16132 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16133 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16134 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16135 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16136 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16137 | |
| 16138 | /* |
| 16139 | * configuration and preset |
| 16140 | */ |
| 16141 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16142 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16143 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16144 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16145 | [ALC861VD_3ST] = "3stack", |
| 16146 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16147 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16148 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16149 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16150 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16151 | [ALC861VD_AUTO] = "auto", |
| 16152 | }; |
| 16153 | |
| 16154 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16155 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16156 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16157 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16158 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16159 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16160 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16161 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16162 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16163 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16164 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16165 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16166 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16167 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16168 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16169 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16170 | {} |
| 16171 | }; |
| 16172 | |
| 16173 | static struct alc_config_preset alc861vd_presets[] = { |
| 16174 | [ALC660VD_3ST] = { |
| 16175 | .mixers = { alc861vd_3st_mixer }, |
| 16176 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16177 | alc861vd_3stack_init_verbs }, |
| 16178 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16179 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16180 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16181 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16182 | .input_mux = &alc861vd_capture_source, |
| 16183 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16184 | [ALC660VD_3ST_DIG] = { |
| 16185 | .mixers = { alc861vd_3st_mixer }, |
| 16186 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16187 | alc861vd_3stack_init_verbs }, |
| 16188 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16189 | .dac_nids = alc660vd_dac_nids, |
| 16190 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16191 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16192 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16193 | .input_mux = &alc861vd_capture_source, |
| 16194 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16195 | [ALC861VD_3ST] = { |
| 16196 | .mixers = { alc861vd_3st_mixer }, |
| 16197 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16198 | alc861vd_3stack_init_verbs }, |
| 16199 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16200 | .dac_nids = alc861vd_dac_nids, |
| 16201 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16202 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16203 | .input_mux = &alc861vd_capture_source, |
| 16204 | }, |
| 16205 | [ALC861VD_3ST_DIG] = { |
| 16206 | .mixers = { alc861vd_3st_mixer }, |
| 16207 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16208 | alc861vd_3stack_init_verbs }, |
| 16209 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16210 | .dac_nids = alc861vd_dac_nids, |
| 16211 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16212 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16213 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16214 | .input_mux = &alc861vd_capture_source, |
| 16215 | }, |
| 16216 | [ALC861VD_6ST_DIG] = { |
| 16217 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16218 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16219 | alc861vd_6stack_init_verbs }, |
| 16220 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16221 | .dac_nids = alc861vd_dac_nids, |
| 16222 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16223 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16224 | .channel_mode = alc861vd_6stack_modes, |
| 16225 | .input_mux = &alc861vd_capture_source, |
| 16226 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16227 | [ALC861VD_LENOVO] = { |
| 16228 | .mixers = { alc861vd_lenovo_mixer }, |
| 16229 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16230 | alc861vd_3stack_init_verbs, |
| 16231 | alc861vd_eapd_verbs, |
| 16232 | alc861vd_lenovo_unsol_verbs }, |
| 16233 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16234 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16235 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16236 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16237 | .input_mux = &alc861vd_capture_source, |
| 16238 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16239 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16240 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16241 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16242 | [ALC861VD_DALLAS] = { |
| 16243 | .mixers = { alc861vd_dallas_mixer }, |
| 16244 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16245 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16246 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16247 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16248 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16249 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16250 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16251 | .setup = alc861vd_dallas_setup, |
| 16252 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16253 | }, |
| 16254 | [ALC861VD_HP] = { |
| 16255 | .mixers = { alc861vd_hp_mixer }, |
| 16256 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16257 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16258 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16259 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16260 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16261 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16262 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16263 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16264 | .setup = alc861vd_dallas_setup, |
| 16265 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16266 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16267 | [ALC660VD_ASUS_V1S] = { |
| 16268 | .mixers = { alc861vd_lenovo_mixer }, |
| 16269 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16270 | alc861vd_3stack_init_verbs, |
| 16271 | alc861vd_eapd_verbs, |
| 16272 | alc861vd_lenovo_unsol_verbs }, |
| 16273 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16274 | .dac_nids = alc660vd_dac_nids, |
| 16275 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16276 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16277 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16278 | .input_mux = &alc861vd_capture_source, |
| 16279 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16280 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16281 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16282 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16283 | }; |
| 16284 | |
| 16285 | /* |
| 16286 | * BIOS auto configuration |
| 16287 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16288 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16289 | const struct auto_pin_cfg *cfg) |
| 16290 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16291 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16292 | } |
| 16293 | |
| 16294 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16295 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16296 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16297 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16298 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16299 | } |
| 16300 | |
| 16301 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16302 | { |
| 16303 | struct alc_spec *spec = codec->spec; |
| 16304 | int i; |
| 16305 | |
| 16306 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16307 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16308 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16309 | if (nid) |
| 16310 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16311 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16312 | } |
| 16313 | } |
| 16314 | |
| 16315 | |
| 16316 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16317 | { |
| 16318 | struct alc_spec *spec = codec->spec; |
| 16319 | hda_nid_t pin; |
| 16320 | |
| 16321 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16322 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16323 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16324 | pin = spec->autocfg.speaker_pins[0]; |
| 16325 | if (pin) |
| 16326 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16327 | } |
| 16328 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16329 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16330 | |
| 16331 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16332 | { |
| 16333 | struct alc_spec *spec = codec->spec; |
| 16334 | int i; |
| 16335 | |
| 16336 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16337 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16338 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16339 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16340 | if (nid != ALC861VD_PIN_CD_NID && |
| 16341 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16342 | snd_hda_codec_write(codec, nid, 0, |
| 16343 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16344 | AMP_OUT_MUTE); |
| 16345 | } |
| 16346 | } |
| 16347 | } |
| 16348 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16349 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16350 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16351 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16352 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16353 | |
| 16354 | /* add playback controls from the parsed DAC table */ |
| 16355 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16356 | * different NIDs for mute/unmute switch and volume control */ |
| 16357 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16358 | const struct auto_pin_cfg *cfg) |
| 16359 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16360 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16361 | hda_nid_t nid_v, nid_s; |
| 16362 | int i, err; |
| 16363 | |
| 16364 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16365 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16366 | continue; |
| 16367 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16368 | alc880_dac_to_idx( |
| 16369 | spec->multiout.dac_nids[i])); |
| 16370 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16371 | alc880_dac_to_idx( |
| 16372 | spec->multiout.dac_nids[i])); |
| 16373 | |
| 16374 | if (i == 2) { |
| 16375 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16376 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16377 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16378 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16379 | HDA_OUTPUT)); |
| 16380 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16381 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16382 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16383 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16384 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16385 | HDA_OUTPUT)); |
| 16386 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16387 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16388 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16389 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16390 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16391 | HDA_INPUT)); |
| 16392 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16393 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16394 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16395 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16396 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16397 | HDA_INPUT)); |
| 16398 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16399 | return err; |
| 16400 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16401 | const char *pfx; |
| 16402 | if (cfg->line_outs == 1 && |
| 16403 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16404 | if (!cfg->hp_pins) |
| 16405 | pfx = "Speaker"; |
| 16406 | else |
| 16407 | pfx = "PCM"; |
| 16408 | } else |
| 16409 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16410 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16411 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16412 | HDA_OUTPUT)); |
| 16413 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16414 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16415 | if (cfg->line_outs == 1 && |
| 16416 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16417 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16418 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16419 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16420 | HDA_INPUT)); |
| 16421 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16422 | return err; |
| 16423 | } |
| 16424 | } |
| 16425 | return 0; |
| 16426 | } |
| 16427 | |
| 16428 | /* add playback controls for speaker and HP outputs */ |
| 16429 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16430 | * different NIDs for mute/unmute switch and volume control */ |
| 16431 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16432 | hda_nid_t pin, const char *pfx) |
| 16433 | { |
| 16434 | hda_nid_t nid_v, nid_s; |
| 16435 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16436 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16437 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16438 | return 0; |
| 16439 | |
| 16440 | if (alc880_is_fixed_pin(pin)) { |
| 16441 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16442 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16443 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16444 | spec->multiout.hp_nid = nid_v; |
| 16445 | else |
| 16446 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16447 | /* control HP volume/switch on the output mixer amp */ |
| 16448 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16449 | alc880_fixed_pin_idx(pin)); |
| 16450 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16451 | alc880_fixed_pin_idx(pin)); |
| 16452 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16453 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16454 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16455 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16456 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16457 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16458 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16459 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16460 | return err; |
| 16461 | } else if (alc880_is_multi_pin(pin)) { |
| 16462 | /* set manual connection */ |
| 16463 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16464 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16465 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16466 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16467 | return err; |
| 16468 | } |
| 16469 | return 0; |
| 16470 | } |
| 16471 | |
| 16472 | /* parse the BIOS configuration and set up the alc_spec |
| 16473 | * return 1 if successful, 0 if the proper config is not found, |
| 16474 | * or a negative error code |
| 16475 | * Based on ALC880 version - had to change it to override |
| 16476 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16477 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16478 | { |
| 16479 | struct alc_spec *spec = codec->spec; |
| 16480 | int err; |
| 16481 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16482 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16483 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16484 | alc861vd_ignore); |
| 16485 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16486 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16487 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16488 | return 0; /* can't find valid BIOS pin config */ |
| 16489 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16490 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16491 | if (err < 0) |
| 16492 | return err; |
| 16493 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16494 | if (err < 0) |
| 16495 | return err; |
| 16496 | err = alc861vd_auto_create_extra_out(spec, |
| 16497 | spec->autocfg.speaker_pins[0], |
| 16498 | "Speaker"); |
| 16499 | if (err < 0) |
| 16500 | return err; |
| 16501 | err = alc861vd_auto_create_extra_out(spec, |
| 16502 | spec->autocfg.hp_pins[0], |
| 16503 | "Headphone"); |
| 16504 | if (err < 0) |
| 16505 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16506 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16507 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16508 | return err; |
| 16509 | |
| 16510 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16511 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16512 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16513 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16514 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16515 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16516 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16517 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16518 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16519 | |
| 16520 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16521 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16522 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16523 | err = alc_auto_add_mic_boost(codec); |
| 16524 | if (err < 0) |
| 16525 | return err; |
| 16526 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16527 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16528 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16529 | return 1; |
| 16530 | } |
| 16531 | |
| 16532 | /* additional initialization for auto-configuration model */ |
| 16533 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16534 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16535 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16536 | alc861vd_auto_init_multi_out(codec); |
| 16537 | alc861vd_auto_init_hp_out(codec); |
| 16538 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16539 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16540 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16541 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16542 | } |
| 16543 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16544 | enum { |
| 16545 | ALC660VD_FIX_ASUS_GPIO1 |
| 16546 | }; |
| 16547 | |
| 16548 | /* reset GPIO1 */ |
| 16549 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16550 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16551 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16552 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16553 | { } |
| 16554 | }; |
| 16555 | |
| 16556 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16557 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16558 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16559 | }, |
| 16560 | }; |
| 16561 | |
| 16562 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16563 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16564 | {} |
| 16565 | }; |
| 16566 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16567 | static int patch_alc861vd(struct hda_codec *codec) |
| 16568 | { |
| 16569 | struct alc_spec *spec; |
| 16570 | int err, board_config; |
| 16571 | |
| 16572 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16573 | if (spec == NULL) |
| 16574 | return -ENOMEM; |
| 16575 | |
| 16576 | codec->spec = spec; |
| 16577 | |
| 16578 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16579 | alc861vd_models, |
| 16580 | alc861vd_cfg_tbl); |
| 16581 | |
| 16582 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16583 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16584 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16585 | board_config = ALC861VD_AUTO; |
| 16586 | } |
| 16587 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16588 | if (board_config == ALC861VD_AUTO) |
| 16589 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16590 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16591 | if (board_config == ALC861VD_AUTO) { |
| 16592 | /* automatic parse from the BIOS config */ |
| 16593 | err = alc861vd_parse_auto_config(codec); |
| 16594 | if (err < 0) { |
| 16595 | alc_free(codec); |
| 16596 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16597 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16598 | printk(KERN_INFO |
| 16599 | "hda_codec: Cannot set up configuration " |
| 16600 | "from BIOS. Using base mode...\n"); |
| 16601 | board_config = ALC861VD_3ST; |
| 16602 | } |
| 16603 | } |
| 16604 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16605 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16606 | if (err < 0) { |
| 16607 | alc_free(codec); |
| 16608 | return err; |
| 16609 | } |
| 16610 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16611 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16612 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16613 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16614 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16615 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16616 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16617 | } |
| 16618 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16619 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16620 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16621 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16622 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16623 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16624 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16625 | if (!spec->adc_nids) { |
| 16626 | spec->adc_nids = alc861vd_adc_nids; |
| 16627 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16628 | } |
| 16629 | if (!spec->capsrc_nids) |
| 16630 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16631 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16632 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16633 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16634 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16635 | spec->vmaster_nid = 0x02; |
| 16636 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16637 | if (board_config == ALC861VD_AUTO) |
| 16638 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16639 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16640 | codec->patch_ops = alc_patch_ops; |
| 16641 | |
| 16642 | if (board_config == ALC861VD_AUTO) |
| 16643 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16644 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16645 | if (!spec->loopback.amplist) |
| 16646 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16647 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16648 | |
| 16649 | return 0; |
| 16650 | } |
| 16651 | |
| 16652 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16653 | * ALC662 support |
| 16654 | * |
| 16655 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16656 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16657 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16658 | * 6-channel independent captures. |
| 16659 | * |
| 16660 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16661 | * driver yet). |
| 16662 | */ |
| 16663 | #define ALC662_DIGOUT_NID 0x06 |
| 16664 | #define ALC662_DIGIN_NID 0x0a |
| 16665 | |
| 16666 | static hda_nid_t alc662_dac_nids[4] = { |
| 16667 | /* front, rear, clfe, rear_surr */ |
| 16668 | 0x02, 0x03, 0x04 |
| 16669 | }; |
| 16670 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16671 | static hda_nid_t alc272_dac_nids[2] = { |
| 16672 | 0x02, 0x03 |
| 16673 | }; |
| 16674 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16675 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16676 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16677 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16678 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16679 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16680 | static hda_nid_t alc272_adc_nids[1] = { |
| 16681 | /* ADC1-2 */ |
| 16682 | 0x08, |
| 16683 | }; |
| 16684 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16685 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16686 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16687 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16688 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16689 | /* input MUX */ |
| 16690 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16691 | static struct hda_input_mux alc662_capture_source = { |
| 16692 | .num_items = 4, |
| 16693 | .items = { |
| 16694 | { "Mic", 0x0 }, |
| 16695 | { "Front Mic", 0x1 }, |
| 16696 | { "Line", 0x2 }, |
| 16697 | { "CD", 0x4 }, |
| 16698 | }, |
| 16699 | }; |
| 16700 | |
| 16701 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16702 | .num_items = 2, |
| 16703 | .items = { |
| 16704 | { "Mic", 0x1 }, |
| 16705 | { "Line", 0x2 }, |
| 16706 | }, |
| 16707 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16708 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16709 | static struct hda_input_mux alc663_capture_source = { |
| 16710 | .num_items = 3, |
| 16711 | .items = { |
| 16712 | { "Mic", 0x0 }, |
| 16713 | { "Front Mic", 0x1 }, |
| 16714 | { "Line", 0x2 }, |
| 16715 | }, |
| 16716 | }; |
| 16717 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16718 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16719 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16720 | .num_items = 16, |
| 16721 | .items = { |
| 16722 | { "Autoselect Mic", 0x0 }, |
| 16723 | { "Internal Mic", 0x1 }, |
| 16724 | { "In-0x02", 0x2 }, |
| 16725 | { "In-0x03", 0x3 }, |
| 16726 | { "In-0x04", 0x4 }, |
| 16727 | { "In-0x05", 0x5 }, |
| 16728 | { "In-0x06", 0x6 }, |
| 16729 | { "In-0x07", 0x7 }, |
| 16730 | { "In-0x08", 0x8 }, |
| 16731 | { "In-0x09", 0x9 }, |
| 16732 | { "In-0x0a", 0x0a }, |
| 16733 | { "In-0x0b", 0x0b }, |
| 16734 | { "In-0x0c", 0x0c }, |
| 16735 | { "In-0x0d", 0x0d }, |
| 16736 | { "In-0x0e", 0x0e }, |
| 16737 | { "In-0x0f", 0x0f }, |
| 16738 | }, |
| 16739 | }; |
| 16740 | #endif |
| 16741 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16742 | /* |
| 16743 | * 2ch mode |
| 16744 | */ |
| 16745 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16746 | { 2, NULL } |
| 16747 | }; |
| 16748 | |
| 16749 | /* |
| 16750 | * 2ch mode |
| 16751 | */ |
| 16752 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16753 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16754 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16755 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16756 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16757 | { } /* end */ |
| 16758 | }; |
| 16759 | |
| 16760 | /* |
| 16761 | * 6ch mode |
| 16762 | */ |
| 16763 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16764 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16765 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16766 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16767 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16768 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16769 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16770 | { } /* end */ |
| 16771 | }; |
| 16772 | |
| 16773 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16774 | { 2, alc662_3ST_ch2_init }, |
| 16775 | { 6, alc662_3ST_ch6_init }, |
| 16776 | }; |
| 16777 | |
| 16778 | /* |
| 16779 | * 2ch mode |
| 16780 | */ |
| 16781 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16782 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16783 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16784 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16785 | { } /* end */ |
| 16786 | }; |
| 16787 | |
| 16788 | /* |
| 16789 | * 6ch mode |
| 16790 | */ |
| 16791 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16792 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16793 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16794 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16795 | { } /* end */ |
| 16796 | }; |
| 16797 | |
| 16798 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16799 | { 2, alc662_sixstack_ch6_init }, |
| 16800 | { 6, alc662_sixstack_ch8_init }, |
| 16801 | }; |
| 16802 | |
| 16803 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16804 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16805 | */ |
| 16806 | |
| 16807 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16808 | /* output mixer control */ |
| 16809 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16810 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16811 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16812 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16813 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16814 | 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] | 16815 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16816 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16818 | |
| 16819 | /*Input mixer control */ |
| 16820 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16821 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16822 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16823 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16824 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16825 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16828 | { } /* end */ |
| 16829 | }; |
| 16830 | |
| 16831 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16833 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16834 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16835 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16836 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16837 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16838 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16839 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16840 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16841 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16843 | { } /* end */ |
| 16844 | }; |
| 16845 | |
| 16846 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16847 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16848 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16849 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16850 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16851 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16852 | 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] | 16853 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16854 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16855 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16858 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16859 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16861 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16862 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16864 | { } /* end */ |
| 16865 | }; |
| 16866 | |
| 16867 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16868 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16869 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16870 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16871 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16872 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16874 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16877 | { } /* end */ |
| 16878 | }; |
| 16879 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16880 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16881 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16882 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16883 | |
| 16884 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16885 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16886 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16887 | |
| 16888 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16889 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16890 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16891 | { } /* end */ |
| 16892 | }; |
| 16893 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16894 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16895 | ALC262_HIPPO_MASTER_SWITCH, |
| 16896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16897 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16898 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16899 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16900 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16901 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16902 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16904 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16905 | { } /* end */ |
| 16906 | }; |
| 16907 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16908 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16909 | .ops = &snd_hda_bind_vol, |
| 16910 | .values = { |
| 16911 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16912 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16913 | 0 |
| 16914 | }, |
| 16915 | }; |
| 16916 | |
| 16917 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16918 | .ops = &snd_hda_bind_sw, |
| 16919 | .values = { |
| 16920 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16921 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16922 | 0 |
| 16923 | }, |
| 16924 | }; |
| 16925 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16926 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16927 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16928 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16929 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16930 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16931 | { } /* end */ |
| 16932 | }; |
| 16933 | |
| 16934 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16935 | .ops = &snd_hda_bind_sw, |
| 16936 | .values = { |
| 16937 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16938 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16939 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16940 | 0 |
| 16941 | }, |
| 16942 | }; |
| 16943 | |
| 16944 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16945 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16946 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16947 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16948 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16949 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16950 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16951 | |
| 16952 | { } /* end */ |
| 16953 | }; |
| 16954 | |
| 16955 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16956 | .ops = &snd_hda_bind_sw, |
| 16957 | .values = { |
| 16958 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16959 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16960 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16961 | 0 |
| 16962 | }, |
| 16963 | }; |
| 16964 | |
| 16965 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16966 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16967 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16968 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16969 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16970 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16971 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16972 | { } /* end */ |
| 16973 | }; |
| 16974 | |
| 16975 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16976 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16977 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16981 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16982 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16983 | { } /* end */ |
| 16984 | }; |
| 16985 | |
| 16986 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16987 | .ops = &snd_hda_bind_vol, |
| 16988 | .values = { |
| 16989 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16990 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16991 | 0 |
| 16992 | }, |
| 16993 | }; |
| 16994 | |
| 16995 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16996 | .ops = &snd_hda_bind_sw, |
| 16997 | .values = { |
| 16998 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16999 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17000 | 0 |
| 17001 | }, |
| 17002 | }; |
| 17003 | |
| 17004 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17005 | HDA_BIND_VOL("Master Playback Volume", |
| 17006 | &alc663_asus_two_bind_master_vol), |
| 17007 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17008 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17010 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17011 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17012 | { } /* end */ |
| 17013 | }; |
| 17014 | |
| 17015 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17016 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17017 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17018 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17019 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17020 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17021 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17022 | { } /* end */ |
| 17023 | }; |
| 17024 | |
| 17025 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17026 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17027 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17028 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17029 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17030 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17031 | |
| 17032 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17033 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17034 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17035 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17036 | { } /* end */ |
| 17037 | }; |
| 17038 | |
| 17039 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17040 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17041 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17042 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17043 | |
| 17044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17045 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17046 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17047 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17050 | { } /* end */ |
| 17051 | }; |
| 17052 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17053 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17054 | .ops = &snd_hda_bind_sw, |
| 17055 | .values = { |
| 17056 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17057 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17058 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17059 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17060 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17061 | 0 |
| 17062 | }, |
| 17063 | }; |
| 17064 | |
| 17065 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17066 | .ops = &snd_hda_bind_sw, |
| 17067 | .values = { |
| 17068 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17069 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17070 | 0 |
| 17071 | }, |
| 17072 | }; |
| 17073 | |
| 17074 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17075 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17076 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17077 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17078 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17079 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17080 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17081 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17082 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17084 | { } /* end */ |
| 17085 | }; |
| 17086 | |
| 17087 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17088 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17089 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17090 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17091 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17092 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17095 | { } /* end */ |
| 17096 | }; |
| 17097 | |
| 17098 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17099 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17100 | { |
| 17101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17102 | .name = "Channel Mode", |
| 17103 | .info = alc_ch_mode_info, |
| 17104 | .get = alc_ch_mode_get, |
| 17105 | .put = alc_ch_mode_put, |
| 17106 | }, |
| 17107 | { } /* end */ |
| 17108 | }; |
| 17109 | |
| 17110 | static struct hda_verb alc662_init_verbs[] = { |
| 17111 | /* ADC: mute amp left and right */ |
| 17112 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17113 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17114 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17121 | |
| 17122 | /* Front Pin: output 0 (0x0c) */ |
| 17123 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17124 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17125 | |
| 17126 | /* Rear Pin: output 1 (0x0d) */ |
| 17127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17128 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17129 | |
| 17130 | /* CLFE Pin: output 2 (0x0e) */ |
| 17131 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17132 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17133 | |
| 17134 | /* Mic (rear) pin: input vref at 80% */ |
| 17135 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17137 | /* Front Mic pin: input vref at 80% */ |
| 17138 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17140 | /* Line In pin: input */ |
| 17141 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17143 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17144 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17146 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17147 | /* CD pin widget for input */ |
| 17148 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17149 | |
| 17150 | /* FIXME: use matrix-type input source selection */ |
| 17151 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17152 | /* Input mixer */ |
| 17153 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17154 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17155 | |
| 17156 | /* always trun on EAPD */ |
| 17157 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17158 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17159 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17160 | { } |
| 17161 | }; |
| 17162 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17163 | static struct hda_verb alc663_init_verbs[] = { |
| 17164 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17165 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17166 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17167 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17168 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17169 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17170 | { } |
| 17171 | }; |
| 17172 | |
| 17173 | static struct hda_verb alc272_init_verbs[] = { |
| 17174 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17175 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17176 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17177 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17178 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17179 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17180 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17181 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17182 | { } |
| 17183 | }; |
| 17184 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17185 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17186 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17187 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17188 | {} |
| 17189 | }; |
| 17190 | |
| 17191 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17192 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17193 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17194 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17195 | }; |
| 17196 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17197 | /* Set Unsolicited Event*/ |
| 17198 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17199 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17200 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17201 | {} |
| 17202 | }; |
| 17203 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17204 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17205 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17206 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17207 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17208 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17209 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17210 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17211 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17212 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17213 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17214 | {} |
| 17215 | }; |
| 17216 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17217 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17218 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17219 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17220 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17221 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17222 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17223 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17224 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17225 | {} |
| 17226 | }; |
| 17227 | |
| 17228 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17229 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17230 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17231 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17232 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17233 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17235 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17236 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17237 | {} |
| 17238 | }; |
| 17239 | |
| 17240 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17241 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17242 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17243 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17244 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17245 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17246 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17247 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17248 | {} |
| 17249 | }; |
| 17250 | |
| 17251 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17252 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17253 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17254 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17255 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17258 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17259 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17260 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17261 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17262 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17263 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17264 | {} |
| 17265 | }; |
| 17266 | |
| 17267 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17268 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17269 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17270 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17271 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17272 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17273 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17274 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17275 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17276 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17277 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17278 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17279 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17280 | {} |
| 17281 | }; |
| 17282 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17283 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17284 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17285 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17286 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17287 | |
| 17288 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17289 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17290 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17291 | |
| 17292 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17293 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17294 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17295 | {} |
| 17296 | }; |
| 17297 | |
| 17298 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17299 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17300 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17301 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17302 | |
| 17303 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17304 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17305 | {} |
| 17306 | }; |
| 17307 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17308 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17309 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17310 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17311 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17312 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17313 | {} |
| 17314 | }; |
| 17315 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17316 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17317 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17318 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17319 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17320 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17321 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17322 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17323 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17324 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17325 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17326 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17327 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17328 | {} |
| 17329 | }; |
| 17330 | |
| 17331 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17332 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17333 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17334 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17335 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17336 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17337 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17338 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17339 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17340 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17341 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17342 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17343 | {} |
| 17344 | }; |
| 17345 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17346 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17348 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17349 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17350 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17351 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17352 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17353 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17354 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17355 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17356 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17357 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17359 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17360 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17361 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17362 | {} |
| 17363 | }; |
| 17364 | |
| 17365 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17366 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17367 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17368 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17369 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17370 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17371 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17372 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17373 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17374 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17375 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17376 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17377 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17378 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17379 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17380 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17381 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17382 | {} |
| 17383 | }; |
| 17384 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17385 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17386 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17387 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17388 | { } /* end */ |
| 17389 | }; |
| 17390 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17391 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17392 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17393 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17394 | { } /* end */ |
| 17395 | }; |
| 17396 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17397 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17398 | { |
| 17399 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17400 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17401 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17402 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17403 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17404 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17405 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17406 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17407 | } |
| 17408 | |
| 17409 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17410 | { |
| 17411 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17412 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17413 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17414 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17415 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17416 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17417 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17418 | HDA_AMP_MUTE, bits); |
| 17419 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17420 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17421 | } |
| 17422 | |
| 17423 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17424 | unsigned int res) |
| 17425 | { |
| 17426 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17427 | alc662_lenovo_101e_all_automute(codec); |
| 17428 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17429 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17430 | } |
| 17431 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17432 | /* unsolicited event for HP jack sensing */ |
| 17433 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17434 | unsigned int res) |
| 17435 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17436 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17437 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17438 | else |
| 17439 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17440 | } |
| 17441 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17442 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17443 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17444 | struct alc_spec *spec = codec->spec; |
| 17445 | |
| 17446 | alc262_hippo1_setup(codec); |
| 17447 | spec->ext_mic.pin = 0x18; |
| 17448 | spec->ext_mic.mux_idx = 0; |
| 17449 | spec->int_mic.pin = 0x19; |
| 17450 | spec->int_mic.mux_idx = 1; |
| 17451 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17452 | } |
| 17453 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17454 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17455 | { |
| 17456 | alc262_hippo_automute(codec); |
| 17457 | alc_mic_automute(codec); |
| 17458 | } |
| 17459 | |
| 17460 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17461 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17462 | struct alc_spec *spec = codec->spec; |
| 17463 | |
| 17464 | spec->autocfg.hp_pins[0] = 0x14; |
| 17465 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17466 | } |
| 17467 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17468 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17469 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17470 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17471 | { |
| 17472 | unsigned int present; |
| 17473 | unsigned char bits; |
| 17474 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17475 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17476 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17477 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17478 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17479 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17480 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17481 | } |
| 17482 | |
| 17483 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17484 | { |
| 17485 | unsigned int present; |
| 17486 | unsigned char bits; |
| 17487 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17488 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17489 | bits = present ? HDA_AMP_MUTE : 0; |
| 17490 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17491 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17492 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17493 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17494 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17495 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17496 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17497 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17498 | } |
| 17499 | |
| 17500 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17501 | { |
| 17502 | unsigned int present; |
| 17503 | unsigned char bits; |
| 17504 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17505 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17506 | bits = present ? HDA_AMP_MUTE : 0; |
| 17507 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17508 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17509 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17510 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17511 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17512 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17513 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17514 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17515 | } |
| 17516 | |
| 17517 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17518 | { |
| 17519 | unsigned int present; |
| 17520 | unsigned char bits; |
| 17521 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17522 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17523 | bits = present ? 0 : PIN_OUT; |
| 17524 | snd_hda_codec_write(codec, 0x14, 0, |
| 17525 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17526 | } |
| 17527 | |
| 17528 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17529 | { |
| 17530 | unsigned int present1, present2; |
| 17531 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17532 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17533 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17534 | |
| 17535 | if (present1 || present2) { |
| 17536 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17537 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17538 | } else { |
| 17539 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17540 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17541 | } |
| 17542 | } |
| 17543 | |
| 17544 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17545 | { |
| 17546 | unsigned int present1, present2; |
| 17547 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17548 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17549 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17550 | |
| 17551 | if (present1 || present2) { |
| 17552 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17553 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17554 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17555 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17556 | } else { |
| 17557 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17558 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17559 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17560 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17561 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17562 | } |
| 17563 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17564 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17565 | { |
| 17566 | unsigned int present1, present2; |
| 17567 | |
| 17568 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17569 | AC_VERB_GET_PIN_SENSE, 0) |
| 17570 | & AC_PINSENSE_PRESENCE; |
| 17571 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17572 | AC_VERB_GET_PIN_SENSE, 0) |
| 17573 | & AC_PINSENSE_PRESENCE; |
| 17574 | |
| 17575 | if (present1 || present2) { |
| 17576 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17577 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17578 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17579 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17580 | } else { |
| 17581 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17582 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17583 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17584 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17585 | } |
| 17586 | } |
| 17587 | |
| 17588 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17589 | { |
| 17590 | unsigned int present1, present2; |
| 17591 | |
| 17592 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17593 | AC_VERB_GET_PIN_SENSE, 0) |
| 17594 | & AC_PINSENSE_PRESENCE; |
| 17595 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17596 | AC_VERB_GET_PIN_SENSE, 0) |
| 17597 | & AC_PINSENSE_PRESENCE; |
| 17598 | |
| 17599 | if (present1 || present2) { |
| 17600 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17601 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17602 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17603 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17604 | } else { |
| 17605 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17606 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17607 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17608 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17609 | } |
| 17610 | } |
| 17611 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17612 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17613 | unsigned int res) |
| 17614 | { |
| 17615 | switch (res >> 26) { |
| 17616 | case ALC880_HP_EVENT: |
| 17617 | alc663_m51va_speaker_automute(codec); |
| 17618 | break; |
| 17619 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17620 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17621 | break; |
| 17622 | } |
| 17623 | } |
| 17624 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17625 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17626 | { |
| 17627 | struct alc_spec *spec = codec->spec; |
| 17628 | spec->ext_mic.pin = 0x18; |
| 17629 | spec->ext_mic.mux_idx = 0; |
| 17630 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17631 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17632 | spec->auto_mic = 1; |
| 17633 | } |
| 17634 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17635 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17636 | { |
| 17637 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17638 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17639 | } |
| 17640 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17641 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17642 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17643 | |
| 17644 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17645 | { |
| 17646 | struct alc_spec *spec = codec->spec; |
| 17647 | spec->ext_mic.pin = 0x18; |
| 17648 | spec->ext_mic.mux_idx = 0; |
| 17649 | spec->int_mic.pin = 0x19; |
| 17650 | spec->int_mic.mux_idx = 1; |
| 17651 | spec->auto_mic = 1; |
| 17652 | } |
| 17653 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17654 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17655 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17656 | /* ***************** Mode2 ******************************/ |
| 17657 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17658 | unsigned int res) |
| 17659 | { |
| 17660 | switch (res >> 26) { |
| 17661 | case ALC880_HP_EVENT: |
| 17662 | alc662_f5z_speaker_automute(codec); |
| 17663 | break; |
| 17664 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17665 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17666 | break; |
| 17667 | } |
| 17668 | } |
| 17669 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17670 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17671 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17672 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17673 | { |
| 17674 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17675 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17676 | } |
| 17677 | /* ***************** Mode3 ******************************/ |
| 17678 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17679 | unsigned int res) |
| 17680 | { |
| 17681 | switch (res >> 26) { |
| 17682 | case ALC880_HP_EVENT: |
| 17683 | alc663_two_hp_m1_speaker_automute(codec); |
| 17684 | break; |
| 17685 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17686 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17687 | break; |
| 17688 | } |
| 17689 | } |
| 17690 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17691 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17692 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17693 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17694 | { |
| 17695 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17696 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17697 | } |
| 17698 | /* ***************** Mode4 ******************************/ |
| 17699 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17700 | unsigned int res) |
| 17701 | { |
| 17702 | switch (res >> 26) { |
| 17703 | case ALC880_HP_EVENT: |
| 17704 | alc663_21jd_two_speaker_automute(codec); |
| 17705 | break; |
| 17706 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17707 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17708 | break; |
| 17709 | } |
| 17710 | } |
| 17711 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17712 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17713 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17714 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17715 | { |
| 17716 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17717 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17718 | } |
| 17719 | /* ***************** Mode5 ******************************/ |
| 17720 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17721 | unsigned int res) |
| 17722 | { |
| 17723 | switch (res >> 26) { |
| 17724 | case ALC880_HP_EVENT: |
| 17725 | alc663_15jd_two_speaker_automute(codec); |
| 17726 | break; |
| 17727 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17728 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17729 | break; |
| 17730 | } |
| 17731 | } |
| 17732 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17733 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17734 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17735 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17736 | { |
| 17737 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17738 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17739 | } |
| 17740 | /* ***************** Mode6 ******************************/ |
| 17741 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17742 | unsigned int res) |
| 17743 | { |
| 17744 | switch (res >> 26) { |
| 17745 | case ALC880_HP_EVENT: |
| 17746 | alc663_two_hp_m2_speaker_automute(codec); |
| 17747 | break; |
| 17748 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17749 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17750 | break; |
| 17751 | } |
| 17752 | } |
| 17753 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17754 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17755 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17756 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17757 | { |
| 17758 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17759 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17760 | } |
| 17761 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17762 | /* ***************** Mode7 ******************************/ |
| 17763 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17764 | unsigned int res) |
| 17765 | { |
| 17766 | switch (res >> 26) { |
| 17767 | case ALC880_HP_EVENT: |
| 17768 | alc663_two_hp_m7_speaker_automute(codec); |
| 17769 | break; |
| 17770 | case ALC880_MIC_EVENT: |
| 17771 | alc_mic_automute(codec); |
| 17772 | break; |
| 17773 | } |
| 17774 | } |
| 17775 | |
| 17776 | #define alc663_mode7_setup alc663_mode1_setup |
| 17777 | |
| 17778 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17779 | { |
| 17780 | alc663_two_hp_m7_speaker_automute(codec); |
| 17781 | alc_mic_automute(codec); |
| 17782 | } |
| 17783 | |
| 17784 | /* ***************** Mode8 ******************************/ |
| 17785 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17786 | unsigned int res) |
| 17787 | { |
| 17788 | switch (res >> 26) { |
| 17789 | case ALC880_HP_EVENT: |
| 17790 | alc663_two_hp_m8_speaker_automute(codec); |
| 17791 | break; |
| 17792 | case ALC880_MIC_EVENT: |
| 17793 | alc_mic_automute(codec); |
| 17794 | break; |
| 17795 | } |
| 17796 | } |
| 17797 | |
| 17798 | #define alc663_mode8_setup alc663_m51va_setup |
| 17799 | |
| 17800 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17801 | { |
| 17802 | alc663_two_hp_m8_speaker_automute(codec); |
| 17803 | alc_mic_automute(codec); |
| 17804 | } |
| 17805 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17806 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17807 | { |
| 17808 | unsigned int present; |
| 17809 | unsigned char bits; |
| 17810 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17811 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17812 | bits = present ? HDA_AMP_MUTE : 0; |
| 17813 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17814 | HDA_AMP_MUTE, bits); |
| 17815 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17816 | HDA_AMP_MUTE, bits); |
| 17817 | } |
| 17818 | |
| 17819 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17820 | { |
| 17821 | unsigned int present; |
| 17822 | unsigned char bits; |
| 17823 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17824 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17825 | bits = present ? HDA_AMP_MUTE : 0; |
| 17826 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17827 | HDA_AMP_MUTE, bits); |
| 17828 | } |
| 17829 | |
| 17830 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17831 | unsigned int res) |
| 17832 | { |
| 17833 | switch (res >> 26) { |
| 17834 | case ALC880_HP_EVENT: |
| 17835 | alc663_g71v_hp_automute(codec); |
| 17836 | break; |
| 17837 | case ALC880_FRONT_EVENT: |
| 17838 | alc663_g71v_front_automute(codec); |
| 17839 | break; |
| 17840 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17841 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17842 | break; |
| 17843 | } |
| 17844 | } |
| 17845 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17846 | #define alc663_g71v_setup alc663_m51va_setup |
| 17847 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17848 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17849 | { |
| 17850 | alc663_g71v_front_automute(codec); |
| 17851 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17852 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17853 | } |
| 17854 | |
| 17855 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17856 | unsigned int res) |
| 17857 | { |
| 17858 | switch (res >> 26) { |
| 17859 | case ALC880_HP_EVENT: |
| 17860 | alc663_m51va_speaker_automute(codec); |
| 17861 | break; |
| 17862 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17863 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17864 | break; |
| 17865 | } |
| 17866 | } |
| 17867 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17868 | #define alc663_g50v_setup alc663_m51va_setup |
| 17869 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17870 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17871 | { |
| 17872 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17873 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17874 | } |
| 17875 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17876 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17877 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17878 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17879 | |
| 17880 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17881 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17882 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17883 | |
| 17884 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17885 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17886 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17887 | { } /* end */ |
| 17888 | }; |
| 17889 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17890 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17891 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17892 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17893 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17894 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17896 | |
| 17897 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17898 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17899 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17900 | |
| 17901 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17902 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17903 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17904 | { } /* end */ |
| 17905 | }; |
| 17906 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17907 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17908 | #define alc662_loopbacks alc880_loopbacks |
| 17909 | #endif |
| 17910 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17911 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17912 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17913 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17914 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17915 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17916 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17917 | |
| 17918 | /* |
| 17919 | * configuration and preset |
| 17920 | */ |
| 17921 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17922 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17923 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17924 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17925 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17926 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17927 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17928 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17929 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17930 | [ALC663_ASUS_M51VA] = "m51va", |
| 17931 | [ALC663_ASUS_G71V] = "g71v", |
| 17932 | [ALC663_ASUS_H13] = "h13", |
| 17933 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17934 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17935 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17936 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17937 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17938 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17939 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17940 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17941 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17942 | [ALC272_DELL] = "dell", |
| 17943 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17944 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17945 | [ALC662_AUTO] = "auto", |
| 17946 | }; |
| 17947 | |
| 17948 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17949 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17950 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17951 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17952 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17953 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17954 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17955 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17956 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17957 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17958 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17959 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17960 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17961 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17962 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17963 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17964 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17965 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17966 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17967 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17968 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17969 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17970 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17971 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17972 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17973 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17974 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17975 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17976 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17977 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17978 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17979 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17980 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17981 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17982 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17983 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17984 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17985 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17986 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17987 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17988 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17989 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17990 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17991 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17992 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17993 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17994 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17995 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17996 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17997 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17998 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17999 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18000 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18001 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18002 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18003 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18004 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18005 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18006 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18007 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18008 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18009 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18010 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18011 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18012 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18013 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18014 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18015 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18016 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18017 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18018 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18019 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18020 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18021 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18022 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18023 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18024 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18025 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18026 | {} |
| 18027 | }; |
| 18028 | |
| 18029 | static struct alc_config_preset alc662_presets[] = { |
| 18030 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18031 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18032 | .init_verbs = { alc662_init_verbs }, |
| 18033 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18034 | .dac_nids = alc662_dac_nids, |
| 18035 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18036 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18037 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18038 | .channel_mode = alc662_3ST_2ch_modes, |
| 18039 | .input_mux = &alc662_capture_source, |
| 18040 | }, |
| 18041 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18042 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18043 | .init_verbs = { alc662_init_verbs }, |
| 18044 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18045 | .dac_nids = alc662_dac_nids, |
| 18046 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18047 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18048 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18049 | .channel_mode = alc662_3ST_6ch_modes, |
| 18050 | .need_dac_fix = 1, |
| 18051 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18052 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18053 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18054 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18055 | .init_verbs = { alc662_init_verbs }, |
| 18056 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18057 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18058 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18059 | .channel_mode = alc662_3ST_6ch_modes, |
| 18060 | .need_dac_fix = 1, |
| 18061 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18062 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18063 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18064 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18065 | .init_verbs = { alc662_init_verbs }, |
| 18066 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18067 | .dac_nids = alc662_dac_nids, |
| 18068 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18069 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18070 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18071 | .channel_mode = alc662_5stack_modes, |
| 18072 | .input_mux = &alc662_capture_source, |
| 18073 | }, |
| 18074 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18075 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18076 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18077 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18078 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18079 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18080 | .channel_mode = alc662_3ST_2ch_modes, |
| 18081 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18082 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18083 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18084 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18085 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18086 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18087 | .init_verbs = { alc662_init_verbs, |
| 18088 | alc662_eeepc_sue_init_verbs }, |
| 18089 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18090 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18091 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18092 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18093 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18094 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18095 | .init_hook = alc662_eeepc_inithook, |
| 18096 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18097 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18098 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18099 | alc662_chmode_mixer }, |
| 18100 | .init_verbs = { alc662_init_verbs, |
| 18101 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18102 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18103 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18104 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18105 | .channel_mode = alc662_3ST_6ch_modes, |
| 18106 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18107 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18108 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18109 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18110 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18111 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18112 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18113 | .init_verbs = { alc662_init_verbs, |
| 18114 | alc662_ecs_init_verbs }, |
| 18115 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18116 | .dac_nids = alc662_dac_nids, |
| 18117 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18118 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18119 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18120 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18121 | .init_hook = alc662_eeepc_inithook, |
| 18122 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18123 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18124 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18125 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18126 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18127 | .dac_nids = alc662_dac_nids, |
| 18128 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18129 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18130 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18131 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18132 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18133 | .init_hook = alc663_m51va_inithook, |
| 18134 | }, |
| 18135 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18136 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18137 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18138 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18139 | .dac_nids = alc662_dac_nids, |
| 18140 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18141 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18142 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18143 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18144 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18145 | .init_hook = alc663_g71v_inithook, |
| 18146 | }, |
| 18147 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18148 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18149 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18150 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18151 | .dac_nids = alc662_dac_nids, |
| 18152 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18153 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18154 | .unsol_event = alc663_m51va_unsol_event, |
| 18155 | .init_hook = alc663_m51va_inithook, |
| 18156 | }, |
| 18157 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18158 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18159 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18160 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18161 | .dac_nids = alc662_dac_nids, |
| 18162 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18163 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18164 | .channel_mode = alc662_3ST_6ch_modes, |
| 18165 | .input_mux = &alc663_capture_source, |
| 18166 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18167 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18168 | .init_hook = alc663_g50v_inithook, |
| 18169 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18170 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18171 | .mixers = { alc663_m51va_mixer }, |
| 18172 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18173 | .init_verbs = { alc662_init_verbs, |
| 18174 | alc663_21jd_amic_init_verbs }, |
| 18175 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18176 | .hp_nid = 0x03, |
| 18177 | .dac_nids = alc662_dac_nids, |
| 18178 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18179 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18180 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18181 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18182 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18183 | .init_hook = alc663_mode1_inithook, |
| 18184 | }, |
| 18185 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18186 | .mixers = { alc662_1bjd_mixer }, |
| 18187 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18188 | .init_verbs = { alc662_init_verbs, |
| 18189 | alc662_1bjd_amic_init_verbs }, |
| 18190 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18191 | .dac_nids = alc662_dac_nids, |
| 18192 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18193 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18194 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18195 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18196 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18197 | .init_hook = alc662_mode2_inithook, |
| 18198 | }, |
| 18199 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18200 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18201 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18202 | .init_verbs = { alc662_init_verbs, |
| 18203 | alc663_two_hp_amic_m1_init_verbs }, |
| 18204 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18205 | .hp_nid = 0x03, |
| 18206 | .dac_nids = alc662_dac_nids, |
| 18207 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18208 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18209 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18210 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18211 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18212 | .init_hook = alc663_mode3_inithook, |
| 18213 | }, |
| 18214 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18215 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18216 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18217 | .init_verbs = { alc662_init_verbs, |
| 18218 | alc663_21jd_amic_init_verbs}, |
| 18219 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18220 | .hp_nid = 0x03, |
| 18221 | .dac_nids = alc662_dac_nids, |
| 18222 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18223 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18224 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18225 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18226 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18227 | .init_hook = alc663_mode4_inithook, |
| 18228 | }, |
| 18229 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18230 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18231 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18232 | .init_verbs = { alc662_init_verbs, |
| 18233 | alc663_15jd_amic_init_verbs }, |
| 18234 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18235 | .hp_nid = 0x03, |
| 18236 | .dac_nids = alc662_dac_nids, |
| 18237 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18238 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18239 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18240 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18241 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18242 | .init_hook = alc663_mode5_inithook, |
| 18243 | }, |
| 18244 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18245 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18246 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18247 | .init_verbs = { alc662_init_verbs, |
| 18248 | alc663_two_hp_amic_m2_init_verbs }, |
| 18249 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18250 | .hp_nid = 0x03, |
| 18251 | .dac_nids = alc662_dac_nids, |
| 18252 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18253 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18254 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18255 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18256 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18257 | .init_hook = alc663_mode6_inithook, |
| 18258 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18259 | [ALC663_ASUS_MODE7] = { |
| 18260 | .mixers = { alc663_mode7_mixer }, |
| 18261 | .cap_mixer = alc662_auto_capture_mixer, |
| 18262 | .init_verbs = { alc662_init_verbs, |
| 18263 | alc663_mode7_init_verbs }, |
| 18264 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18265 | .hp_nid = 0x03, |
| 18266 | .dac_nids = alc662_dac_nids, |
| 18267 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18268 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18269 | .channel_mode = alc662_3ST_2ch_modes, |
| 18270 | .unsol_event = alc663_mode7_unsol_event, |
| 18271 | .setup = alc663_mode7_setup, |
| 18272 | .init_hook = alc663_mode7_inithook, |
| 18273 | }, |
| 18274 | [ALC663_ASUS_MODE8] = { |
| 18275 | .mixers = { alc663_mode8_mixer }, |
| 18276 | .cap_mixer = alc662_auto_capture_mixer, |
| 18277 | .init_verbs = { alc662_init_verbs, |
| 18278 | alc663_mode8_init_verbs }, |
| 18279 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18280 | .hp_nid = 0x03, |
| 18281 | .dac_nids = alc662_dac_nids, |
| 18282 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18283 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18284 | .channel_mode = alc662_3ST_2ch_modes, |
| 18285 | .unsol_event = alc663_mode8_unsol_event, |
| 18286 | .setup = alc663_mode8_setup, |
| 18287 | .init_hook = alc663_mode8_inithook, |
| 18288 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18289 | [ALC272_DELL] = { |
| 18290 | .mixers = { alc663_m51va_mixer }, |
| 18291 | .cap_mixer = alc272_auto_capture_mixer, |
| 18292 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18293 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18294 | .dac_nids = alc662_dac_nids, |
| 18295 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18296 | .adc_nids = alc272_adc_nids, |
| 18297 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18298 | .capsrc_nids = alc272_capsrc_nids, |
| 18299 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18300 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18301 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18302 | .init_hook = alc663_m51va_inithook, |
| 18303 | }, |
| 18304 | [ALC272_DELL_ZM1] = { |
| 18305 | .mixers = { alc663_m51va_mixer }, |
| 18306 | .cap_mixer = alc662_auto_capture_mixer, |
| 18307 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18308 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18309 | .dac_nids = alc662_dac_nids, |
| 18310 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18311 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18312 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18313 | .capsrc_nids = alc662_capsrc_nids, |
| 18314 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18315 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18316 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18317 | .init_hook = alc663_m51va_inithook, |
| 18318 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18319 | [ALC272_SAMSUNG_NC10] = { |
| 18320 | .mixers = { alc272_nc10_mixer }, |
| 18321 | .init_verbs = { alc662_init_verbs, |
| 18322 | alc663_21jd_amic_init_verbs }, |
| 18323 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18324 | .dac_nids = alc272_dac_nids, |
| 18325 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18326 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18327 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18328 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18329 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18330 | .init_hook = alc663_mode4_inithook, |
| 18331 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18332 | }; |
| 18333 | |
| 18334 | |
| 18335 | /* |
| 18336 | * BIOS auto configuration |
| 18337 | */ |
| 18338 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18339 | /* convert from MIX nid to DAC */ |
| 18340 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18341 | { |
| 18342 | if (nid == 0x0f) |
| 18343 | return 0x02; |
| 18344 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18345 | return nid - 0x0c + 0x02; |
| 18346 | else |
| 18347 | return 0; |
| 18348 | } |
| 18349 | |
| 18350 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18351 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18352 | hda_nid_t dac) |
| 18353 | { |
| 18354 | hda_nid_t mix[4]; |
| 18355 | int i, num; |
| 18356 | |
| 18357 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18358 | for (i = 0; i < num; i++) { |
| 18359 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18360 | return mix[i]; |
| 18361 | } |
| 18362 | return 0; |
| 18363 | } |
| 18364 | |
| 18365 | /* look for an empty DAC slot */ |
| 18366 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18367 | { |
| 18368 | struct alc_spec *spec = codec->spec; |
| 18369 | hda_nid_t srcs[5]; |
| 18370 | int i, j, num; |
| 18371 | |
| 18372 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18373 | if (num < 0) |
| 18374 | return 0; |
| 18375 | for (i = 0; i < num; i++) { |
| 18376 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18377 | if (!nid) |
| 18378 | continue; |
| 18379 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18380 | if (spec->multiout.dac_nids[j] == nid) |
| 18381 | break; |
| 18382 | if (j >= spec->multiout.num_dacs) |
| 18383 | return nid; |
| 18384 | } |
| 18385 | return 0; |
| 18386 | } |
| 18387 | |
| 18388 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18389 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18390 | const struct auto_pin_cfg *cfg) |
| 18391 | { |
| 18392 | struct alc_spec *spec = codec->spec; |
| 18393 | int i; |
| 18394 | hda_nid_t dac; |
| 18395 | |
| 18396 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18397 | for (i = 0; i < cfg->line_outs; i++) { |
| 18398 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18399 | if (!dac) |
| 18400 | continue; |
| 18401 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18402 | } |
| 18403 | return 0; |
| 18404 | } |
| 18405 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18406 | 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] | 18407 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18408 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18409 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18410 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18411 | } |
| 18412 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18413 | 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] | 18414 | hda_nid_t nid, unsigned int chs) |
| 18415 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18416 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18417 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18418 | } |
| 18419 | |
| 18420 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18421 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18422 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18423 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18424 | |
| 18425 | /* add playback controls from the parsed DAC table */ |
| 18426 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18427 | const struct auto_pin_cfg *cfg) |
| 18428 | { |
| 18429 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18430 | static const char *chname[4] = { |
| 18431 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18432 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18433 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18434 | int i, err; |
| 18435 | |
| 18436 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18437 | nid = spec->multiout.dac_nids[i]; |
| 18438 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18439 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18440 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18441 | if (!mix) |
| 18442 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18443 | if (i == 2) { |
| 18444 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18445 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18446 | if (err < 0) |
| 18447 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18448 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18449 | if (err < 0) |
| 18450 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18451 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18452 | if (err < 0) |
| 18453 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18454 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18455 | if (err < 0) |
| 18456 | return err; |
| 18457 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18458 | const char *pfx; |
| 18459 | if (cfg->line_outs == 1 && |
| 18460 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18461 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18462 | pfx = "Speaker"; |
| 18463 | else |
| 18464 | pfx = "PCM"; |
| 18465 | } else |
| 18466 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18467 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18468 | if (err < 0) |
| 18469 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18470 | if (cfg->line_outs == 1 && |
| 18471 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18472 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18473 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18474 | if (err < 0) |
| 18475 | return err; |
| 18476 | } |
| 18477 | } |
| 18478 | return 0; |
| 18479 | } |
| 18480 | |
| 18481 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18482 | /* return DAC nid if any new DAC is assigned */ |
| 18483 | 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] | 18484 | const char *pfx) |
| 18485 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18486 | struct alc_spec *spec = codec->spec; |
| 18487 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18488 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18489 | |
| 18490 | if (!pin) |
| 18491 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18492 | nid = alc662_look_for_dac(codec, pin); |
| 18493 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18494 | /* the corresponding DAC is already occupied */ |
| 18495 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18496 | return 0; /* no way */ |
| 18497 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18498 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18499 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18500 | } |
| 18501 | |
| 18502 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18503 | if (!mix) |
| 18504 | return 0; |
| 18505 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18506 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18507 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18508 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18509 | if (err < 0) |
| 18510 | return err; |
| 18511 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18512 | } |
| 18513 | |
| 18514 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18515 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18516 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18517 | |
| 18518 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18519 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18520 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18521 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18522 | int i, num; |
| 18523 | hda_nid_t srcs[4]; |
| 18524 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18525 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18526 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18527 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18528 | if (num <= 1) |
| 18529 | return; |
| 18530 | for (i = 0; i < num; i++) { |
| 18531 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18532 | continue; |
| 18533 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18534 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18535 | } |
| 18536 | } |
| 18537 | |
| 18538 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18539 | { |
| 18540 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18541 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18542 | int i; |
| 18543 | |
| 18544 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18545 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18546 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18547 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18548 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18549 | } |
| 18550 | } |
| 18551 | |
| 18552 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18553 | { |
| 18554 | struct alc_spec *spec = codec->spec; |
| 18555 | hda_nid_t pin; |
| 18556 | |
| 18557 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18558 | if (pin) |
| 18559 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18560 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18561 | pin = spec->autocfg.speaker_pins[0]; |
| 18562 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18563 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18564 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18565 | } |
| 18566 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18567 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18568 | |
| 18569 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18570 | { |
| 18571 | struct alc_spec *spec = codec->spec; |
| 18572 | int i; |
| 18573 | |
| 18574 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18575 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18576 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18577 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18578 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18579 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18580 | snd_hda_codec_write(codec, nid, 0, |
| 18581 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18582 | AMP_OUT_MUTE); |
| 18583 | } |
| 18584 | } |
| 18585 | } |
| 18586 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18587 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18588 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18589 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18590 | { |
| 18591 | struct alc_spec *spec = codec->spec; |
| 18592 | int err; |
| 18593 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18594 | |
| 18595 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18596 | alc662_ignore); |
| 18597 | if (err < 0) |
| 18598 | return err; |
| 18599 | if (!spec->autocfg.line_outs) |
| 18600 | return 0; /* can't find valid BIOS pin config */ |
| 18601 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18602 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18603 | if (err < 0) |
| 18604 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18605 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18606 | if (err < 0) |
| 18607 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18608 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18609 | spec->autocfg.speaker_pins[0], |
| 18610 | "Speaker"); |
| 18611 | if (err < 0) |
| 18612 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18613 | if (err) |
| 18614 | spec->multiout.extra_out_nid[0] = err; |
| 18615 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18616 | "Headphone"); |
| 18617 | if (err < 0) |
| 18618 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18619 | if (err) |
| 18620 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18621 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18622 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18623 | return err; |
| 18624 | |
| 18625 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18626 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18627 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18628 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18629 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18630 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18631 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18632 | |
| 18633 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18634 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18635 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18636 | add_verb(spec, alc662_init_verbs); |
| 18637 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18638 | codec->vendor_id == 0x10ec0665) |
| 18639 | add_verb(spec, alc663_init_verbs); |
| 18640 | |
| 18641 | if (codec->vendor_id == 0x10ec0272) |
| 18642 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18643 | |
| 18644 | err = alc_auto_add_mic_boost(codec); |
| 18645 | if (err < 0) |
| 18646 | return err; |
| 18647 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18648 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18649 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18650 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18651 | else |
| 18652 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18653 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18654 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18655 | } |
| 18656 | |
| 18657 | /* additional initialization for auto-configuration model */ |
| 18658 | static void alc662_auto_init(struct hda_codec *codec) |
| 18659 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18660 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18661 | alc662_auto_init_multi_out(codec); |
| 18662 | alc662_auto_init_hp_out(codec); |
| 18663 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18664 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18665 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18666 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18667 | } |
| 18668 | |
| 18669 | static int patch_alc662(struct hda_codec *codec) |
| 18670 | { |
| 18671 | struct alc_spec *spec; |
| 18672 | int err, board_config; |
| 18673 | |
| 18674 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18675 | if (!spec) |
| 18676 | return -ENOMEM; |
| 18677 | |
| 18678 | codec->spec = spec; |
| 18679 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18680 | alc_auto_parse_customize_define(codec); |
| 18681 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18682 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18683 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18684 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18685 | alc_codec_rename(codec, "ALC661"); |
| 18686 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18687 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18688 | spec->cdefine.platform_type == 1) |
| 18689 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18690 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18691 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18692 | alc662_models, |
| 18693 | alc662_cfg_tbl); |
| 18694 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18695 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18696 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18697 | board_config = ALC662_AUTO; |
| 18698 | } |
| 18699 | |
| 18700 | if (board_config == ALC662_AUTO) { |
| 18701 | /* automatic parse from the BIOS config */ |
| 18702 | err = alc662_parse_auto_config(codec); |
| 18703 | if (err < 0) { |
| 18704 | alc_free(codec); |
| 18705 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18706 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18707 | printk(KERN_INFO |
| 18708 | "hda_codec: Cannot set up configuration " |
| 18709 | "from BIOS. Using base mode...\n"); |
| 18710 | board_config = ALC662_3ST_2ch_DIG; |
| 18711 | } |
| 18712 | } |
| 18713 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 18714 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 18715 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18716 | if (err < 0) { |
| 18717 | alc_free(codec); |
| 18718 | return err; |
| 18719 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18720 | } |
| 18721 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18722 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18723 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18724 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18725 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18726 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18727 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18728 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18729 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18730 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18731 | if (!spec->adc_nids) { |
| 18732 | spec->adc_nids = alc662_adc_nids; |
| 18733 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18734 | } |
| 18735 | if (!spec->capsrc_nids) |
| 18736 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18737 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18738 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18739 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18740 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame^] | 18741 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18742 | switch (codec->vendor_id) { |
| 18743 | case 0x10ec0662: |
| 18744 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18745 | break; |
| 18746 | case 0x10ec0272: |
| 18747 | case 0x10ec0663: |
| 18748 | case 0x10ec0665: |
| 18749 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18750 | break; |
| 18751 | case 0x10ec0273: |
| 18752 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18753 | break; |
| 18754 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18755 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18756 | spec->vmaster_nid = 0x02; |
| 18757 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18758 | codec->patch_ops = alc_patch_ops; |
| 18759 | if (board_config == ALC662_AUTO) |
| 18760 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18761 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18762 | if (!spec->loopback.amplist) |
| 18763 | spec->loopback.amplist = alc662_loopbacks; |
| 18764 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18765 | |
| 18766 | return 0; |
| 18767 | } |
| 18768 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18769 | static int patch_alc888(struct hda_codec *codec) |
| 18770 | { |
| 18771 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18772 | kfree(codec->chip_name); |
| 18773 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18774 | if (!codec->chip_name) { |
| 18775 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18776 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18777 | } |
| 18778 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18779 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18780 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18781 | } |
| 18782 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18783 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18784 | * patch entries |
| 18785 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18786 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18787 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18788 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18789 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18790 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18791 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18792 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18793 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18794 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18795 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18796 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18797 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18798 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18799 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18800 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18801 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18802 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18803 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18804 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18805 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18806 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18807 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18808 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18809 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18810 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18811 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18812 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18813 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18814 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18815 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18816 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18817 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18818 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18819 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18820 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18821 | {} /* terminator */ |
| 18822 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18823 | |
| 18824 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18825 | |
| 18826 | MODULE_LICENSE("GPL"); |
| 18827 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18828 | |
| 18829 | static struct hda_codec_preset_list realtek_list = { |
| 18830 | .preset = snd_hda_preset_realtek, |
| 18831 | .owner = THIS_MODULE, |
| 18832 | }; |
| 18833 | |
| 18834 | static int __init patch_realtek_init(void) |
| 18835 | { |
| 18836 | return snd_hda_add_codec_preset(&realtek_list); |
| 18837 | } |
| 18838 | |
| 18839 | static void __exit patch_realtek_exit(void) |
| 18840 | { |
| 18841 | snd_hda_delete_codec_preset(&realtek_list); |
| 18842 | } |
| 18843 | |
| 18844 | module_init(patch_realtek_init) |
| 18845 | module_exit(patch_realtek_exit) |