Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 134 | ALC269_AMIC, |
| 135 | ALC269_DMIC, |
| 136 | ALC269VB_AMIC, |
| 137 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 138 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 139 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 140 | ALC269_AUTO, |
| 141 | ALC269_MODEL_LAST /* last tag */ |
| 142 | }; |
| 143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | /* ALC861 models */ |
| 145 | enum { |
| 146 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 147 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_3ST_DIG, |
| 149 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 150 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 151 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 152 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 153 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 154 | ALC861_AUTO, |
| 155 | ALC861_MODEL_LAST, |
| 156 | }; |
| 157 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | /* ALC861-VD models */ |
| 159 | enum { |
| 160 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 161 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 162 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_3ST, |
| 164 | ALC861VD_3ST_DIG, |
| 165 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 166 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 167 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 168 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 169 | ALC861VD_AUTO, |
| 170 | ALC861VD_MODEL_LAST, |
| 171 | }; |
| 172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | /* ALC662 models */ |
| 174 | enum { |
| 175 | ALC662_3ST_2ch_DIG, |
| 176 | ALC662_3ST_6ch_DIG, |
| 177 | ALC662_3ST_6ch, |
| 178 | ALC662_5ST_DIG, |
| 179 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 180 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 182 | ALC663_ASUS_M51VA, |
| 183 | ALC663_ASUS_G71V, |
| 184 | ALC663_ASUS_H13, |
| 185 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 186 | ALC662_ECS, |
| 187 | ALC663_ASUS_MODE1, |
| 188 | ALC662_ASUS_MODE2, |
| 189 | ALC663_ASUS_MODE3, |
| 190 | ALC663_ASUS_MODE4, |
| 191 | ALC663_ASUS_MODE5, |
| 192 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 193 | ALC663_ASUS_MODE7, |
| 194 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 195 | ALC272_DELL, |
| 196 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 197 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 198 | ALC662_AUTO, |
| 199 | ALC662_MODEL_LAST, |
| 200 | }; |
| 201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | /* ALC882 models */ |
| 203 | enum { |
| 204 | ALC882_3ST_DIG, |
| 205 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 206 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 207 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 208 | ALC882_TARGA, |
| 209 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 210 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 211 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 212 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 213 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 214 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 215 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 216 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 217 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_3ST_2ch_DIG, |
| 219 | ALC883_3ST_6ch_DIG, |
| 220 | ALC883_3ST_6ch, |
| 221 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 222 | ALC883_TARGA_DIG, |
| 223 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 224 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 225 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 226 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 231 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 232 | ALC883_MEDION_MD2, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 233 | ALC883_MEDION_WIM2160, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 234 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 235 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 236 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 237 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 238 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 239 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 240 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 241 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 242 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 243 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 244 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 245 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 246 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 247 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 248 | ALC889A_INTEL, |
| 249 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 250 | ALC888_ASUS_M90V, |
| 251 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 252 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 253 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 254 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 255 | ALC882_AUTO, |
| 256 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 257 | }; |
| 258 | |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 259 | /* ALC680 models */ |
| 260 | enum { |
| 261 | ALC680_BASE, |
| 262 | ALC680_AUTO, |
| 263 | ALC680_MODEL_LAST, |
| 264 | }; |
| 265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 266 | /* for GPIO Poll */ |
| 267 | #define GPIO_MASK 0x03 |
| 268 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 269 | /* extra amp-initialization sequence types */ |
| 270 | enum { |
| 271 | ALC_INIT_NONE, |
| 272 | ALC_INIT_DEFAULT, |
| 273 | ALC_INIT_GPIO1, |
| 274 | ALC_INIT_GPIO2, |
| 275 | ALC_INIT_GPIO3, |
| 276 | }; |
| 277 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 278 | struct alc_mic_route { |
| 279 | hda_nid_t pin; |
| 280 | unsigned char mux_idx; |
| 281 | unsigned char amix_idx; |
| 282 | }; |
| 283 | |
| 284 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 285 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 286 | struct alc_customize_define { |
| 287 | unsigned int sku_cfg; |
| 288 | unsigned char port_connectivity; |
| 289 | unsigned char check_sum; |
| 290 | unsigned char customization; |
| 291 | unsigned char external_amp; |
| 292 | unsigned int enable_pcbeep:1; |
| 293 | unsigned int platform_type:1; |
| 294 | unsigned int swap:1; |
| 295 | unsigned int override:1; |
| 296 | }; |
| 297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | struct alc_spec { |
| 299 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 300 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 302 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 303 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 305 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 306 | * don't forget NULL |
| 307 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 308 | */ |
| 309 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 311 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | struct hda_pcm_stream *stream_analog_playback; |
| 313 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 314 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 315 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 317 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | struct hda_pcm_stream *stream_digital_playback; |
| 319 | struct hda_pcm_stream *stream_digital_capture; |
| 320 | |
| 321 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 322 | struct hda_multi_out multiout; /* playback set-up |
| 323 | * max_channels, dacs must be set |
| 324 | * dig_out_nid and hp_nid are optional |
| 325 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 326 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 327 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 328 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | |
| 330 | /* capture */ |
| 331 | unsigned int num_adc_nids; |
| 332 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 333 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 334 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 336 | /* capture setup for dynamic dual-adc switch */ |
| 337 | unsigned int cur_adc_idx; |
| 338 | hda_nid_t cur_adc; |
| 339 | unsigned int cur_adc_stream_tag; |
| 340 | unsigned int cur_adc_format; |
| 341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 343 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | const struct hda_input_mux *input_mux; |
| 345 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 346 | struct alc_mic_route ext_mic; |
| 347 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | |
| 349 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 350 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 352 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 353 | int const_channel_count; |
| 354 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | |
| 356 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 357 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 359 | /* dynamic controls, init_verbs and input_mux */ |
| 360 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 361 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 362 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 363 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 364 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 365 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 366 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 367 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 368 | /* hooks */ |
| 369 | void (*init_hook)(struct hda_codec *codec); |
| 370 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 371 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 372 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 373 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 374 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 375 | /* for pin sensing */ |
| 376 | unsigned int sense_updated: 1; |
| 377 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 378 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 379 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 380 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 381 | /* other flags */ |
| 382 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 383 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 384 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 385 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 386 | /* for virtual master */ |
| 387 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 388 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 389 | struct hda_loopback_check loopback; |
| 390 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 391 | |
| 392 | /* for PLL fix */ |
| 393 | hda_nid_t pll_nid; |
| 394 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | /* |
| 398 | * configuration template - to be copied to the spec instance |
| 399 | */ |
| 400 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 401 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 402 | * with spec |
| 403 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 404 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 405 | const struct hda_verb *init_verbs[5]; |
| 406 | unsigned int num_dacs; |
| 407 | hda_nid_t *dac_nids; |
| 408 | hda_nid_t dig_out_nid; /* optional */ |
| 409 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 410 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 411 | unsigned int num_adc_nids; |
| 412 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 413 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 414 | hda_nid_t dig_in_nid; |
| 415 | unsigned int num_channel_mode; |
| 416 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 417 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 418 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 420 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 421 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 422 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 423 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 424 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 425 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 426 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 427 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | }; |
| 429 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | |
| 431 | /* |
| 432 | * input MUX handling |
| 433 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 434 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 435 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | { |
| 437 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 438 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 439 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 440 | if (mux_idx >= spec->num_mux_defs) |
| 441 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 442 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 443 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 444 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | } |
| 446 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
| 452 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 453 | |
| 454 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 455 | return 0; |
| 456 | } |
| 457 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 458 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 459 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | { |
| 461 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 462 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 463 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 465 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 466 | hda_nid_t nid = spec->capsrc_nids ? |
| 467 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 468 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 470 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 471 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 472 | if (!imux->num_items && mux_idx > 0) |
| 473 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 474 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 475 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 476 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 477 | /* Matrix-mixer style (e.g. ALC882) */ |
| 478 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 479 | unsigned int i, idx; |
| 480 | |
| 481 | idx = ucontrol->value.enumerated.item[0]; |
| 482 | if (idx >= imux->num_items) |
| 483 | idx = imux->num_items - 1; |
| 484 | if (*cur_val == idx) |
| 485 | return 0; |
| 486 | for (i = 0; i < imux->num_items; i++) { |
| 487 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 488 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 489 | imux->items[i].index, |
| 490 | HDA_AMP_MUTE, v); |
| 491 | } |
| 492 | *cur_val = idx; |
| 493 | return 1; |
| 494 | } else { |
| 495 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 496 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 497 | &spec->cur_mux[adc_idx]); |
| 498 | } |
| 499 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 500 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | /* |
| 502 | * channel mode setting |
| 503 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 504 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 505 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | { |
| 507 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 508 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 509 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 510 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | } |
| 512 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 513 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 514 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | { |
| 516 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 517 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 518 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 519 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 520 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 523 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 524 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | { |
| 526 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 527 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 528 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 529 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 530 | &spec->ext_channel_count); |
| 531 | if (err >= 0 && !spec->const_channel_count) { |
| 532 | spec->multiout.max_channels = spec->ext_channel_count; |
| 533 | if (spec->need_dac_fix) |
| 534 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 535 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 536 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | } |
| 538 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | * Control the mode of pin widget settings via the mixer. "pc" is used |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 541 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 542 | * being part of a format specifier. Maximum allowed length of a value is |
| 543 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 544 | * |
| 545 | * Note: some retasking pin complexes seem to ignore requests for input |
| 546 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 547 | * are requested. Therefore order this list so that this behaviour will not |
| 548 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 549 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 550 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 553 | "Mic 50pc bias", "Mic 80pc bias", |
| 554 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 555 | }; |
| 556 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 557 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | }; |
| 559 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 560 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 561 | * addition, "input" pins may or may not process the mic bias option |
| 562 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 563 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 564 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 565 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 566 | #define ALC_PIN_DIR_IN 0x00 |
| 567 | #define ALC_PIN_DIR_OUT 0x01 |
| 568 | #define ALC_PIN_DIR_INOUT 0x02 |
| 569 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 570 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 571 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 572 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | * For each direction the minimum and maximum values are given. |
| 574 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 575 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 577 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 578 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 579 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 580 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 581 | }; |
| 582 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 583 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 584 | #define alc_pin_mode_n_items(_dir) \ |
| 585 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 586 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 587 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 589 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 590 | unsigned int item_num = uinfo->value.enumerated.item; |
| 591 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 592 | |
| 593 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 594 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 595 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 596 | |
| 597 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 598 | item_num = alc_pin_mode_min(dir); |
| 599 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 600 | return 0; |
| 601 | } |
| 602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 603 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 604 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 605 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 606 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 607 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 608 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 609 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 611 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 612 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 613 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 614 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | /* Find enumerated value for current pinctl setting */ |
| 616 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 617 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 618 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 619 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 620 | return 0; |
| 621 | } |
| 622 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 624 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 625 | { |
| 626 | signed int change; |
| 627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 628 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 629 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 630 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 631 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 632 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 633 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 634 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 635 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 636 | val = alc_pin_mode_min(dir); |
| 637 | |
| 638 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 639 | if (change) { |
| 640 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 641 | snd_hda_codec_write_cache(codec, nid, 0, |
| 642 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 643 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 644 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 645 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 646 | * for the requested pin mode. Enum values of 2 or less are |
| 647 | * input modes. |
| 648 | * |
| 649 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 650 | * reduces noise slightly (particularly on input) so we'll |
| 651 | * do it. However, having both input and output buffers |
| 652 | * enabled simultaneously doesn't seem to be problematic if |
| 653 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 654 | */ |
| 655 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 656 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 657 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 658 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 659 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 660 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 661 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 662 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 663 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 664 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 665 | } |
| 666 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 667 | return change; |
| 668 | } |
| 669 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 670 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 671 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 672 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 673 | .info = alc_pin_mode_info, \ |
| 674 | .get = alc_pin_mode_get, \ |
| 675 | .put = alc_pin_mode_put, \ |
| 676 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 677 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 678 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 679 | * together using a mask with more than one bit set. This control is |
| 680 | * currently used only by the ALC260 test model. At this stage they are not |
| 681 | * needed for any "production" models. |
| 682 | */ |
| 683 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 684 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 685 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 686 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 687 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 688 | { |
| 689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 690 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 691 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 692 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 693 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 694 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 695 | |
| 696 | *valp = (val & mask) != 0; |
| 697 | return 0; |
| 698 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 699 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 700 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 701 | { |
| 702 | signed int change; |
| 703 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 704 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 705 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 706 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 707 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 708 | AC_VERB_GET_GPIO_DATA, |
| 709 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 710 | |
| 711 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 712 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 713 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 714 | gpio_data &= ~mask; |
| 715 | else |
| 716 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 717 | snd_hda_codec_write_cache(codec, nid, 0, |
| 718 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 719 | |
| 720 | return change; |
| 721 | } |
| 722 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 723 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 724 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 725 | .info = alc_gpio_data_info, \ |
| 726 | .get = alc_gpio_data_get, \ |
| 727 | .put = alc_gpio_data_put, \ |
| 728 | .private_value = nid | (mask<<16) } |
| 729 | #endif /* CONFIG_SND_DEBUG */ |
| 730 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 731 | /* A switch control to allow the enabling of the digital IO pins on the |
| 732 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 733 | * to provide something in the test model allowing digital outputs to be |
| 734 | * identified if present. If models are found which can utilise these |
| 735 | * outputs a more complete mixer control can be devised for those models if |
| 736 | * necessary. |
| 737 | */ |
| 738 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 739 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 740 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 741 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 742 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 743 | { |
| 744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 745 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 746 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 747 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 748 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 749 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 750 | |
| 751 | *valp = (val & mask) != 0; |
| 752 | return 0; |
| 753 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 754 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 755 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 756 | { |
| 757 | signed int change; |
| 758 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 759 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 760 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 761 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 762 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 763 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 764 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 765 | |
| 766 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 767 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 768 | if (val==0) |
| 769 | ctrl_data &= ~mask; |
| 770 | else |
| 771 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 772 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 773 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 774 | |
| 775 | return change; |
| 776 | } |
| 777 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 778 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 779 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 780 | .info = alc_spdif_ctrl_info, \ |
| 781 | .get = alc_spdif_ctrl_get, \ |
| 782 | .put = alc_spdif_ctrl_put, \ |
| 783 | .private_value = nid | (mask<<16) } |
| 784 | #endif /* CONFIG_SND_DEBUG */ |
| 785 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 786 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 787 | * Again, this is only used in the ALC26x test models to help identify when |
| 788 | * the EAPD line must be asserted for features to work. |
| 789 | */ |
| 790 | #ifdef CONFIG_SND_DEBUG |
| 791 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 792 | |
| 793 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 794 | struct snd_ctl_elem_value *ucontrol) |
| 795 | { |
| 796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 797 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 798 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 799 | long *valp = ucontrol->value.integer.value; |
| 800 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 801 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 802 | |
| 803 | *valp = (val & mask) != 0; |
| 804 | return 0; |
| 805 | } |
| 806 | |
| 807 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 808 | struct snd_ctl_elem_value *ucontrol) |
| 809 | { |
| 810 | int change; |
| 811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 812 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 813 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 814 | long val = *ucontrol->value.integer.value; |
| 815 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 816 | AC_VERB_GET_EAPD_BTLENABLE, |
| 817 | 0x00); |
| 818 | |
| 819 | /* Set/unset the masked control bit(s) as needed */ |
| 820 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 821 | if (!val) |
| 822 | ctrl_data &= ~mask; |
| 823 | else |
| 824 | ctrl_data |= mask; |
| 825 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 826 | ctrl_data); |
| 827 | |
| 828 | return change; |
| 829 | } |
| 830 | |
| 831 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 832 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 833 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 834 | .info = alc_eapd_ctrl_info, \ |
| 835 | .get = alc_eapd_ctrl_get, \ |
| 836 | .put = alc_eapd_ctrl_put, \ |
| 837 | .private_value = nid | (mask<<16) } |
| 838 | #endif /* CONFIG_SND_DEBUG */ |
| 839 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 840 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 841 | * set up the input pin config (depending on the given auto-pin type) |
| 842 | */ |
| 843 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 844 | int auto_pin_type) |
| 845 | { |
| 846 | unsigned int val = PIN_IN; |
| 847 | |
| 848 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 849 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 850 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 851 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 852 | if (pincap & AC_PINCAP_VREF_80) |
| 853 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 854 | else if (pincap & AC_PINCAP_VREF_50) |
| 855 | val = PIN_VREF50; |
| 856 | else if (pincap & AC_PINCAP_VREF_100) |
| 857 | val = PIN_VREF100; |
| 858 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 859 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 860 | } |
| 861 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 862 | } |
| 863 | |
| 864 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 865 | */ |
| 866 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 867 | { |
| 868 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 869 | return; |
| 870 | spec->mixers[spec->num_mixers++] = mix; |
| 871 | } |
| 872 | |
| 873 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 874 | { |
| 875 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 876 | return; |
| 877 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 878 | } |
| 879 | |
| 880 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | * set up from the preset table |
| 882 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 883 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 884 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 886 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | int i; |
| 888 | |
| 889 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 890 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 891 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 892 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 893 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 894 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 895 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 896 | spec->channel_mode = preset->channel_mode; |
| 897 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 898 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 899 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 900 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 901 | if (preset->const_channel_count) |
| 902 | spec->multiout.max_channels = preset->const_channel_count; |
| 903 | else |
| 904 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 905 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 906 | |
| 907 | spec->multiout.num_dacs = preset->num_dacs; |
| 908 | spec->multiout.dac_nids = preset->dac_nids; |
| 909 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 910 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 911 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 912 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 913 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 914 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 915 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 916 | spec->input_mux = preset->input_mux; |
| 917 | |
| 918 | spec->num_adc_nids = preset->num_adc_nids; |
| 919 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 920 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 921 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 922 | |
| 923 | spec->unsol_event = preset->unsol_event; |
| 924 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 925 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 926 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 927 | spec->loopback.amplist = preset->loopbacks; |
| 928 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 929 | |
| 930 | if (preset->setup) |
| 931 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 932 | } |
| 933 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 934 | /* Enable GPIO mask and set output */ |
| 935 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 939 | { } |
| 940 | }; |
| 941 | |
| 942 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 943 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 944 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 945 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 946 | { } |
| 947 | }; |
| 948 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 949 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 950 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 951 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 952 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 953 | { } |
| 954 | }; |
| 955 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 956 | /* |
| 957 | * Fix hardware PLL issue |
| 958 | * On some codecs, the analog PLL gating control must be off while |
| 959 | * the default value is 1. |
| 960 | */ |
| 961 | static void alc_fix_pll(struct hda_codec *codec) |
| 962 | { |
| 963 | struct alc_spec *spec = codec->spec; |
| 964 | unsigned int val; |
| 965 | |
| 966 | if (!spec->pll_nid) |
| 967 | return; |
| 968 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 969 | spec->pll_coef_idx); |
| 970 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 971 | AC_VERB_GET_PROC_COEF, 0); |
| 972 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 973 | spec->pll_coef_idx); |
| 974 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 975 | val & ~(1 << spec->pll_coef_bit)); |
| 976 | } |
| 977 | |
| 978 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 979 | unsigned int coef_idx, unsigned int coef_bit) |
| 980 | { |
| 981 | struct alc_spec *spec = codec->spec; |
| 982 | spec->pll_nid = nid; |
| 983 | spec->pll_coef_idx = coef_idx; |
| 984 | spec->pll_coef_bit = coef_bit; |
| 985 | alc_fix_pll(codec); |
| 986 | } |
| 987 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 988 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 989 | { |
| 990 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 991 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 992 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 993 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 994 | if (!nid) |
| 995 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 996 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 997 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 998 | nid = spec->autocfg.speaker_pins[i]; |
| 999 | if (!nid) |
| 1000 | break; |
| 1001 | snd_hda_codec_write(codec, nid, 0, |
| 1002 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 1003 | spec->jack_present ? 0 : PIN_OUT); |
| 1004 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1005 | } |
| 1006 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1007 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 1008 | hda_nid_t nid) |
| 1009 | { |
| 1010 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 1011 | int i, nums; |
| 1012 | |
| 1013 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 1014 | for (i = 0; i < nums; i++) |
| 1015 | if (conn[i] == nid) |
| 1016 | return i; |
| 1017 | return -1; |
| 1018 | } |
| 1019 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1020 | /* switch the current ADC according to the jack state */ |
| 1021 | static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) |
| 1022 | { |
| 1023 | struct alc_spec *spec = codec->spec; |
| 1024 | unsigned int present; |
| 1025 | hda_nid_t new_adc; |
| 1026 | |
| 1027 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
| 1028 | if (present) |
| 1029 | spec->cur_adc_idx = 1; |
| 1030 | else |
| 1031 | spec->cur_adc_idx = 0; |
| 1032 | new_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 1033 | if (spec->cur_adc && spec->cur_adc != new_adc) { |
| 1034 | /* stream is running, let's swap the current ADC */ |
| 1035 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 1036 | spec->cur_adc = new_adc; |
| 1037 | snd_hda_codec_setup_stream(codec, new_adc, |
| 1038 | spec->cur_adc_stream_tag, 0, |
| 1039 | spec->cur_adc_format); |
| 1040 | } |
| 1041 | } |
| 1042 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1043 | static void alc_mic_automute(struct hda_codec *codec) |
| 1044 | { |
| 1045 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1046 | struct alc_mic_route *dead, *alive; |
| 1047 | unsigned int present, type; |
| 1048 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1049 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1050 | if (!spec->auto_mic) |
| 1051 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1052 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1053 | return; |
| 1054 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1055 | return; |
| 1056 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 1057 | if (spec->dual_adc_switch) { |
| 1058 | alc_dual_mic_adc_auto_switch(codec); |
| 1059 | return; |
| 1060 | } |
| 1061 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1062 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1063 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1064 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1065 | if (present) { |
| 1066 | alive = &spec->ext_mic; |
| 1067 | dead = &spec->int_mic; |
| 1068 | } else { |
| 1069 | alive = &spec->int_mic; |
| 1070 | dead = &spec->ext_mic; |
| 1071 | } |
| 1072 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1073 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1074 | if (type == AC_WID_AUD_MIX) { |
| 1075 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1076 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1077 | alive->mux_idx, |
| 1078 | HDA_AMP_MUTE, 0); |
| 1079 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1080 | dead->mux_idx, |
| 1081 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1082 | } else { |
| 1083 | /* MUX style (e.g. ALC880) */ |
| 1084 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1085 | AC_VERB_SET_CONNECT_SEL, |
| 1086 | alive->mux_idx); |
| 1087 | } |
| 1088 | |
| 1089 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1090 | } |
| 1091 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1092 | /* unsolicited event for HP jack sensing */ |
| 1093 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1094 | { |
| 1095 | if (codec->vendor_id == 0x10ec0880) |
| 1096 | res >>= 28; |
| 1097 | else |
| 1098 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1099 | switch (res) { |
| 1100 | case ALC880_HP_EVENT: |
| 1101 | alc_automute_pin(codec); |
| 1102 | break; |
| 1103 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1104 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1105 | break; |
| 1106 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | static void alc_inithook(struct hda_codec *codec) |
| 1110 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1111 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1112 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1113 | } |
| 1114 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1115 | /* additional initialization for ALC888 variants */ |
| 1116 | static void alc888_coef_init(struct hda_codec *codec) |
| 1117 | { |
| 1118 | unsigned int tmp; |
| 1119 | |
| 1120 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1121 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1122 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 1123 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1124 | /* alc888S-VC */ |
| 1125 | snd_hda_codec_read(codec, 0x20, 0, |
| 1126 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1127 | else |
| 1128 | /* alc888-VB */ |
| 1129 | snd_hda_codec_read(codec, 0x20, 0, |
| 1130 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1131 | } |
| 1132 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1133 | static void alc889_coef_init(struct hda_codec *codec) |
| 1134 | { |
| 1135 | unsigned int tmp; |
| 1136 | |
| 1137 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1138 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1139 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1140 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1141 | } |
| 1142 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1143 | /* turn on/off EAPD control (only if available) */ |
| 1144 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1145 | { |
| 1146 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1147 | return; |
| 1148 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1149 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1150 | on ? 2 : 0); |
| 1151 | } |
| 1152 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1153 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1154 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1155 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1156 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1157 | switch (type) { |
| 1158 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1159 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1160 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1161 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1162 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1163 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1164 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1165 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1166 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1167 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1168 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1169 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1170 | set_eapd(codec, 0x0f, 1); |
| 1171 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1172 | break; |
| 1173 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1174 | case 0x10ec0267: |
| 1175 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1176 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1177 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1178 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1179 | case 0x10ec0660: |
| 1180 | case 0x10ec0662: |
| 1181 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1183 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1184 | set_eapd(codec, 0x14, 1); |
| 1185 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1186 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1187 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1188 | switch (codec->vendor_id) { |
| 1189 | case 0x10ec0260: |
| 1190 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1191 | AC_VERB_SET_COEF_INDEX, 7); |
| 1192 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1193 | AC_VERB_GET_PROC_COEF, 0); |
| 1194 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1195 | AC_VERB_SET_COEF_INDEX, 7); |
| 1196 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1197 | AC_VERB_SET_PROC_COEF, |
| 1198 | tmp | 0x2010); |
| 1199 | break; |
| 1200 | case 0x10ec0262: |
| 1201 | case 0x10ec0880: |
| 1202 | case 0x10ec0882: |
| 1203 | case 0x10ec0883: |
| 1204 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1205 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1206 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1207 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1208 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1209 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1210 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1211 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1212 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1213 | case 0x10ec0267: |
| 1214 | case 0x10ec0268: |
| 1215 | snd_hda_codec_write(codec, 0x20, 0, |
| 1216 | AC_VERB_SET_COEF_INDEX, 7); |
| 1217 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1218 | AC_VERB_GET_PROC_COEF, 0); |
| 1219 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1220 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1221 | snd_hda_codec_write(codec, 0x20, 0, |
| 1222 | AC_VERB_SET_PROC_COEF, |
| 1223 | tmp | 0x3000); |
| 1224 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1225 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1226 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1227 | break; |
| 1228 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1229 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1230 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1231 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1232 | { |
| 1233 | struct alc_spec *spec = codec->spec; |
| 1234 | |
| 1235 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1236 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1237 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1238 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1239 | if (spec->autocfg.line_out_pins[0] && |
| 1240 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1241 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1242 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | else |
| 1244 | return; |
| 1245 | } |
| 1246 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1247 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1248 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1250 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1251 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1252 | spec->unsol_event = alc_sku_unsol_event; |
| 1253 | } |
| 1254 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1255 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1256 | { |
| 1257 | struct alc_spec *spec = codec->spec; |
| 1258 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1259 | hda_nid_t fixed, ext; |
| 1260 | int i; |
| 1261 | |
| 1262 | /* there must be only two mic inputs exclusively */ |
| 1263 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1264 | if (cfg->input_pins[i]) |
| 1265 | return; |
| 1266 | |
| 1267 | fixed = ext = 0; |
| 1268 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1269 | hda_nid_t nid = cfg->input_pins[i]; |
| 1270 | unsigned int defcfg; |
| 1271 | if (!nid) |
| 1272 | return; |
| 1273 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1274 | switch (get_defcfg_connect(defcfg)) { |
| 1275 | case AC_JACK_PORT_FIXED: |
| 1276 | if (fixed) |
| 1277 | return; /* already occupied */ |
| 1278 | fixed = nid; |
| 1279 | break; |
| 1280 | case AC_JACK_PORT_COMPLEX: |
| 1281 | if (ext) |
| 1282 | return; /* already occupied */ |
| 1283 | ext = nid; |
| 1284 | break; |
| 1285 | default: |
| 1286 | return; /* invalid entry */ |
| 1287 | } |
| 1288 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1289 | if (!ext || !fixed) |
| 1290 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1291 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1292 | return; /* no unsol support */ |
| 1293 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1294 | ext, fixed); |
| 1295 | spec->ext_mic.pin = ext; |
| 1296 | spec->int_mic.pin = fixed; |
| 1297 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1298 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1299 | spec->auto_mic = 1; |
| 1300 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1301 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1302 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1303 | spec->unsol_event = alc_sku_unsol_event; |
| 1304 | } |
| 1305 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1306 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1307 | { |
| 1308 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1309 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1310 | struct alc_spec *spec = codec->spec; |
| 1311 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1312 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 1313 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1314 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 1315 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1316 | goto do_sku; |
| 1317 | |
| 1318 | nid = 0x1d; |
| 1319 | if (codec->vendor_id == 0x10ec0260) |
| 1320 | nid = 0x17; |
| 1321 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1322 | |
| 1323 | if (!(ass & 1)) { |
| 1324 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1325 | codec->chip_name, ass); |
| 1326 | return -1; |
| 1327 | } |
| 1328 | |
| 1329 | /* check sum */ |
| 1330 | tmp = 0; |
| 1331 | for (i = 1; i < 16; i++) { |
| 1332 | if ((ass >> i) & 1) |
| 1333 | tmp++; |
| 1334 | } |
| 1335 | if (((ass >> 16) & 0xf) != tmp) |
| 1336 | return -1; |
| 1337 | |
| 1338 | spec->cdefine.port_connectivity = ass >> 30; |
| 1339 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1340 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1341 | spec->cdefine.customization = ass >> 8; |
| 1342 | do_sku: |
| 1343 | spec->cdefine.sku_cfg = ass; |
| 1344 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1345 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1346 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1347 | spec->cdefine.override = ass & 0x1; |
| 1348 | |
| 1349 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1350 | nid, spec->cdefine.sku_cfg); |
| 1351 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1352 | spec->cdefine.port_connectivity); |
| 1353 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1354 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1355 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1356 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1357 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1358 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1359 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1360 | |
| 1361 | return 0; |
| 1362 | } |
| 1363 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1364 | /* check subsystem ID and set up device-specific initialization; |
| 1365 | * return 1 if initialized, 0 if invalid SSID |
| 1366 | */ |
| 1367 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1368 | * 31 ~ 16 : Manufacture ID |
| 1369 | * 15 ~ 8 : SKU ID |
| 1370 | * 7 ~ 0 : Assembly ID |
| 1371 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1372 | */ |
| 1373 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1374 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1375 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1376 | { |
| 1377 | unsigned int ass, tmp, i; |
| 1378 | unsigned nid; |
| 1379 | struct alc_spec *spec = codec->spec; |
| 1380 | |
| 1381 | ass = codec->subsystem_id & 0xffff; |
| 1382 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1383 | goto do_sku; |
| 1384 | |
| 1385 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1386 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1387 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1388 | * 29~21 : reserve |
| 1389 | * 20 : PCBEEP input |
| 1390 | * 19~16 : Check sum (15:1) |
| 1391 | * 15~1 : Custom |
| 1392 | * 0 : override |
| 1393 | */ |
| 1394 | nid = 0x1d; |
| 1395 | if (codec->vendor_id == 0x10ec0260) |
| 1396 | nid = 0x17; |
| 1397 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1398 | snd_printd("realtek: No valid SSID, " |
| 1399 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1400 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1401 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1402 | return 0; |
| 1403 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1404 | return 0; |
| 1405 | |
| 1406 | /* check sum */ |
| 1407 | tmp = 0; |
| 1408 | for (i = 1; i < 16; i++) { |
| 1409 | if ((ass >> i) & 1) |
| 1410 | tmp++; |
| 1411 | } |
| 1412 | if (((ass >> 16) & 0xf) != tmp) |
| 1413 | return 0; |
| 1414 | do_sku: |
| 1415 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1416 | ass & 0xffff, codec->vendor_id); |
| 1417 | /* |
| 1418 | * 0 : override |
| 1419 | * 1 : Swap Jack |
| 1420 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1421 | * 3~5 : External Amplifier control |
| 1422 | * 7~6 : Reserved |
| 1423 | */ |
| 1424 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1425 | switch (tmp) { |
| 1426 | case 1: |
| 1427 | spec->init_amp = ALC_INIT_GPIO1; |
| 1428 | break; |
| 1429 | case 3: |
| 1430 | spec->init_amp = ALC_INIT_GPIO2; |
| 1431 | break; |
| 1432 | case 7: |
| 1433 | spec->init_amp = ALC_INIT_GPIO3; |
| 1434 | break; |
| 1435 | case 5: |
| 1436 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1437 | break; |
| 1438 | } |
| 1439 | |
| 1440 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1441 | * when the external headphone out jack is plugged" |
| 1442 | */ |
| 1443 | if (!(ass & 0x8000)) |
| 1444 | return 1; |
| 1445 | /* |
| 1446 | * 10~8 : Jack location |
| 1447 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1448 | * 14~13: Resvered |
| 1449 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1450 | * when the external headphone out jack is plugged" |
| 1451 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1452 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1453 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1454 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1455 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1456 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1457 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1458 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1459 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1460 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1461 | else if (tmp == 3) |
| 1462 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1463 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1464 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1465 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1466 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1467 | return 1; |
| 1468 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1469 | } |
| 1470 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1471 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1472 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1473 | return 1; |
| 1474 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1475 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1476 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1477 | hda_nid_t porta, hda_nid_t porte, |
| 1478 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1479 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1480 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1481 | struct alc_spec *spec = codec->spec; |
| 1482 | snd_printd("realtek: " |
| 1483 | "Enable default setup for auto mode as fallback\n"); |
| 1484 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1485 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1486 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1487 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1488 | } |
| 1489 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1490 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1491 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1492 | */ |
| 1493 | |
| 1494 | struct alc_pincfg { |
| 1495 | hda_nid_t nid; |
| 1496 | u32 val; |
| 1497 | }; |
| 1498 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1499 | struct alc_fixup { |
| 1500 | const struct alc_pincfg *pins; |
| 1501 | const struct hda_verb *verbs; |
| 1502 | }; |
| 1503 | |
| 1504 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1505 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1506 | const struct alc_fixup *fix, |
| 1507 | int pre_init) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1508 | { |
| 1509 | const struct alc_pincfg *cfg; |
| 1510 | |
| 1511 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1512 | if (!quirk) |
| 1513 | return; |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1514 | fix += quirk->value; |
| 1515 | cfg = fix->pins; |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1516 | if (pre_init && cfg) { |
| 1517 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1518 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", |
| 1519 | codec->chip_name, quirk->name); |
| 1520 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1521 | for (; cfg->nid; cfg++) |
| 1522 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1523 | } |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1524 | if (!pre_init && fix->verbs) { |
| 1525 | #ifdef CONFIG_SND_DEBUG_VERBOSE |
| 1526 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", |
| 1527 | codec->chip_name, quirk->name); |
| 1528 | #endif |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1529 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 1530 | } |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1531 | } |
| 1532 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1533 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1534 | unsigned int coef_idx) |
| 1535 | { |
| 1536 | unsigned int val; |
| 1537 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1538 | coef_idx); |
| 1539 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1540 | AC_VERB_GET_PROC_COEF, 0); |
| 1541 | return val; |
| 1542 | } |
| 1543 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1544 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1545 | * ALC888 |
| 1546 | */ |
| 1547 | |
| 1548 | /* |
| 1549 | * 2ch mode |
| 1550 | */ |
| 1551 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1552 | /* Mic-in jack as mic in */ |
| 1553 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1554 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1555 | /* Line-in jack as Line in */ |
| 1556 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1557 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1558 | /* Line-Out as Front */ |
| 1559 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1560 | { } /* end */ |
| 1561 | }; |
| 1562 | |
| 1563 | /* |
| 1564 | * 4ch mode |
| 1565 | */ |
| 1566 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1567 | /* Mic-in jack as mic in */ |
| 1568 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1569 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1570 | /* Line-in jack as Surround */ |
| 1571 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1572 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1573 | /* Line-Out as Front */ |
| 1574 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1575 | { } /* end */ |
| 1576 | }; |
| 1577 | |
| 1578 | /* |
| 1579 | * 6ch mode |
| 1580 | */ |
| 1581 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1582 | /* Mic-in jack as CLFE */ |
| 1583 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1584 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1585 | /* Line-in jack as Surround */ |
| 1586 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1587 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1588 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1589 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1590 | { } /* end */ |
| 1591 | }; |
| 1592 | |
| 1593 | /* |
| 1594 | * 8ch mode |
| 1595 | */ |
| 1596 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1597 | /* Mic-in jack as CLFE */ |
| 1598 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1599 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1600 | /* Line-in jack as Surround */ |
| 1601 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1602 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1603 | /* Line-Out as Side */ |
| 1604 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1605 | { } /* end */ |
| 1606 | }; |
| 1607 | |
| 1608 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1609 | { 2, alc888_4ST_ch2_intel_init }, |
| 1610 | { 4, alc888_4ST_ch4_intel_init }, |
| 1611 | { 6, alc888_4ST_ch6_intel_init }, |
| 1612 | { 8, alc888_4ST_ch8_intel_init }, |
| 1613 | }; |
| 1614 | |
| 1615 | /* |
| 1616 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1617 | */ |
| 1618 | |
| 1619 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1620 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1621 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1622 | /* Connect Internal HP to Front */ |
| 1623 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1624 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1625 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1626 | /* Connect Bass HP to Front */ |
| 1627 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1629 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1630 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1631 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1632 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1633 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1634 | /* Connect Mic jack to CLFE */ |
| 1635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1637 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1638 | /* Connect Line-in jack to Surround */ |
| 1639 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1640 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1642 | /* Connect HP out jack to Front */ |
| 1643 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1644 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1645 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1646 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1647 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1648 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1649 | {} |
| 1650 | }; |
| 1651 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1652 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1653 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1654 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1655 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1656 | hda_nid_t nid; |
| 1657 | int i; |
| 1658 | |
| 1659 | spec->jack_present = 0; |
| 1660 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1661 | nid = spec->autocfg.hp_pins[i]; |
| 1662 | if (!nid) |
| 1663 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1664 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1665 | spec->jack_present = 1; |
| 1666 | break; |
| 1667 | } |
| 1668 | } |
| 1669 | |
| 1670 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1671 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1672 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1673 | nid = spec->autocfg.speaker_pins[i]; |
| 1674 | if (!nid) |
| 1675 | break; |
| 1676 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1677 | HDA_AMP_MUTE, mute); |
| 1678 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1679 | } |
| 1680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1681 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1682 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1683 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1684 | if (codec->vendor_id == 0x10ec0880) |
| 1685 | res >>= 28; |
| 1686 | else |
| 1687 | res >>= 26; |
| 1688 | if (res == ALC880_HP_EVENT) |
| 1689 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1690 | } |
| 1691 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1692 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1693 | { |
| 1694 | struct alc_spec *spec = codec->spec; |
| 1695 | |
| 1696 | spec->autocfg.hp_pins[0] = 0x15; |
| 1697 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1698 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1699 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1700 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1701 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1702 | } |
| 1703 | |
| 1704 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1705 | { |
| 1706 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1707 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1708 | } |
| 1709 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1710 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1711 | { |
| 1712 | struct alc_spec *spec = codec->spec; |
| 1713 | |
| 1714 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1715 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1716 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1717 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1718 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1719 | |
| 1720 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1721 | * ALC888 Acer Aspire 4930G model |
| 1722 | */ |
| 1723 | |
| 1724 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1725 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1726 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1727 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1728 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1729 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1730 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1731 | /* Connect Internal HP to front */ |
| 1732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1733 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1734 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1735 | /* Connect HP out to front */ |
| 1736 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1737 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1738 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1739 | { } |
| 1740 | }; |
| 1741 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1742 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1743 | * ALC888 Acer Aspire 6530G model |
| 1744 | */ |
| 1745 | |
| 1746 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1747 | /* Route to built-in subwoofer as well as speakers */ |
| 1748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1749 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 1750 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1752 | /* Bias voltage on for external mic port */ |
| 1753 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1754 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1755 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1758 | /* Enable unsolicited event for HP jack */ |
| 1759 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1760 | /* Enable speaker output */ |
| 1761 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1763 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1764 | /* Enable headphone output */ |
| 1765 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1766 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1767 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Tony Vroon | d128418 | 2010-04-05 16:30:43 +0100 | [diff] [blame] | 1768 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1769 | { } |
| 1770 | }; |
| 1771 | |
| 1772 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1773 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1774 | */ |
| 1775 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1776 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1777 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1778 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1779 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1780 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1781 | /* Enable unsolicited event for HP jack */ |
| 1782 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1783 | /* Connect Internal Front to Front */ |
| 1784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1786 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1787 | /* Connect Internal Rear to Rear */ |
| 1788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1790 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1791 | /* Connect Internal CLFE to CLFE */ |
| 1792 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1793 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1794 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1795 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1796 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1797 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1798 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1799 | /* Enable all DACs */ |
| 1800 | /* DAC DISABLE/MUTE 1? */ |
| 1801 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1802 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1803 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1804 | /* DAC DISABLE/MUTE 2? */ |
| 1805 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1806 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1807 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1808 | /* DMIC fix |
| 1809 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1810 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1811 | * makes the signal become a difference/sum signal instead of standard |
| 1812 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1813 | * codec replicate the sum signal to both channels, turning it into a |
| 1814 | * normal mono mic. |
| 1815 | */ |
| 1816 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1817 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1818 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1819 | { } |
| 1820 | }; |
| 1821 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1822 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1823 | /* Front mic only available on one ADC */ |
| 1824 | { |
| 1825 | .num_items = 4, |
| 1826 | .items = { |
| 1827 | { "Mic", 0x0 }, |
| 1828 | { "Line", 0x2 }, |
| 1829 | { "CD", 0x4 }, |
| 1830 | { "Front Mic", 0xb }, |
| 1831 | }, |
| 1832 | }, |
| 1833 | { |
| 1834 | .num_items = 3, |
| 1835 | .items = { |
| 1836 | { "Mic", 0x0 }, |
| 1837 | { "Line", 0x2 }, |
| 1838 | { "CD", 0x4 }, |
| 1839 | }, |
| 1840 | } |
| 1841 | }; |
| 1842 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1843 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1844 | /* Interal mic only available on one ADC */ |
| 1845 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1846 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1847 | .items = { |
| 1848 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1849 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1850 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1851 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1852 | { "Int Mic", 0xb }, |
| 1853 | }, |
| 1854 | }, |
| 1855 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1856 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1857 | .items = { |
| 1858 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1859 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1860 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1861 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1862 | }, |
| 1863 | } |
| 1864 | }; |
| 1865 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1866 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1867 | /* Digital mic only available on first "ADC" */ |
| 1868 | { |
| 1869 | .num_items = 5, |
| 1870 | .items = { |
| 1871 | { "Mic", 0x0 }, |
| 1872 | { "Line", 0x2 }, |
| 1873 | { "CD", 0x4 }, |
| 1874 | { "Front Mic", 0xb }, |
| 1875 | { "Input Mix", 0xa }, |
| 1876 | }, |
| 1877 | }, |
| 1878 | { |
| 1879 | .num_items = 4, |
| 1880 | .items = { |
| 1881 | { "Mic", 0x0 }, |
| 1882 | { "Line", 0x2 }, |
| 1883 | { "CD", 0x4 }, |
| 1884 | { "Input Mix", 0xa }, |
| 1885 | }, |
| 1886 | }, |
| 1887 | { |
| 1888 | .num_items = 4, |
| 1889 | .items = { |
| 1890 | { "Mic", 0x0 }, |
| 1891 | { "Line", 0x2 }, |
| 1892 | { "CD", 0x4 }, |
| 1893 | { "Input Mix", 0xa }, |
| 1894 | }, |
| 1895 | } |
| 1896 | }; |
| 1897 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1898 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1899 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1900 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1901 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1902 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1903 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1904 | HDA_OUTPUT), |
| 1905 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1906 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1907 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1908 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1909 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1911 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1912 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1913 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1914 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1915 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1916 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1917 | { } /* end */ |
| 1918 | }; |
| 1919 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1920 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1921 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1922 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1923 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1924 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1925 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1926 | HDA_OUTPUT), |
| 1927 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1928 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1929 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1930 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1931 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1932 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1933 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1934 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1935 | { } /* end */ |
| 1936 | }; |
| 1937 | |
| 1938 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1939 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1940 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1941 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1942 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1943 | spec->autocfg.hp_pins[0] = 0x15; |
| 1944 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1945 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1946 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1947 | } |
| 1948 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1949 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1950 | { |
| 1951 | struct alc_spec *spec = codec->spec; |
| 1952 | |
| 1953 | spec->autocfg.hp_pins[0] = 0x15; |
| 1954 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1955 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1956 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1957 | } |
| 1958 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1959 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1960 | { |
| 1961 | struct alc_spec *spec = codec->spec; |
| 1962 | |
| 1963 | spec->autocfg.hp_pins[0] = 0x15; |
| 1964 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1965 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1966 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1967 | } |
| 1968 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1969 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1970 | * ALC880 3-stack model |
| 1971 | * |
| 1972 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1973 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1974 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1975 | */ |
| 1976 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1977 | static hda_nid_t alc880_dac_nids[4] = { |
| 1978 | /* front, rear, clfe, rear_surr */ |
| 1979 | 0x02, 0x05, 0x04, 0x03 |
| 1980 | }; |
| 1981 | |
| 1982 | static hda_nid_t alc880_adc_nids[3] = { |
| 1983 | /* ADC0-2 */ |
| 1984 | 0x07, 0x08, 0x09, |
| 1985 | }; |
| 1986 | |
| 1987 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1988 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1989 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1990 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1991 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1992 | /* ADC1-2 */ |
| 1993 | 0x08, 0x09, |
| 1994 | }; |
| 1995 | |
| 1996 | #define ALC880_DIGOUT_NID 0x06 |
| 1997 | #define ALC880_DIGIN_NID 0x0a |
| 1998 | |
| 1999 | static struct hda_input_mux alc880_capture_source = { |
| 2000 | .num_items = 4, |
| 2001 | .items = { |
| 2002 | { "Mic", 0x0 }, |
| 2003 | { "Front Mic", 0x3 }, |
| 2004 | { "Line", 0x2 }, |
| 2005 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2006 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | }; |
| 2008 | |
| 2009 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 2010 | /* 2ch mode */ |
| 2011 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 2012 | /* set line-in to input, mute it */ |
| 2013 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2014 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 2015 | /* set mic-in to input vref 80%, mute it */ |
| 2016 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2017 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2018 | { } /* end */ |
| 2019 | }; |
| 2020 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2021 | /* 6ch mode */ |
| 2022 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 2023 | /* set line-in to output, unmute it */ |
| 2024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2026 | /* set mic-in to output, unmute it */ |
| 2027 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2028 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2029 | { } /* end */ |
| 2030 | }; |
| 2031 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2032 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2033 | { 2, alc880_threestack_ch2_init }, |
| 2034 | { 6, alc880_threestack_ch6_init }, |
| 2035 | }; |
| 2036 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2037 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2040 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2041 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2042 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2043 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2044 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2045 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2046 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2047 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2048 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2049 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2050 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2051 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2052 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2053 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2054 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2055 | { |
| 2056 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2057 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2058 | .info = alc_ch_mode_info, |
| 2059 | .get = alc_ch_mode_get, |
| 2060 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2061 | }, |
| 2062 | { } /* end */ |
| 2063 | }; |
| 2064 | |
| 2065 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2066 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2067 | struct snd_ctl_elem_info *uinfo) |
| 2068 | { |
| 2069 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2070 | struct alc_spec *spec = codec->spec; |
| 2071 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2072 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2073 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2074 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2075 | HDA_INPUT); |
| 2076 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2077 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2078 | return err; |
| 2079 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2080 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2081 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2082 | unsigned int size, unsigned int __user *tlv) |
| 2083 | { |
| 2084 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2085 | struct alc_spec *spec = codec->spec; |
| 2086 | int err; |
| 2087 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2088 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2089 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2090 | HDA_INPUT); |
| 2091 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2092 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2093 | return err; |
| 2094 | } |
| 2095 | |
| 2096 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2097 | struct snd_ctl_elem_value *ucontrol); |
| 2098 | |
| 2099 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2100 | struct snd_ctl_elem_value *ucontrol, |
| 2101 | getput_call_t func) |
| 2102 | { |
| 2103 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2104 | struct alc_spec *spec = codec->spec; |
| 2105 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2106 | int err; |
| 2107 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2108 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2109 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2110 | 3, 0, HDA_INPUT); |
| 2111 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2112 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2113 | return err; |
| 2114 | } |
| 2115 | |
| 2116 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2117 | struct snd_ctl_elem_value *ucontrol) |
| 2118 | { |
| 2119 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2120 | snd_hda_mixer_amp_volume_get); |
| 2121 | } |
| 2122 | |
| 2123 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2124 | struct snd_ctl_elem_value *ucontrol) |
| 2125 | { |
| 2126 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2127 | snd_hda_mixer_amp_volume_put); |
| 2128 | } |
| 2129 | |
| 2130 | /* capture mixer elements */ |
| 2131 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2132 | |
| 2133 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2134 | struct snd_ctl_elem_value *ucontrol) |
| 2135 | { |
| 2136 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2137 | snd_hda_mixer_amp_switch_get); |
| 2138 | } |
| 2139 | |
| 2140 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2141 | struct snd_ctl_elem_value *ucontrol) |
| 2142 | { |
| 2143 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2144 | snd_hda_mixer_amp_switch_put); |
| 2145 | } |
| 2146 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2147 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2148 | { \ |
| 2149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2150 | .name = "Capture Switch", \ |
| 2151 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2152 | .count = num, \ |
| 2153 | .info = alc_cap_sw_info, \ |
| 2154 | .get = alc_cap_sw_get, \ |
| 2155 | .put = alc_cap_sw_put, \ |
| 2156 | }, \ |
| 2157 | { \ |
| 2158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2159 | .name = "Capture Volume", \ |
| 2160 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2161 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2162 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2163 | .count = num, \ |
| 2164 | .info = alc_cap_vol_info, \ |
| 2165 | .get = alc_cap_vol_get, \ |
| 2166 | .put = alc_cap_vol_put, \ |
| 2167 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2168 | } |
| 2169 | |
| 2170 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2171 | { \ |
| 2172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2173 | /* .name = "Capture Source", */ \ |
| 2174 | .name = "Input Source", \ |
| 2175 | .count = num, \ |
| 2176 | .info = alc_mux_enum_info, \ |
| 2177 | .get = alc_mux_enum_get, \ |
| 2178 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2179 | } |
| 2180 | |
| 2181 | #define DEFINE_CAPMIX(num) \ |
| 2182 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2183 | _DEFINE_CAPMIX(num), \ |
| 2184 | _DEFINE_CAPSRC(num), \ |
| 2185 | { } /* end */ \ |
| 2186 | } |
| 2187 | |
| 2188 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2189 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2190 | _DEFINE_CAPMIX(num), \ |
| 2191 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2192 | } |
| 2193 | |
| 2194 | /* up to three ADCs */ |
| 2195 | DEFINE_CAPMIX(1); |
| 2196 | DEFINE_CAPMIX(2); |
| 2197 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2198 | DEFINE_CAPMIX_NOSRC(1); |
| 2199 | DEFINE_CAPMIX_NOSRC(2); |
| 2200 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2201 | |
| 2202 | /* |
| 2203 | * ALC880 5-stack model |
| 2204 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2205 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2206 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2208 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2209 | */ |
| 2210 | |
| 2211 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2212 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2213 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2214 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2215 | { } /* end */ |
| 2216 | }; |
| 2217 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2218 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2219 | /* 6ch mode */ |
| 2220 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2221 | /* set line-in to input, mute it */ |
| 2222 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2223 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2224 | { } /* end */ |
| 2225 | }; |
| 2226 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2227 | /* 8ch mode */ |
| 2228 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2229 | /* set line-in to output, unmute it */ |
| 2230 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2231 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2232 | { } /* end */ |
| 2233 | }; |
| 2234 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2235 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2236 | { 6, alc880_fivestack_ch6_init }, |
| 2237 | { 8, alc880_fivestack_ch8_init }, |
| 2238 | }; |
| 2239 | |
| 2240 | |
| 2241 | /* |
| 2242 | * ALC880 6-stack model |
| 2243 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2244 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2245 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2246 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2247 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2248 | */ |
| 2249 | |
| 2250 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2251 | /* front, rear, clfe, rear_surr */ |
| 2252 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2253 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2254 | |
| 2255 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2256 | .num_items = 4, |
| 2257 | .items = { |
| 2258 | { "Mic", 0x0 }, |
| 2259 | { "Front Mic", 0x1 }, |
| 2260 | { "Line", 0x2 }, |
| 2261 | { "CD", 0x4 }, |
| 2262 | }, |
| 2263 | }; |
| 2264 | |
| 2265 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2266 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2267 | { 8, NULL }, |
| 2268 | }; |
| 2269 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2270 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2272 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2273 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2274 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2275 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2276 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2277 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2278 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2279 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2280 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2281 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2287 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2288 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2289 | { |
| 2290 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2291 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2292 | .info = alc_ch_mode_info, |
| 2293 | .get = alc_ch_mode_get, |
| 2294 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2295 | }, |
| 2296 | { } /* end */ |
| 2297 | }; |
| 2298 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2299 | |
| 2300 | /* |
| 2301 | * ALC880 W810 model |
| 2302 | * |
| 2303 | * W810 has rear IO for: |
| 2304 | * Front (DAC 02) |
| 2305 | * Surround (DAC 03) |
| 2306 | * Center/LFE (DAC 04) |
| 2307 | * Digital out (06) |
| 2308 | * |
| 2309 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2310 | * These are both connected to Line2 on the codec, hence to DAC 02. |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2311 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2312 | * There is a variable resistor to control the speaker or headphone |
| 2313 | * volume. This is a hardware-only device without a software API. |
| 2314 | * |
| 2315 | * Plugging headphones in will disable the internal speakers. This is |
| 2316 | * implemented in hardware, not via the driver using jack sense. In |
| 2317 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2318 | * disable both the speakers and headphones. |
| 2319 | * |
| 2320 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2321 | * These may not do anything useful with this driver yet, because I |
| 2322 | * haven't setup any initialization verbs for these yet... |
| 2323 | */ |
| 2324 | |
| 2325 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2326 | /* front, rear/surround, clfe */ |
| 2327 | 0x02, 0x03, 0x04 |
| 2328 | }; |
| 2329 | |
| 2330 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2331 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2332 | { 6, NULL } |
| 2333 | }; |
| 2334 | |
| 2335 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2336 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2337 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2338 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2340 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2341 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2342 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2343 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2344 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2345 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2346 | { } /* end */ |
| 2347 | }; |
| 2348 | |
| 2349 | |
| 2350 | /* |
| 2351 | * Z710V model |
| 2352 | * |
| 2353 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2354 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2355 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2356 | */ |
| 2357 | |
| 2358 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2359 | 0x02 |
| 2360 | }; |
| 2361 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2362 | |
| 2363 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2364 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2365 | { 2, NULL } |
| 2366 | }; |
| 2367 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2368 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2369 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2370 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2371 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2372 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2374 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2376 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2377 | { } /* end */ |
| 2378 | }; |
| 2379 | |
| 2380 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2381 | /* |
| 2382 | * ALC880 F1734 model |
| 2383 | * |
| 2384 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2385 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2386 | */ |
| 2387 | |
| 2388 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2389 | 0x03 |
| 2390 | }; |
| 2391 | #define ALC880_F1734_HP_DAC 0x02 |
| 2392 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2393 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2394 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2395 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2396 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2397 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2398 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2399 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2400 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2402 | { } /* end */ |
| 2403 | }; |
| 2404 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2405 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2406 | .num_items = 2, |
| 2407 | .items = { |
| 2408 | { "Mic", 0x1 }, |
| 2409 | { "CD", 0x4 }, |
| 2410 | }, |
| 2411 | }; |
| 2412 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* |
| 2415 | * ALC880 ASUS model |
| 2416 | * |
| 2417 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2418 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2419 | * Mic = 0x18, Line = 0x1a |
| 2420 | */ |
| 2421 | |
| 2422 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2423 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2424 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2425 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2426 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2427 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2428 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2429 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2430 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2431 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2432 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2433 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2434 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2435 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2438 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2439 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2440 | { |
| 2441 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2442 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2443 | .info = alc_ch_mode_info, |
| 2444 | .get = alc_ch_mode_get, |
| 2445 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2446 | }, |
| 2447 | { } /* end */ |
| 2448 | }; |
| 2449 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2450 | /* |
| 2451 | * ALC880 ASUS W1V model |
| 2452 | * |
| 2453 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2454 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2455 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2456 | */ |
| 2457 | |
| 2458 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2459 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2460 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2461 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2462 | { } /* end */ |
| 2463 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2464 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2465 | /* TCL S700 */ |
| 2466 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2467 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2468 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2469 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2472 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2473 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2474 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2475 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2476 | { } /* end */ |
| 2477 | }; |
| 2478 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2479 | /* Uniwill */ |
| 2480 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2481 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2482 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2483 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2484 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2489 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2490 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2491 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2492 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2493 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2494 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2495 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2496 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2497 | { |
| 2498 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2499 | .name = "Channel Mode", |
| 2500 | .info = alc_ch_mode_info, |
| 2501 | .get = alc_ch_mode_get, |
| 2502 | .put = alc_ch_mode_put, |
| 2503 | }, |
| 2504 | { } /* end */ |
| 2505 | }; |
| 2506 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2507 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2508 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2509 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2510 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2511 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2512 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2513 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2514 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2515 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2516 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2517 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2518 | { } /* end */ |
| 2519 | }; |
| 2520 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2521 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2522 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2523 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2524 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2525 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2526 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2527 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2528 | { } /* end */ |
| 2529 | }; |
| 2530 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2531 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2532 | * virtual master controls |
| 2533 | */ |
| 2534 | |
| 2535 | /* |
| 2536 | * slave controls for virtual master |
| 2537 | */ |
| 2538 | static const char *alc_slave_vols[] = { |
| 2539 | "Front Playback Volume", |
| 2540 | "Surround Playback Volume", |
| 2541 | "Center Playback Volume", |
| 2542 | "LFE Playback Volume", |
| 2543 | "Side Playback Volume", |
| 2544 | "Headphone Playback Volume", |
| 2545 | "Speaker Playback Volume", |
| 2546 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2547 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2548 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2549 | NULL, |
| 2550 | }; |
| 2551 | |
| 2552 | static const char *alc_slave_sws[] = { |
| 2553 | "Front Playback Switch", |
| 2554 | "Surround Playback Switch", |
| 2555 | "Center Playback Switch", |
| 2556 | "LFE Playback Switch", |
| 2557 | "Side Playback Switch", |
| 2558 | "Headphone Playback Switch", |
| 2559 | "Speaker Playback Switch", |
| 2560 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2561 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2562 | "Line-Out Playback Switch", |
| 2563 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2564 | NULL, |
| 2565 | }; |
| 2566 | |
| 2567 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2568 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2569 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2570 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2571 | #define NID_MAPPING (-1) |
| 2572 | |
| 2573 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2574 | #define SUBDEV_HP_ (1 << 6) |
| 2575 | #define SUBDEV_LINE_ (2 << 6) |
| 2576 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2577 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2578 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2579 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2580 | static void alc_free_kctls(struct hda_codec *codec); |
| 2581 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2582 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2583 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2584 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2585 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2586 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2587 | { } /* end */ |
| 2588 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2589 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2590 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2591 | static int alc_build_controls(struct hda_codec *codec) |
| 2592 | { |
| 2593 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 2f44f84 | 2010-06-22 11:12:32 +0200 | [diff] [blame] | 2594 | struct snd_kcontrol *kctl = NULL; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2595 | struct snd_kcontrol_new *knew; |
| 2596 | int i, j, err; |
| 2597 | unsigned int u; |
| 2598 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | |
| 2600 | for (i = 0; i < spec->num_mixers; i++) { |
| 2601 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2602 | if (err < 0) |
| 2603 | return err; |
| 2604 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2605 | if (spec->cap_mixer) { |
| 2606 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2607 | if (err < 0) |
| 2608 | return err; |
| 2609 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2610 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2611 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2612 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2613 | if (err < 0) |
| 2614 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2615 | if (!spec->no_analog) { |
| 2616 | err = snd_hda_create_spdif_share_sw(codec, |
| 2617 | &spec->multiout); |
| 2618 | if (err < 0) |
| 2619 | return err; |
| 2620 | spec->multiout.share_spdif = 1; |
| 2621 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2622 | } |
| 2623 | if (spec->dig_in_nid) { |
| 2624 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2625 | if (err < 0) |
| 2626 | return err; |
| 2627 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2628 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2629 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2630 | /* create beep controls if needed */ |
| 2631 | if (spec->beep_amp) { |
| 2632 | struct snd_kcontrol_new *knew; |
| 2633 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2634 | struct snd_kcontrol *kctl; |
| 2635 | kctl = snd_ctl_new1(knew, codec); |
| 2636 | if (!kctl) |
| 2637 | return -ENOMEM; |
| 2638 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2639 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2640 | if (err < 0) |
| 2641 | return err; |
| 2642 | } |
| 2643 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2644 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2645 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2646 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2647 | if (!spec->no_analog && |
| 2648 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2649 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2650 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2651 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2652 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2653 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2654 | if (err < 0) |
| 2655 | return err; |
| 2656 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2657 | if (!spec->no_analog && |
| 2658 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2659 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2660 | NULL, alc_slave_sws); |
| 2661 | if (err < 0) |
| 2662 | return err; |
| 2663 | } |
| 2664 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2665 | /* assign Capture Source enums to NID */ |
Takashi Iwai | fbe618f | 2010-06-11 11:24:58 +0200 | [diff] [blame] | 2666 | if (spec->capsrc_nids || spec->adc_nids) { |
| 2667 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2668 | if (!kctl) |
| 2669 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2670 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2671 | hda_nid_t *nids = spec->capsrc_nids; |
| 2672 | if (!nids) |
| 2673 | nids = spec->adc_nids; |
| 2674 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
| 2675 | if (err < 0) |
| 2676 | return err; |
| 2677 | } |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2678 | } |
| 2679 | if (spec->cap_mixer) { |
| 2680 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2681 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2682 | if (kname && strcmp(knew->name, kname) == 0) |
| 2683 | continue; |
| 2684 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2685 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2686 | err = snd_hda_add_nid(codec, kctl, i, |
| 2687 | spec->adc_nids[i]); |
| 2688 | if (err < 0) |
| 2689 | return err; |
| 2690 | } |
| 2691 | } |
| 2692 | } |
| 2693 | |
| 2694 | /* other nid->control mapping */ |
| 2695 | for (i = 0; i < spec->num_mixers; i++) { |
| 2696 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2697 | if (knew->iface != NID_MAPPING) |
| 2698 | continue; |
| 2699 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2700 | if (kctl == NULL) |
| 2701 | continue; |
| 2702 | u = knew->subdevice; |
| 2703 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2704 | nid = u & 0x3f; |
| 2705 | if (nid == 0) |
| 2706 | continue; |
| 2707 | switch (u & 0xc0) { |
| 2708 | case SUBDEV_SPEAKER_: |
| 2709 | nid = spec->autocfg.speaker_pins[nid]; |
| 2710 | break; |
| 2711 | case SUBDEV_LINE_: |
| 2712 | nid = spec->autocfg.line_out_pins[nid]; |
| 2713 | break; |
| 2714 | case SUBDEV_HP_: |
| 2715 | nid = spec->autocfg.hp_pins[nid]; |
| 2716 | break; |
| 2717 | default: |
| 2718 | continue; |
| 2719 | } |
| 2720 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2721 | if (err < 0) |
| 2722 | return err; |
| 2723 | } |
| 2724 | u = knew->private_value; |
| 2725 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2726 | nid = u & 0xff; |
| 2727 | if (nid == 0) |
| 2728 | continue; |
| 2729 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2730 | if (err < 0) |
| 2731 | return err; |
| 2732 | } |
| 2733 | } |
| 2734 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2735 | |
| 2736 | alc_free_kctls(codec); /* no longer needed */ |
| 2737 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2738 | return 0; |
| 2739 | } |
| 2740 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2741 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2742 | /* |
| 2743 | * initialize the codec volumes, etc |
| 2744 | */ |
| 2745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2746 | /* |
| 2747 | * generic initialization of ADC, input mixers and output mixers |
| 2748 | */ |
| 2749 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2750 | /* |
| 2751 | * Unmute ADC0-2 and set the default input to mic-in |
| 2752 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2753 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2755 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2756 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2757 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2758 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2759 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2760 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2761 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2762 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2763 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2764 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2765 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2768 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2769 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2770 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2771 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2772 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2773 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2774 | /* |
| 2775 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2776 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2777 | /* set vol=0 to output mixers */ |
| 2778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2782 | /* set up input amps for analog loopback */ |
| 2783 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2785 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2787 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2790 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2791 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2792 | |
| 2793 | { } |
| 2794 | }; |
| 2795 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | /* |
| 2797 | * 3-stack pin configuration: |
| 2798 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2799 | */ |
| 2800 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2801 | /* |
| 2802 | * preset connection lists of input pins |
| 2803 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2804 | */ |
| 2805 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2806 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2807 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2808 | |
| 2809 | /* |
| 2810 | * Set pin mode and muting |
| 2811 | */ |
| 2812 | /* set front pin widgets 0x14 for output */ |
| 2813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2814 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2815 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2818 | /* Mic2 (as headphone out) for HP output */ |
| 2819 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2820 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2821 | /* Line In pin widget for input */ |
| 2822 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2823 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2824 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2827 | /* CD pin widget for input */ |
| 2828 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2829 | |
| 2830 | { } |
| 2831 | }; |
| 2832 | |
| 2833 | /* |
| 2834 | * 5-stack pin configuration: |
| 2835 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2836 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2837 | */ |
| 2838 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2839 | /* |
| 2840 | * preset connection lists of input pins |
| 2841 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2842 | */ |
| 2843 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2844 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2845 | |
| 2846 | /* |
| 2847 | * Set pin mode and muting |
| 2848 | */ |
| 2849 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2852 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2853 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2854 | /* unmute pins for output (no gain on this amp) */ |
| 2855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2856 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2857 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2858 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2859 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2860 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2861 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2862 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2863 | /* Mic2 (as headphone out) for HP output */ |
| 2864 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2865 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2866 | /* Line In pin widget for input */ |
| 2867 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2868 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2869 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2870 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2871 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2872 | /* CD pin widget for input */ |
| 2873 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2874 | |
| 2875 | { } |
| 2876 | }; |
| 2877 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2878 | /* |
| 2879 | * W810 pin configuration: |
| 2880 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2881 | */ |
| 2882 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2883 | /* hphone/speaker input selector: front DAC */ |
| 2884 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2885 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2888 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2890 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2891 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2892 | |
| 2893 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2894 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2895 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2896 | { } |
| 2897 | }; |
| 2898 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2899 | /* |
| 2900 | * Z71V pin configuration: |
| 2901 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2902 | */ |
| 2903 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2904 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2905 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2906 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2908 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2909 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2911 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2912 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2913 | |
| 2914 | { } |
| 2915 | }; |
| 2916 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2917 | /* |
| 2918 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2919 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2920 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2921 | */ |
| 2922 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2923 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2924 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2926 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2927 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2929 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2930 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2931 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2932 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2933 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2934 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2935 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2936 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2937 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2938 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2939 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2941 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2942 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2943 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2944 | { } |
| 2945 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2946 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2947 | /* |
| 2948 | * Uniwill pin configuration: |
| 2949 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2950 | * line = 0x1a |
| 2951 | */ |
| 2952 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2953 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2954 | |
| 2955 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2958 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2960 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2961 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2962 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2963 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2964 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2966 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2968 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2969 | |
| 2970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2971 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2972 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2974 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2975 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2976 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2977 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2978 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2979 | |
| 2980 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2981 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2982 | |
| 2983 | { } |
| 2984 | }; |
| 2985 | |
| 2986 | /* |
| 2987 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2988 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2989 | */ |
| 2990 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2991 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2992 | |
| 2993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2996 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2997 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2998 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3000 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3001 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3002 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 3004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 3005 | |
| 3006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3007 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3008 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3009 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3010 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3012 | |
| 3013 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3014 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 3015 | |
| 3016 | { } |
| 3017 | }; |
| 3018 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3019 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 3020 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 3021 | { } |
| 3022 | }; |
| 3023 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3024 | /* auto-toggle front mic */ |
| 3025 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 3026 | { |
| 3027 | unsigned int present; |
| 3028 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3029 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 3030 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3031 | bits = present ? HDA_AMP_MUTE : 0; |
| 3032 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3033 | } |
| 3034 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3035 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3036 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3037 | struct alc_spec *spec = codec->spec; |
| 3038 | |
| 3039 | spec->autocfg.hp_pins[0] = 0x14; |
| 3040 | spec->autocfg.speaker_pins[0] = 0x15; |
| 3041 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3042 | } |
| 3043 | |
| 3044 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 3045 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3046 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3047 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3048 | } |
| 3049 | |
| 3050 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 3051 | unsigned int res) |
| 3052 | { |
| 3053 | /* Looks like the unsol event is incompatible with the standard |
| 3054 | * definition. 4bit tag is placed at 28 bit! |
| 3055 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3056 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3057 | case ALC880_MIC_EVENT: |
| 3058 | alc880_uniwill_mic_automute(codec); |
| 3059 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3060 | default: |
| 3061 | alc_automute_amp_unsol_event(codec, res); |
| 3062 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3063 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3064 | } |
| 3065 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3066 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3067 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3068 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3069 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3070 | spec->autocfg.hp_pins[0] = 0x14; |
| 3071 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3072 | } |
| 3073 | |
| 3074 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3075 | { |
| 3076 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3077 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3078 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3079 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3080 | present &= HDA_AMP_VOLMASK; |
| 3081 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3082 | HDA_AMP_VOLMASK, present); |
| 3083 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3084 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3085 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3086 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3087 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3088 | unsigned int res) |
| 3089 | { |
| 3090 | /* Looks like the unsol event is incompatible with the standard |
| 3091 | * definition. 4bit tag is placed at 28 bit! |
| 3092 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3093 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3094 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3095 | else |
| 3096 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3097 | } |
| 3098 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | /* |
| 3100 | * F1734 pin configuration: |
| 3101 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3102 | */ |
| 3103 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3104 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3105 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3106 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3107 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3108 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3109 | |
| 3110 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3113 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3114 | |
| 3115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3116 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3117 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3119 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3120 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3121 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3123 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3124 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3125 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3126 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3127 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | { } |
| 3129 | }; |
| 3130 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3131 | /* |
| 3132 | * ASUS pin configuration: |
| 3133 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3134 | */ |
| 3135 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3136 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3137 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3138 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3139 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3140 | |
| 3141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3144 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3145 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3146 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3147 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3148 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3149 | |
| 3150 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3151 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3152 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3155 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3156 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3157 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3158 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3159 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3160 | { } |
| 3161 | }; |
| 3162 | |
| 3163 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3164 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3165 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3166 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3168 | /* Clevo m520g init */ |
| 3169 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3170 | /* headphone output */ |
| 3171 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3172 | /* line-out */ |
| 3173 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3174 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3175 | /* Line-in */ |
| 3176 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3177 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3178 | /* CD */ |
| 3179 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3180 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3181 | /* Mic1 (rear panel) */ |
| 3182 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3183 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3184 | /* Mic2 (front panel) */ |
| 3185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3186 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | /* headphone */ |
| 3188 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3189 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3190 | /* change to EAPD mode */ |
| 3191 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3192 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3193 | |
| 3194 | { } |
| 3195 | }; |
| 3196 | |
| 3197 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3198 | /* change to EAPD mode */ |
| 3199 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3200 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3202 | /* Headphone output */ |
| 3203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3204 | /* Front output*/ |
| 3205 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3206 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3207 | |
| 3208 | /* Line In pin widget for input */ |
| 3209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3210 | /* CD pin widget for input */ |
| 3211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3213 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3214 | |
| 3215 | /* change to EAPD mode */ |
| 3216 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3217 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3218 | |
| 3219 | { } |
| 3220 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3221 | |
| 3222 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3223 | * LG m1 express dual |
| 3224 | * |
| 3225 | * Pin assignment: |
| 3226 | * Rear Line-In/Out (blue): 0x14 |
| 3227 | * Build-in Mic-In: 0x15 |
| 3228 | * Speaker-out: 0x17 |
| 3229 | * HP-Out (green): 0x1b |
| 3230 | * Mic-In/Out (red): 0x19 |
| 3231 | * SPDIF-Out: 0x1e |
| 3232 | */ |
| 3233 | |
| 3234 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3235 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3236 | 0x05, 0x02, 0x03 |
| 3237 | }; |
| 3238 | |
| 3239 | /* seems analog CD is not working */ |
| 3240 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3241 | .num_items = 3, |
| 3242 | .items = { |
| 3243 | { "Mic", 0x1 }, |
| 3244 | { "Line", 0x5 }, |
| 3245 | { "Internal Mic", 0x6 }, |
| 3246 | }, |
| 3247 | }; |
| 3248 | |
| 3249 | /* 2,4,6 channel modes */ |
| 3250 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3251 | /* set line-in and mic-in to input */ |
| 3252 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3253 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3254 | { } |
| 3255 | }; |
| 3256 | |
| 3257 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3258 | /* set line-in to out and mic-in to input */ |
| 3259 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3260 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3261 | { } |
| 3262 | }; |
| 3263 | |
| 3264 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3265 | /* set line-in and mic-in to output */ |
| 3266 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3267 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3268 | { } |
| 3269 | }; |
| 3270 | |
| 3271 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3272 | { 2, alc880_lg_ch2_init }, |
| 3273 | { 4, alc880_lg_ch4_init }, |
| 3274 | { 6, alc880_lg_ch6_init }, |
| 3275 | }; |
| 3276 | |
| 3277 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3279 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3280 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3281 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3282 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3283 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3284 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3285 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3288 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3289 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3290 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3291 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3292 | { |
| 3293 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3294 | .name = "Channel Mode", |
| 3295 | .info = alc_ch_mode_info, |
| 3296 | .get = alc_ch_mode_get, |
| 3297 | .put = alc_ch_mode_put, |
| 3298 | }, |
| 3299 | { } /* end */ |
| 3300 | }; |
| 3301 | |
| 3302 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3303 | /* set capture source to mic-in */ |
| 3304 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3305 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3306 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3307 | /* mute all amp mixer inputs */ |
| 3308 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3309 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3310 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3311 | /* line-in to input */ |
| 3312 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3313 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3314 | /* built-in mic */ |
| 3315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3316 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3317 | /* speaker-out */ |
| 3318 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3319 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3320 | /* mic-in to input */ |
| 3321 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3322 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3323 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3324 | /* HP-out */ |
| 3325 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3326 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3327 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3328 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3329 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3330 | { } |
| 3331 | }; |
| 3332 | |
| 3333 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3334 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3335 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3336 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3337 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3338 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3339 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3340 | } |
| 3341 | |
| 3342 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3343 | * LG LW20 |
| 3344 | * |
| 3345 | * Pin assignment: |
| 3346 | * Speaker-out: 0x14 |
| 3347 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3348 | * Built-in Mic-In: 0x19 |
| 3349 | * Line-In: 0x1b |
| 3350 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3351 | * SPDIF-Out: 0x1e |
| 3352 | */ |
| 3353 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3354 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3355 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3356 | .items = { |
| 3357 | { "Mic", 0x0 }, |
| 3358 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3359 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3360 | }, |
| 3361 | }; |
| 3362 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3363 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3364 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3365 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3366 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3367 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3368 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3369 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3370 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3371 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3372 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3373 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3378 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3379 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3380 | { |
| 3381 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3382 | .name = "Channel Mode", |
| 3383 | .info = alc_ch_mode_info, |
| 3384 | .get = alc_ch_mode_get, |
| 3385 | .put = alc_ch_mode_put, |
| 3386 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3387 | { } /* end */ |
| 3388 | }; |
| 3389 | |
| 3390 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3391 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3392 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3393 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3394 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3395 | /* set capture source to mic-in */ |
| 3396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3397 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3398 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3399 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3400 | /* speaker-out */ |
| 3401 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3402 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3403 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3404 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3405 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3406 | /* mic-in to input */ |
| 3407 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3408 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3409 | /* built-in mic */ |
| 3410 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3411 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3412 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3413 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3414 | { } |
| 3415 | }; |
| 3416 | |
| 3417 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3418 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3419 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3420 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3421 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3422 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3423 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3424 | } |
| 3425 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3426 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3427 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3428 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3431 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3432 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3433 | { } /* end */ |
| 3434 | }; |
| 3435 | |
| 3436 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3437 | .num_items = 2, |
| 3438 | .items = { |
| 3439 | { "Mic", 0x0 }, |
| 3440 | { "Internal Mic", 0x1 }, |
| 3441 | }, |
| 3442 | }; |
| 3443 | |
| 3444 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3445 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3446 | |
| 3447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3449 | |
| 3450 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3451 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3452 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3453 | /* Mic2 (as headphone out) for HP output */ |
| 3454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3455 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3456 | /* Internal Speaker */ |
| 3457 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3458 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3459 | |
| 3460 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3461 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3462 | |
| 3463 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3464 | { } |
| 3465 | }; |
| 3466 | |
| 3467 | /* toggle speaker-output according to the hp-jack state */ |
| 3468 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3469 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3470 | struct alc_spec *spec = codec->spec; |
| 3471 | alc_automute_amp(codec); |
| 3472 | /* toggle EAPD */ |
| 3473 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3474 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3475 | else |
| 3476 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3477 | } |
| 3478 | |
| 3479 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3480 | unsigned int res) |
| 3481 | { |
| 3482 | /* Looks like the unsol event is incompatible with the standard |
| 3483 | * definition. 4bit tag is placed at 28 bit! |
| 3484 | */ |
| 3485 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3486 | alc880_medion_rim_automute(codec); |
| 3487 | } |
| 3488 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3489 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3490 | { |
| 3491 | struct alc_spec *spec = codec->spec; |
| 3492 | |
| 3493 | spec->autocfg.hp_pins[0] = 0x14; |
| 3494 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3495 | } |
| 3496 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3497 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3498 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3499 | { 0x0b, HDA_INPUT, 0 }, |
| 3500 | { 0x0b, HDA_INPUT, 1 }, |
| 3501 | { 0x0b, HDA_INPUT, 2 }, |
| 3502 | { 0x0b, HDA_INPUT, 3 }, |
| 3503 | { 0x0b, HDA_INPUT, 4 }, |
| 3504 | { } /* end */ |
| 3505 | }; |
| 3506 | |
| 3507 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3508 | { 0x0b, HDA_INPUT, 1 }, |
| 3509 | { 0x0b, HDA_INPUT, 6 }, |
| 3510 | { 0x0b, HDA_INPUT, 7 }, |
| 3511 | { } /* end */ |
| 3512 | }; |
| 3513 | #endif |
| 3514 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3515 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3516 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3517 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3518 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3519 | static int alc_init(struct hda_codec *codec) |
| 3520 | { |
| 3521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3522 | unsigned int i; |
| 3523 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3524 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3525 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3526 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3527 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3528 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3529 | |
| 3530 | if (spec->init_hook) |
| 3531 | spec->init_hook(codec); |
| 3532 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3533 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3534 | if (codec->patch_ops.check_power_status) |
| 3535 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3536 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3537 | return 0; |
| 3538 | } |
| 3539 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3540 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3541 | { |
| 3542 | struct alc_spec *spec = codec->spec; |
| 3543 | |
| 3544 | if (spec->unsol_event) |
| 3545 | spec->unsol_event(codec, res); |
| 3546 | } |
| 3547 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3549 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3550 | { |
| 3551 | struct alc_spec *spec = codec->spec; |
| 3552 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3553 | } |
| 3554 | #endif |
| 3555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3556 | /* |
| 3557 | * Analog playback callbacks |
| 3558 | */ |
| 3559 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3560 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3561 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3562 | { |
| 3563 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3564 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3565 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3566 | } |
| 3567 | |
| 3568 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3569 | struct hda_codec *codec, |
| 3570 | unsigned int stream_tag, |
| 3571 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3572 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3573 | { |
| 3574 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3575 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3576 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3577 | } |
| 3578 | |
| 3579 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3580 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3581 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3582 | { |
| 3583 | struct alc_spec *spec = codec->spec; |
| 3584 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3585 | } |
| 3586 | |
| 3587 | /* |
| 3588 | * Digital out |
| 3589 | */ |
| 3590 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3591 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3592 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3593 | { |
| 3594 | struct alc_spec *spec = codec->spec; |
| 3595 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3596 | } |
| 3597 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3598 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3599 | struct hda_codec *codec, |
| 3600 | unsigned int stream_tag, |
| 3601 | unsigned int format, |
| 3602 | struct snd_pcm_substream *substream) |
| 3603 | { |
| 3604 | struct alc_spec *spec = codec->spec; |
| 3605 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3606 | stream_tag, format, substream); |
| 3607 | } |
| 3608 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3609 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3610 | struct hda_codec *codec, |
| 3611 | struct snd_pcm_substream *substream) |
| 3612 | { |
| 3613 | struct alc_spec *spec = codec->spec; |
| 3614 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3615 | } |
| 3616 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3617 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3618 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3619 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3620 | { |
| 3621 | struct alc_spec *spec = codec->spec; |
| 3622 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3623 | } |
| 3624 | |
| 3625 | /* |
| 3626 | * Analog capture |
| 3627 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3628 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3629 | struct hda_codec *codec, |
| 3630 | unsigned int stream_tag, |
| 3631 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3632 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3633 | { |
| 3634 | struct alc_spec *spec = codec->spec; |
| 3635 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3636 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3637 | stream_tag, 0, format); |
| 3638 | return 0; |
| 3639 | } |
| 3640 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3641 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3642 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3643 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | { |
| 3645 | struct alc_spec *spec = codec->spec; |
| 3646 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3647 | snd_hda_codec_cleanup_stream(codec, |
| 3648 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3649 | return 0; |
| 3650 | } |
| 3651 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 3652 | /* analog capture with dynamic dual-adc changes */ |
| 3653 | static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3654 | struct hda_codec *codec, |
| 3655 | unsigned int stream_tag, |
| 3656 | unsigned int format, |
| 3657 | struct snd_pcm_substream *substream) |
| 3658 | { |
| 3659 | struct alc_spec *spec = codec->spec; |
| 3660 | spec->cur_adc = spec->adc_nids[spec->cur_adc_idx]; |
| 3661 | spec->cur_adc_stream_tag = stream_tag; |
| 3662 | spec->cur_adc_format = format; |
| 3663 | snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format); |
| 3664 | return 0; |
| 3665 | } |
| 3666 | |
| 3667 | static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3668 | struct hda_codec *codec, |
| 3669 | struct snd_pcm_substream *substream) |
| 3670 | { |
| 3671 | struct alc_spec *spec = codec->spec; |
| 3672 | snd_hda_codec_cleanup_stream(codec, spec->cur_adc); |
| 3673 | spec->cur_adc = 0; |
| 3674 | return 0; |
| 3675 | } |
| 3676 | |
| 3677 | static struct hda_pcm_stream dualmic_pcm_analog_capture = { |
| 3678 | .substreams = 1, |
| 3679 | .channels_min = 2, |
| 3680 | .channels_max = 2, |
| 3681 | .nid = 0, /* fill later */ |
| 3682 | .ops = { |
| 3683 | .prepare = dualmic_capture_pcm_prepare, |
| 3684 | .cleanup = dualmic_capture_pcm_cleanup |
| 3685 | }, |
| 3686 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3687 | |
| 3688 | /* |
| 3689 | */ |
| 3690 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3691 | .substreams = 1, |
| 3692 | .channels_min = 2, |
| 3693 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3694 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3695 | .ops = { |
| 3696 | .open = alc880_playback_pcm_open, |
| 3697 | .prepare = alc880_playback_pcm_prepare, |
| 3698 | .cleanup = alc880_playback_pcm_cleanup |
| 3699 | }, |
| 3700 | }; |
| 3701 | |
| 3702 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3703 | .substreams = 1, |
| 3704 | .channels_min = 2, |
| 3705 | .channels_max = 2, |
| 3706 | /* NID is set in alc_build_pcms */ |
| 3707 | }; |
| 3708 | |
| 3709 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3710 | .substreams = 1, |
| 3711 | .channels_min = 2, |
| 3712 | .channels_max = 2, |
| 3713 | /* NID is set in alc_build_pcms */ |
| 3714 | }; |
| 3715 | |
| 3716 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3717 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3718 | .channels_min = 2, |
| 3719 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3720 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3721 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3722 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3723 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3724 | }, |
| 3725 | }; |
| 3726 | |
| 3727 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3728 | .substreams = 1, |
| 3729 | .channels_min = 2, |
| 3730 | .channels_max = 2, |
| 3731 | /* NID is set in alc_build_pcms */ |
| 3732 | .ops = { |
| 3733 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3734 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3735 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3736 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3737 | }, |
| 3738 | }; |
| 3739 | |
| 3740 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3741 | .substreams = 1, |
| 3742 | .channels_min = 2, |
| 3743 | .channels_max = 2, |
| 3744 | /* NID is set in alc_build_pcms */ |
| 3745 | }; |
| 3746 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3747 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3748 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3749 | .substreams = 0, |
| 3750 | .channels_min = 0, |
| 3751 | .channels_max = 0, |
| 3752 | }; |
| 3753 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3754 | static int alc_build_pcms(struct hda_codec *codec) |
| 3755 | { |
| 3756 | struct alc_spec *spec = codec->spec; |
| 3757 | struct hda_pcm *info = spec->pcm_rec; |
| 3758 | int i; |
| 3759 | |
| 3760 | codec->num_pcms = 1; |
| 3761 | codec->pcm_info = info; |
| 3762 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3763 | if (spec->no_analog) |
| 3764 | goto skip_analog; |
| 3765 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3766 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3767 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3768 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3769 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3770 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3771 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3772 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3773 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3774 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3775 | } |
| 3776 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3777 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3778 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3779 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3780 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3781 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3782 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3783 | if (spec->channel_mode) { |
| 3784 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3785 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3786 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3787 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3788 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3789 | } |
| 3790 | } |
| 3791 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3792 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3793 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3794 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3795 | snprintf(spec->stream_name_digital, |
| 3796 | sizeof(spec->stream_name_digital), |
| 3797 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3798 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3799 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3800 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3801 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3802 | if (spec->dig_out_type) |
| 3803 | info->pcm_type = spec->dig_out_type; |
| 3804 | else |
| 3805 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3806 | if (spec->multiout.dig_out_nid && |
| 3807 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3808 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3809 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3810 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3811 | if (spec->dig_in_nid && |
| 3812 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3813 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3814 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3815 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3816 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3817 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3818 | } |
| 3819 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3820 | if (spec->no_analog) |
| 3821 | return 0; |
| 3822 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3823 | /* If the use of more than one ADC is requested for the current |
| 3824 | * model, configure a second analog capture-only PCM. |
| 3825 | */ |
| 3826 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3827 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3828 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3829 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3830 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3831 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3832 | if (spec->alt_dac_nid) { |
| 3833 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3834 | *spec->stream_analog_alt_playback; |
| 3835 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3836 | spec->alt_dac_nid; |
| 3837 | } else { |
| 3838 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3839 | alc_pcm_null_stream; |
| 3840 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3841 | } |
| 3842 | if (spec->num_adc_nids > 1) { |
| 3843 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3844 | *spec->stream_analog_alt_capture; |
| 3845 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3846 | spec->adc_nids[1]; |
| 3847 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3848 | spec->num_adc_nids - 1; |
| 3849 | } else { |
| 3850 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3851 | alc_pcm_null_stream; |
| 3852 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3853 | } |
| 3854 | } |
| 3855 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3856 | return 0; |
| 3857 | } |
| 3858 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3859 | static inline void alc_shutup(struct hda_codec *codec) |
| 3860 | { |
| 3861 | snd_hda_shutup_pins(codec); |
| 3862 | } |
| 3863 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3864 | static void alc_free_kctls(struct hda_codec *codec) |
| 3865 | { |
| 3866 | struct alc_spec *spec = codec->spec; |
| 3867 | |
| 3868 | if (spec->kctls.list) { |
| 3869 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3870 | int i; |
| 3871 | for (i = 0; i < spec->kctls.used; i++) |
| 3872 | kfree(kctl[i].name); |
| 3873 | } |
| 3874 | snd_array_free(&spec->kctls); |
| 3875 | } |
| 3876 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3877 | static void alc_free(struct hda_codec *codec) |
| 3878 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3879 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3880 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3881 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3882 | return; |
| 3883 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3884 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3885 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3886 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3887 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3888 | } |
| 3889 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3890 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3891 | static void alc_power_eapd(struct hda_codec *codec) |
| 3892 | { |
| 3893 | /* We currently only handle front, HP */ |
| 3894 | switch (codec->vendor_id) { |
| 3895 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3896 | set_eapd(codec, 0x0f, 0); |
| 3897 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3898 | break; |
| 3899 | case 0x10ec0262: |
| 3900 | case 0x10ec0267: |
| 3901 | case 0x10ec0268: |
| 3902 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3903 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3904 | case 0x10ec0272: |
| 3905 | case 0x10ec0660: |
| 3906 | case 0x10ec0662: |
| 3907 | case 0x10ec0663: |
| 3908 | case 0x10ec0862: |
| 3909 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3910 | set_eapd(codec, 0x14, 0); |
| 3911 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3912 | break; |
| 3913 | } |
| 3914 | } |
| 3915 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3916 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3917 | { |
| 3918 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3919 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3920 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3921 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3922 | return 0; |
| 3923 | } |
| 3924 | #endif |
| 3925 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3926 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3927 | static int alc_resume(struct hda_codec *codec) |
| 3928 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3929 | codec->patch_ops.init(codec); |
| 3930 | snd_hda_codec_resume_amp(codec); |
| 3931 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3933 | if (codec->patch_ops.check_power_status) |
| 3934 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3935 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3936 | return 0; |
| 3937 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3938 | #endif |
| 3939 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3940 | /* |
| 3941 | */ |
| 3942 | static struct hda_codec_ops alc_patch_ops = { |
| 3943 | .build_controls = alc_build_controls, |
| 3944 | .build_pcms = alc_build_pcms, |
| 3945 | .init = alc_init, |
| 3946 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3947 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3948 | #ifdef SND_HDA_NEEDS_RESUME |
| 3949 | .resume = alc_resume, |
| 3950 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3951 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3952 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3953 | .check_power_status = alc_check_power_status, |
| 3954 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3955 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3956 | }; |
| 3957 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 3958 | /* replace the codec chip_name with the given string */ |
| 3959 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 3960 | { |
| 3961 | kfree(codec->chip_name); |
| 3962 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 3963 | if (!codec->chip_name) { |
| 3964 | alc_free(codec); |
| 3965 | return -ENOMEM; |
| 3966 | } |
| 3967 | return 0; |
| 3968 | } |
| 3969 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3970 | /* |
| 3971 | * Test configuration for debugging |
| 3972 | * |
| 3973 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3974 | * enum controls. |
| 3975 | */ |
| 3976 | #ifdef CONFIG_SND_DEBUG |
| 3977 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3978 | 0x02, 0x03, 0x04, 0x05 |
| 3979 | }; |
| 3980 | |
| 3981 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3982 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3983 | .items = { |
| 3984 | { "In-1", 0x0 }, |
| 3985 | { "In-2", 0x1 }, |
| 3986 | { "In-3", 0x2 }, |
| 3987 | { "In-4", 0x3 }, |
| 3988 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3989 | { "Front", 0x5 }, |
| 3990 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3991 | }, |
| 3992 | }; |
| 3993 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3994 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3995 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3996 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3997 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3998 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3999 | }; |
| 4000 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4001 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 4002 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4003 | { |
| 4004 | static char *texts[] = { |
| 4005 | "N/A", "Line Out", "HP Out", |
| 4006 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 4007 | }; |
| 4008 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4009 | uinfo->count = 1; |
| 4010 | uinfo->value.enumerated.items = 8; |
| 4011 | if (uinfo->value.enumerated.item >= 8) |
| 4012 | uinfo->value.enumerated.item = 7; |
| 4013 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4014 | return 0; |
| 4015 | } |
| 4016 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4017 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 4018 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4019 | { |
| 4020 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4021 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4022 | unsigned int pin_ctl, item = 0; |
| 4023 | |
| 4024 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4025 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4026 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 4027 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 4028 | item = 2; |
| 4029 | else |
| 4030 | item = 1; |
| 4031 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4032 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 4033 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 4034 | case AC_PINCTL_VREF_50: item = 4; break; |
| 4035 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 4036 | case AC_PINCTL_VREF_80: item = 6; break; |
| 4037 | case AC_PINCTL_VREF_100: item = 7; break; |
| 4038 | } |
| 4039 | } |
| 4040 | ucontrol->value.enumerated.item[0] = item; |
| 4041 | return 0; |
| 4042 | } |
| 4043 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4044 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 4045 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4046 | { |
| 4047 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4048 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4049 | static unsigned int ctls[] = { |
| 4050 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 4051 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 4052 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 4053 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 4054 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 4055 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 4056 | }; |
| 4057 | unsigned int old_ctl, new_ctl; |
| 4058 | |
| 4059 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 4060 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4061 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 4062 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4063 | int val; |
| 4064 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4065 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4066 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 4067 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 4068 | HDA_AMP_MUTE : 0; |
| 4069 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 4070 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4071 | return 1; |
| 4072 | } |
| 4073 | return 0; |
| 4074 | } |
| 4075 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4076 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 4077 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4078 | { |
| 4079 | static char *texts[] = { |
| 4080 | "Front", "Surround", "CLFE", "Side" |
| 4081 | }; |
| 4082 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 4083 | uinfo->count = 1; |
| 4084 | uinfo->value.enumerated.items = 4; |
| 4085 | if (uinfo->value.enumerated.item >= 4) |
| 4086 | uinfo->value.enumerated.item = 3; |
| 4087 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 4088 | return 0; |
| 4089 | } |
| 4090 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4091 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 4092 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4093 | { |
| 4094 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4095 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4096 | unsigned int sel; |
| 4097 | |
| 4098 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4099 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4100 | return 0; |
| 4101 | } |
| 4102 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4103 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4104 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4105 | { |
| 4106 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4107 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4108 | unsigned int sel; |
| 4109 | |
| 4110 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4111 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4112 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4113 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4114 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4115 | return 1; |
| 4116 | } |
| 4117 | return 0; |
| 4118 | } |
| 4119 | |
| 4120 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4121 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4122 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4123 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4124 | .info = alc_test_pin_ctl_info, \ |
| 4125 | .get = alc_test_pin_ctl_get, \ |
| 4126 | .put = alc_test_pin_ctl_put, \ |
| 4127 | .private_value = nid \ |
| 4128 | } |
| 4129 | |
| 4130 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4131 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4132 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4133 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4134 | .info = alc_test_pin_src_info, \ |
| 4135 | .get = alc_test_pin_src_get, \ |
| 4136 | .put = alc_test_pin_src_put, \ |
| 4137 | .private_value = nid \ |
| 4138 | } |
| 4139 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4140 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4141 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4142 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4143 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4144 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4145 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4146 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4147 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4148 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4149 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4150 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4151 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4152 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4153 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4154 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4155 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4156 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4157 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4158 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4159 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4160 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4161 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4162 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4163 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4164 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4165 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4166 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4167 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4168 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4169 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4170 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4171 | { |
| 4172 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4173 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4174 | .info = alc_ch_mode_info, |
| 4175 | .get = alc_ch_mode_get, |
| 4176 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4177 | }, |
| 4178 | { } /* end */ |
| 4179 | }; |
| 4180 | |
| 4181 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4182 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4183 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4184 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4185 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4186 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4187 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4188 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4189 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4190 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4191 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4192 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4193 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4194 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4195 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4196 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4197 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4199 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4200 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4201 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4202 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4204 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4205 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4206 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4207 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4208 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4209 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4210 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4211 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4212 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4215 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4216 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4217 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4219 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4220 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4221 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4222 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4223 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4224 | /* Analog input/passthru */ |
| 4225 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4226 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4227 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4228 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4229 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4230 | { } |
| 4231 | }; |
| 4232 | #endif |
| 4233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4234 | /* |
| 4235 | */ |
| 4236 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4237 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4238 | [ALC880_3ST] = "3stack", |
| 4239 | [ALC880_TCL_S700] = "tcl", |
| 4240 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4241 | [ALC880_CLEVO] = "clevo", |
| 4242 | [ALC880_5ST] = "5stack", |
| 4243 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4244 | [ALC880_W810] = "w810", |
| 4245 | [ALC880_Z71V] = "z71v", |
| 4246 | [ALC880_6ST] = "6stack", |
| 4247 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4248 | [ALC880_ASUS] = "asus", |
| 4249 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4250 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4251 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4252 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4253 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4254 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4255 | [ALC880_F1734] = "F1734", |
| 4256 | [ALC880_LG] = "lg", |
| 4257 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4258 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4259 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4260 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4261 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4262 | [ALC880_AUTO] = "auto", |
| 4263 | }; |
| 4264 | |
| 4265 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4266 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4267 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4268 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4269 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4270 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4271 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4272 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4273 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4274 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4275 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4276 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4277 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4278 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4279 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4280 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4281 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4282 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4283 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4284 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4285 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4286 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4287 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4288 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4289 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4290 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4291 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4292 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4293 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4294 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4295 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4296 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4297 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4298 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4299 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4300 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4301 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4302 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4303 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4304 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4305 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4306 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4307 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4308 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4309 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4310 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4311 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4312 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4313 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4314 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Daniel T Chen | 3353541 | 2010-04-22 07:15:26 -0400 | [diff] [blame] | 4315 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4316 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4317 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4318 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4319 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4320 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4321 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4322 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4323 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4324 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4325 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4326 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4327 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4328 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4329 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4330 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4331 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4332 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4333 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4334 | /* default Intel */ |
| 4335 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4336 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4337 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4338 | {} |
| 4339 | }; |
| 4340 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4341 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4342 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4343 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4344 | static struct alc_config_preset alc880_presets[] = { |
| 4345 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4346 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4347 | .init_verbs = { alc880_volume_init_verbs, |
| 4348 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4349 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4350 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4351 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4352 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4353 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4354 | .input_mux = &alc880_capture_source, |
| 4355 | }, |
| 4356 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4358 | .init_verbs = { alc880_volume_init_verbs, |
| 4359 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4360 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4361 | .dac_nids = alc880_dac_nids, |
| 4362 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4363 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4364 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4365 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4366 | .input_mux = &alc880_capture_source, |
| 4367 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4368 | [ALC880_TCL_S700] = { |
| 4369 | .mixers = { alc880_tcl_s700_mixer }, |
| 4370 | .init_verbs = { alc880_volume_init_verbs, |
| 4371 | alc880_pin_tcl_S700_init_verbs, |
| 4372 | alc880_gpio2_init_verbs }, |
| 4373 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4374 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4375 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4376 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4377 | .hp_nid = 0x03, |
| 4378 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4379 | .channel_mode = alc880_2_jack_modes, |
| 4380 | .input_mux = &alc880_capture_source, |
| 4381 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4382 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4383 | .mixers = { alc880_three_stack_mixer, |
| 4384 | alc880_five_stack_mixer}, |
| 4385 | .init_verbs = { alc880_volume_init_verbs, |
| 4386 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4387 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4388 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4389 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4390 | .channel_mode = alc880_fivestack_modes, |
| 4391 | .input_mux = &alc880_capture_source, |
| 4392 | }, |
| 4393 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4394 | .mixers = { alc880_three_stack_mixer, |
| 4395 | alc880_five_stack_mixer }, |
| 4396 | .init_verbs = { alc880_volume_init_verbs, |
| 4397 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4398 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4399 | .dac_nids = alc880_dac_nids, |
| 4400 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4401 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4402 | .channel_mode = alc880_fivestack_modes, |
| 4403 | .input_mux = &alc880_capture_source, |
| 4404 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4405 | [ALC880_6ST] = { |
| 4406 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4407 | .init_verbs = { alc880_volume_init_verbs, |
| 4408 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4409 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4410 | .dac_nids = alc880_6st_dac_nids, |
| 4411 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4412 | .channel_mode = alc880_sixstack_modes, |
| 4413 | .input_mux = &alc880_6stack_capture_source, |
| 4414 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4415 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4416 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4417 | .init_verbs = { alc880_volume_init_verbs, |
| 4418 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4419 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4420 | .dac_nids = alc880_6st_dac_nids, |
| 4421 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4422 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4423 | .channel_mode = alc880_sixstack_modes, |
| 4424 | .input_mux = &alc880_6stack_capture_source, |
| 4425 | }, |
| 4426 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4427 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4428 | .init_verbs = { alc880_volume_init_verbs, |
| 4429 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4430 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4431 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4432 | .dac_nids = alc880_w810_dac_nids, |
| 4433 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4434 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4435 | .channel_mode = alc880_w810_modes, |
| 4436 | .input_mux = &alc880_capture_source, |
| 4437 | }, |
| 4438 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4439 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4440 | .init_verbs = { alc880_volume_init_verbs, |
| 4441 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4442 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4443 | .dac_nids = alc880_z71v_dac_nids, |
| 4444 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4445 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4446 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4447 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4448 | .input_mux = &alc880_capture_source, |
| 4449 | }, |
| 4450 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4451 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4452 | .init_verbs = { alc880_volume_init_verbs, |
| 4453 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4454 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4455 | .dac_nids = alc880_f1734_dac_nids, |
| 4456 | .hp_nid = 0x02, |
| 4457 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4458 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4459 | .input_mux = &alc880_f1734_capture_source, |
| 4460 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4461 | .setup = alc880_uniwill_p53_setup, |
| 4462 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4463 | }, |
| 4464 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4465 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4466 | .init_verbs = { alc880_volume_init_verbs, |
| 4467 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4468 | alc880_gpio1_init_verbs }, |
| 4469 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4470 | .dac_nids = alc880_asus_dac_nids, |
| 4471 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4472 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4473 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4474 | .input_mux = &alc880_capture_source, |
| 4475 | }, |
| 4476 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4478 | .init_verbs = { alc880_volume_init_verbs, |
| 4479 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4480 | alc880_gpio1_init_verbs }, |
| 4481 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4482 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4483 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4484 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4485 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4486 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4487 | .input_mux = &alc880_capture_source, |
| 4488 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4489 | [ALC880_ASUS_DIG2] = { |
| 4490 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4491 | .init_verbs = { alc880_volume_init_verbs, |
| 4492 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4493 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4494 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4495 | .dac_nids = alc880_asus_dac_nids, |
| 4496 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4497 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4498 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4499 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4500 | .input_mux = &alc880_capture_source, |
| 4501 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4502 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4503 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4504 | .init_verbs = { alc880_volume_init_verbs, |
| 4505 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4506 | alc880_gpio1_init_verbs }, |
| 4507 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4508 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4509 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4511 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4512 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4513 | .input_mux = &alc880_capture_source, |
| 4514 | }, |
| 4515 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4516 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4517 | .init_verbs = { alc880_volume_init_verbs, |
| 4518 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4519 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4520 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4521 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4523 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4524 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4525 | .input_mux = &alc880_capture_source, |
| 4526 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4527 | [ALC880_UNIWILL] = { |
| 4528 | .mixers = { alc880_uniwill_mixer }, |
| 4529 | .init_verbs = { alc880_volume_init_verbs, |
| 4530 | alc880_uniwill_init_verbs }, |
| 4531 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4532 | .dac_nids = alc880_asus_dac_nids, |
| 4533 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4534 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4535 | .channel_mode = alc880_threestack_modes, |
| 4536 | .need_dac_fix = 1, |
| 4537 | .input_mux = &alc880_capture_source, |
| 4538 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4539 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4540 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4541 | }, |
| 4542 | [ALC880_UNIWILL_P53] = { |
| 4543 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4544 | .init_verbs = { alc880_volume_init_verbs, |
| 4545 | alc880_uniwill_p53_init_verbs }, |
| 4546 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4547 | .dac_nids = alc880_asus_dac_nids, |
| 4548 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4549 | .channel_mode = alc880_threestack_modes, |
| 4550 | .input_mux = &alc880_capture_source, |
| 4551 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4552 | .setup = alc880_uniwill_p53_setup, |
| 4553 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4554 | }, |
| 4555 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4556 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4557 | .init_verbs = { alc880_volume_init_verbs, |
| 4558 | alc880_uniwill_p53_init_verbs, |
| 4559 | alc880_beep_init_verbs }, |
| 4560 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4561 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4562 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4563 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4564 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4565 | .input_mux = &alc880_capture_source, |
| 4566 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4567 | .setup = alc880_uniwill_p53_setup, |
| 4568 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4569 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4570 | [ALC880_CLEVO] = { |
| 4571 | .mixers = { alc880_three_stack_mixer }, |
| 4572 | .init_verbs = { alc880_volume_init_verbs, |
| 4573 | alc880_pin_clevo_init_verbs }, |
| 4574 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4575 | .dac_nids = alc880_dac_nids, |
| 4576 | .hp_nid = 0x03, |
| 4577 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4578 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4579 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4580 | .input_mux = &alc880_capture_source, |
| 4581 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4582 | [ALC880_LG] = { |
| 4583 | .mixers = { alc880_lg_mixer }, |
| 4584 | .init_verbs = { alc880_volume_init_verbs, |
| 4585 | alc880_lg_init_verbs }, |
| 4586 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4587 | .dac_nids = alc880_lg_dac_nids, |
| 4588 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4589 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4590 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4591 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4592 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4593 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4594 | .setup = alc880_lg_setup, |
| 4595 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4596 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4597 | .loopbacks = alc880_lg_loopbacks, |
| 4598 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4599 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4600 | [ALC880_LG_LW] = { |
| 4601 | .mixers = { alc880_lg_lw_mixer }, |
| 4602 | .init_verbs = { alc880_volume_init_verbs, |
| 4603 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4604 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4605 | .dac_nids = alc880_dac_nids, |
| 4606 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4607 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4608 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4609 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4610 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4611 | .setup = alc880_lg_lw_setup, |
| 4612 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4613 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4614 | [ALC880_MEDION_RIM] = { |
| 4615 | .mixers = { alc880_medion_rim_mixer }, |
| 4616 | .init_verbs = { alc880_volume_init_verbs, |
| 4617 | alc880_medion_rim_init_verbs, |
| 4618 | alc_gpio2_init_verbs }, |
| 4619 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4620 | .dac_nids = alc880_dac_nids, |
| 4621 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4622 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4623 | .channel_mode = alc880_2_jack_modes, |
| 4624 | .input_mux = &alc880_medion_rim_capture_source, |
| 4625 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4626 | .setup = alc880_medion_rim_setup, |
| 4627 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4628 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4629 | #ifdef CONFIG_SND_DEBUG |
| 4630 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4631 | .mixers = { alc880_test_mixer }, |
| 4632 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4633 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4634 | .dac_nids = alc880_test_dac_nids, |
| 4635 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4636 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4637 | .channel_mode = alc880_test_modes, |
| 4638 | .input_mux = &alc880_test_capture_source, |
| 4639 | }, |
| 4640 | #endif |
| 4641 | }; |
| 4642 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4643 | /* |
| 4644 | * Automatic parse of I/O pins from the BIOS configuration |
| 4645 | */ |
| 4646 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4647 | enum { |
| 4648 | ALC_CTL_WIDGET_VOL, |
| 4649 | ALC_CTL_WIDGET_MUTE, |
| 4650 | ALC_CTL_BIND_MUTE, |
| 4651 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4652 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4653 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4654 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4655 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4656 | }; |
| 4657 | |
| 4658 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4659 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4660 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4661 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4662 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4663 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4664 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4665 | knew = snd_array_new(&spec->kctls); |
| 4666 | if (!knew) |
| 4667 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4668 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4669 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4670 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4671 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4672 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4673 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4674 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4675 | return 0; |
| 4676 | } |
| 4677 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4678 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4679 | const char *pfx, const char *dir, |
| 4680 | const char *sfx, unsigned long val) |
| 4681 | { |
| 4682 | char name[32]; |
| 4683 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4684 | return add_control(spec, type, name, val); |
| 4685 | } |
| 4686 | |
| 4687 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4688 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4689 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4690 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4691 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4692 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4693 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4694 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4695 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4696 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4697 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4698 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4699 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4700 | #define ALC880_PIN_CD_NID 0x1c |
| 4701 | |
| 4702 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4703 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4704 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4705 | { |
| 4706 | hda_nid_t nid; |
| 4707 | int assigned[4]; |
| 4708 | int i, j; |
| 4709 | |
| 4710 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4711 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4712 | |
| 4713 | /* check the pins hardwired to audio widget */ |
| 4714 | for (i = 0; i < cfg->line_outs; i++) { |
| 4715 | nid = cfg->line_out_pins[i]; |
| 4716 | if (alc880_is_fixed_pin(nid)) { |
| 4717 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4718 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4719 | assigned[idx] = 1; |
| 4720 | } |
| 4721 | } |
| 4722 | /* left pins can be connect to any audio widget */ |
| 4723 | for (i = 0; i < cfg->line_outs; i++) { |
| 4724 | nid = cfg->line_out_pins[i]; |
| 4725 | if (alc880_is_fixed_pin(nid)) |
| 4726 | continue; |
| 4727 | /* search for an empty channel */ |
| 4728 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | if (!assigned[j]) { |
| 4730 | spec->multiout.dac_nids[i] = |
| 4731 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4732 | assigned[j] = 1; |
| 4733 | break; |
| 4734 | } |
| 4735 | } |
| 4736 | } |
| 4737 | spec->multiout.num_dacs = cfg->line_outs; |
| 4738 | return 0; |
| 4739 | } |
| 4740 | |
| 4741 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4742 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4743 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4744 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4745 | static const char *chname[4] = { |
| 4746 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4747 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4748 | hda_nid_t nid; |
| 4749 | int i, err; |
| 4750 | |
| 4751 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4752 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4753 | continue; |
| 4754 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4755 | if (i == 2) { |
| 4756 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4757 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4758 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4759 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4760 | HDA_OUTPUT)); |
| 4761 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4762 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4763 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4764 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4765 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4766 | HDA_OUTPUT)); |
| 4767 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4768 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4769 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4770 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4771 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4772 | HDA_INPUT)); |
| 4773 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4774 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4775 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4776 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4777 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4778 | HDA_INPUT)); |
| 4779 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4780 | return err; |
| 4781 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4782 | const char *pfx; |
| 4783 | if (cfg->line_outs == 1 && |
| 4784 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4785 | pfx = "Speaker"; |
| 4786 | else |
| 4787 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4788 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4789 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4790 | HDA_OUTPUT)); |
| 4791 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4792 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4793 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4794 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4795 | HDA_INPUT)); |
| 4796 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4797 | return err; |
| 4798 | } |
| 4799 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4800 | return 0; |
| 4801 | } |
| 4802 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4803 | /* add playback controls for speaker and HP outputs */ |
| 4804 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4805 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4806 | { |
| 4807 | hda_nid_t nid; |
| 4808 | int err; |
| 4809 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4811 | return 0; |
| 4812 | |
| 4813 | if (alc880_is_fixed_pin(pin)) { |
| 4814 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4815 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4816 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4817 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4818 | else |
| 4819 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4820 | /* control HP volume/switch on the output mixer amp */ |
| 4821 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4822 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4823 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4824 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4825 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4826 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4827 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4828 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | return err; |
| 4830 | } else if (alc880_is_multi_pin(pin)) { |
| 4831 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4832 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4833 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4834 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4835 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | return err; |
| 4837 | } |
| 4838 | return 0; |
| 4839 | } |
| 4840 | |
| 4841 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4842 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4843 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4844 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4845 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4846 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4847 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4848 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4849 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4850 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4851 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4852 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4853 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4854 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | return err; |
| 4856 | return 0; |
| 4857 | } |
| 4858 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4859 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4860 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4861 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4862 | return (pincap & AC_PINCAP_IN) != 0; |
| 4863 | } |
| 4864 | |
| 4865 | /* create playback/capture controls for input pins */ |
| 4866 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4867 | const struct auto_pin_cfg *cfg, |
| 4868 | hda_nid_t mixer, |
| 4869 | hda_nid_t cap1, hda_nid_t cap2) |
| 4870 | { |
| 4871 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4872 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4873 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4874 | |
| 4875 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4876 | hda_nid_t pin; |
| 4877 | |
| 4878 | pin = cfg->input_pins[i]; |
| 4879 | if (!alc_is_input_pin(codec, pin)) |
| 4880 | continue; |
| 4881 | |
| 4882 | if (mixer) { |
| 4883 | idx = get_connection_index(codec, mixer, pin); |
| 4884 | if (idx >= 0) { |
| 4885 | err = new_analog_input(spec, pin, |
| 4886 | auto_pin_cfg_labels[i], |
| 4887 | idx, mixer); |
| 4888 | if (err < 0) |
| 4889 | return err; |
| 4890 | } |
| 4891 | } |
| 4892 | |
| 4893 | if (!cap1) |
| 4894 | continue; |
| 4895 | idx = get_connection_index(codec, cap1, pin); |
| 4896 | if (idx < 0 && cap2) |
| 4897 | idx = get_connection_index(codec, cap2, pin); |
| 4898 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4899 | imux->items[imux->num_items].label = |
| 4900 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4901 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4902 | imux->num_items++; |
| 4903 | } |
| 4904 | } |
| 4905 | return 0; |
| 4906 | } |
| 4907 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4908 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4909 | const struct auto_pin_cfg *cfg) |
| 4910 | { |
| 4911 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4912 | } |
| 4913 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4914 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4915 | unsigned int pin_type) |
| 4916 | { |
| 4917 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4918 | pin_type); |
| 4919 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4920 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4921 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4922 | } |
| 4923 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4924 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4925 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4926 | int dac_idx) |
| 4927 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4928 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4929 | /* need the manual connection? */ |
| 4930 | if (alc880_is_multi_pin(nid)) { |
| 4931 | struct alc_spec *spec = codec->spec; |
| 4932 | int idx = alc880_multi_pin_idx(nid); |
| 4933 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4934 | AC_VERB_SET_CONNECT_SEL, |
| 4935 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4936 | } |
| 4937 | } |
| 4938 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4939 | static int get_pin_type(int line_out_type) |
| 4940 | { |
| 4941 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4942 | return PIN_HP; |
| 4943 | else |
| 4944 | return PIN_OUT; |
| 4945 | } |
| 4946 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4948 | { |
| 4949 | struct alc_spec *spec = codec->spec; |
| 4950 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4951 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4952 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4953 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4954 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4955 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4956 | } |
| 4957 | } |
| 4958 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4959 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | { |
| 4961 | struct alc_spec *spec = codec->spec; |
| 4962 | hda_nid_t pin; |
| 4963 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4964 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4965 | if (pin) /* connect to front */ |
| 4966 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4967 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4968 | if (pin) /* connect to front */ |
| 4969 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4970 | } |
| 4971 | |
| 4972 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4973 | { |
| 4974 | struct alc_spec *spec = codec->spec; |
| 4975 | int i; |
| 4976 | |
| 4977 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4978 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4979 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4980 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4981 | if (nid != ALC880_PIN_CD_NID && |
| 4982 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4983 | snd_hda_codec_write(codec, nid, 0, |
| 4984 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4985 | AMP_OUT_MUTE); |
| 4986 | } |
| 4987 | } |
| 4988 | } |
| 4989 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 4990 | static void alc880_auto_init_input_src(struct hda_codec *codec) |
| 4991 | { |
| 4992 | struct alc_spec *spec = codec->spec; |
| 4993 | int c; |
| 4994 | |
| 4995 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 4996 | unsigned int mux_idx; |
| 4997 | const struct hda_input_mux *imux; |
| 4998 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 4999 | imux = &spec->input_mux[mux_idx]; |
| 5000 | if (!imux->num_items && mux_idx > 0) |
| 5001 | imux = &spec->input_mux[0]; |
| 5002 | if (imux) |
| 5003 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, |
| 5004 | AC_VERB_SET_CONNECT_SEL, |
| 5005 | imux->items[0].index); |
| 5006 | } |
| 5007 | } |
| 5008 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5009 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5010 | /* return 1 if successful, 0 if the proper config is not found, |
| 5011 | * or a negative error code |
| 5012 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5013 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 5014 | { |
| 5015 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5016 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5017 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5018 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5019 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5020 | alc880_ignore); |
| 5021 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5022 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5023 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5024 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5025 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 5027 | if (err < 0) |
| 5028 | return err; |
| 5029 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5030 | if (err < 0) |
| 5031 | return err; |
| 5032 | err = alc880_auto_create_extra_out(spec, |
| 5033 | spec->autocfg.speaker_pins[0], |
| 5034 | "Speaker"); |
| 5035 | if (err < 0) |
| 5036 | return err; |
| 5037 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 5038 | "Headphone"); |
| 5039 | if (err < 0) |
| 5040 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 5041 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5042 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5043 | return err; |
| 5044 | |
| 5045 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 5046 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5047 | /* check multiple SPDIF-out (for recent codecs) */ |
| 5048 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 5049 | hda_nid_t dig_nid; |
| 5050 | err = snd_hda_get_connections(codec, |
| 5051 | spec->autocfg.dig_out_pins[i], |
| 5052 | &dig_nid, 1); |
| 5053 | if (err < 0) |
| 5054 | continue; |
| 5055 | if (!i) |
| 5056 | spec->multiout.dig_out_nid = dig_nid; |
| 5057 | else { |
| 5058 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 5059 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5060 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 5061 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 5062 | } |
| 5063 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5064 | if (spec->autocfg.dig_in_pin) |
| 5065 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 5066 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5067 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5068 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5069 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 5070 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5071 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5072 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5073 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 5075 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 5076 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5077 | return 1; |
| 5078 | } |
| 5079 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5080 | /* additional initialization for auto-configuration model */ |
| 5081 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5082 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5083 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5084 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 5085 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5086 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 5087 | alc880_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5088 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 5089 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5090 | } |
| 5091 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5092 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 5093 | * one of two digital mic pins, e.g. on ALC272 |
| 5094 | */ |
| 5095 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5096 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5097 | struct alc_spec *spec = codec->spec; |
| 5098 | int i; |
| 5099 | |
| 5100 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5101 | hda_nid_t cap = spec->capsrc_nids ? |
| 5102 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5103 | int iidx, eidx; |
| 5104 | |
| 5105 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 5106 | if (iidx < 0) |
| 5107 | continue; |
| 5108 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 5109 | if (eidx < 0) |
| 5110 | continue; |
| 5111 | spec->int_mic.mux_idx = iidx; |
| 5112 | spec->ext_mic.mux_idx = eidx; |
| 5113 | if (spec->capsrc_nids) |
| 5114 | spec->capsrc_nids += i; |
| 5115 | spec->adc_nids += i; |
| 5116 | spec->num_adc_nids = 1; |
| 5117 | return; |
| 5118 | } |
| 5119 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5120 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5121 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5122 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5123 | } |
| 5124 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5125 | /* set the default connection to that pin */ |
| 5126 | static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin) |
| 5127 | { |
| 5128 | struct alc_spec *spec = codec->spec; |
| 5129 | int i; |
| 5130 | |
| 5131 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5132 | hda_nid_t cap = spec->capsrc_nids ? |
| 5133 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5134 | int idx; |
| 5135 | |
| 5136 | idx = get_connection_index(codec, cap, pin); |
| 5137 | if (idx < 0) |
| 5138 | continue; |
| 5139 | /* select or unmute this route */ |
| 5140 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5141 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5142 | HDA_AMP_MUTE, 0); |
| 5143 | } else { |
| 5144 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5145 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5146 | } |
| 5147 | return i; /* return the found index */ |
| 5148 | } |
| 5149 | return -1; /* not found */ |
| 5150 | } |
| 5151 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5152 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5153 | static void fixup_single_adc(struct hda_codec *codec) |
| 5154 | { |
| 5155 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5156 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5157 | int i; |
| 5158 | |
| 5159 | /* search for the input pin; there must be only one */ |
| 5160 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5161 | if (spec->autocfg.input_pins[i]) { |
| 5162 | pin = spec->autocfg.input_pins[i]; |
| 5163 | break; |
| 5164 | } |
| 5165 | } |
| 5166 | if (!pin) |
| 5167 | return; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5168 | i = init_capsrc_for_pin(codec, pin); |
| 5169 | if (i >= 0) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5170 | /* use only this ADC */ |
| 5171 | if (spec->capsrc_nids) |
| 5172 | spec->capsrc_nids += i; |
| 5173 | spec->adc_nids += i; |
| 5174 | spec->num_adc_nids = 1; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5175 | } |
| 5176 | } |
| 5177 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5178 | /* initialize dual adcs */ |
| 5179 | static void fixup_dual_adc_switch(struct hda_codec *codec) |
| 5180 | { |
| 5181 | struct alc_spec *spec = codec->spec; |
| 5182 | init_capsrc_for_pin(codec, spec->ext_mic.pin); |
| 5183 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
| 5184 | } |
| 5185 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5186 | static void set_capture_mixer(struct hda_codec *codec) |
| 5187 | { |
| 5188 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5189 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5190 | { alc_capture_mixer_nosrc1, |
| 5191 | alc_capture_mixer_nosrc2, |
| 5192 | alc_capture_mixer_nosrc3 }, |
| 5193 | { alc_capture_mixer1, |
| 5194 | alc_capture_mixer2, |
| 5195 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5196 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5197 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5198 | int mux = 0; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5199 | int num_adcs = spec->num_adc_nids; |
| 5200 | if (spec->dual_adc_switch) |
| 5201 | fixup_dual_adc_switch(codec); |
| 5202 | else if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5203 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5204 | else if (spec->input_mux) { |
| 5205 | if (spec->input_mux->num_items > 1) |
| 5206 | mux = 1; |
| 5207 | else if (spec->input_mux->num_items == 1) |
| 5208 | fixup_single_adc(codec); |
| 5209 | } |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 5210 | if (spec->dual_adc_switch) |
| 5211 | num_adcs = 1; |
| 5212 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5213 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5214 | } |
| 5215 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5216 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5217 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5218 | int num_nids) |
| 5219 | { |
| 5220 | struct alc_spec *spec = codec->spec; |
| 5221 | int n; |
| 5222 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5223 | |
| 5224 | for (n = 0; n < num_nids; n++) { |
| 5225 | hda_nid_t adc, cap; |
| 5226 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5227 | int nconns, i, j; |
| 5228 | |
| 5229 | adc = nids[n]; |
| 5230 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5231 | continue; |
| 5232 | cap = adc; |
| 5233 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5234 | ARRAY_SIZE(conn)); |
| 5235 | if (nconns == 1) { |
| 5236 | cap = conn[0]; |
| 5237 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5238 | ARRAY_SIZE(conn)); |
| 5239 | } |
| 5240 | if (nconns <= 0) |
| 5241 | continue; |
| 5242 | if (!fallback_adc) { |
| 5243 | fallback_adc = adc; |
| 5244 | fallback_cap = cap; |
| 5245 | } |
| 5246 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5247 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5248 | if (!nid) |
| 5249 | continue; |
| 5250 | for (j = 0; j < nconns; j++) { |
| 5251 | if (conn[j] == nid) |
| 5252 | break; |
| 5253 | } |
| 5254 | if (j >= nconns) |
| 5255 | break; |
| 5256 | } |
| 5257 | if (i >= AUTO_PIN_LAST) { |
| 5258 | int num_adcs = spec->num_adc_nids; |
| 5259 | spec->private_adc_nids[num_adcs] = adc; |
| 5260 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5261 | spec->num_adc_nids++; |
| 5262 | spec->adc_nids = spec->private_adc_nids; |
| 5263 | if (adc != cap) |
| 5264 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5265 | } |
| 5266 | } |
| 5267 | if (!spec->num_adc_nids) { |
| 5268 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5269 | " using fallback 0x%x\n", |
| 5270 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5271 | spec->private_adc_nids[0] = fallback_adc; |
| 5272 | spec->adc_nids = spec->private_adc_nids; |
| 5273 | if (fallback_adc != fallback_cap) { |
| 5274 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5275 | spec->capsrc_nids = spec->private_adc_nids; |
| 5276 | } |
| 5277 | } |
| 5278 | } |
| 5279 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5280 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5281 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5282 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5283 | |
| 5284 | static struct snd_pci_quirk beep_white_list[] = { |
| 5285 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
| 5286 | {} |
| 5287 | }; |
| 5288 | |
| 5289 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 5290 | { |
| 5291 | struct alc_spec *spec = codec->spec; |
| 5292 | const struct snd_pci_quirk *q; |
| 5293 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 5294 | if (q) |
| 5295 | return q->value; |
| 5296 | return spec->cdefine.enable_pcbeep; |
| 5297 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5298 | #else |
| 5299 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 5300 | #define has_cdefine_beep(codec) 0 |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5301 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5302 | |
| 5303 | /* |
| 5304 | * OK, here we have finally the patch for ALC880 |
| 5305 | */ |
| 5306 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5307 | static int patch_alc880(struct hda_codec *codec) |
| 5308 | { |
| 5309 | struct alc_spec *spec; |
| 5310 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5311 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5312 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5313 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5314 | if (spec == NULL) |
| 5315 | return -ENOMEM; |
| 5316 | |
| 5317 | codec->spec = spec; |
| 5318 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5319 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5320 | alc880_models, |
| 5321 | alc880_cfg_tbl); |
| 5322 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5323 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5324 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5325 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5326 | } |
| 5327 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5328 | if (board_config == ALC880_AUTO) { |
| 5329 | /* automatic parse from the BIOS config */ |
| 5330 | err = alc880_parse_auto_config(codec); |
| 5331 | if (err < 0) { |
| 5332 | alc_free(codec); |
| 5333 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5334 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5335 | printk(KERN_INFO |
| 5336 | "hda_codec: Cannot set up configuration " |
| 5337 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5338 | board_config = ALC880_3ST; |
| 5339 | } |
| 5340 | } |
| 5341 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5342 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5343 | if (err < 0) { |
| 5344 | alc_free(codec); |
| 5345 | return err; |
| 5346 | } |
| 5347 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5348 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5349 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5351 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5352 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5353 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5354 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5355 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5356 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5357 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5358 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5359 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5360 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5361 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5362 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5363 | if (wcap != AC_WID_AUD_IN) { |
| 5364 | spec->adc_nids = alc880_adc_nids_alt; |
| 5365 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5366 | } else { |
| 5367 | spec->adc_nids = alc880_adc_nids; |
| 5368 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5369 | } |
| 5370 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5371 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5372 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5373 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5374 | spec->vmaster_nid = 0x0c; |
| 5375 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5376 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5377 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5378 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5379 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5380 | if (!spec->loopback.amplist) |
| 5381 | spec->loopback.amplist = alc880_loopbacks; |
| 5382 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | |
| 5384 | return 0; |
| 5385 | } |
| 5386 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5388 | /* |
| 5389 | * ALC260 support |
| 5390 | */ |
| 5391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5392 | static hda_nid_t alc260_dac_nids[1] = { |
| 5393 | /* front */ |
| 5394 | 0x02, |
| 5395 | }; |
| 5396 | |
| 5397 | static hda_nid_t alc260_adc_nids[1] = { |
| 5398 | /* ADC0 */ |
| 5399 | 0x04, |
| 5400 | }; |
| 5401 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5402 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5403 | /* ADC1 */ |
| 5404 | 0x05, |
| 5405 | }; |
| 5406 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5407 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5408 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5409 | */ |
| 5410 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5411 | /* ADC0, ADC1 */ |
| 5412 | 0x04, 0x05 |
| 5413 | }; |
| 5414 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5415 | #define ALC260_DIGOUT_NID 0x03 |
| 5416 | #define ALC260_DIGIN_NID 0x06 |
| 5417 | |
| 5418 | static struct hda_input_mux alc260_capture_source = { |
| 5419 | .num_items = 4, |
| 5420 | .items = { |
| 5421 | { "Mic", 0x0 }, |
| 5422 | { "Front Mic", 0x1 }, |
| 5423 | { "Line", 0x2 }, |
| 5424 | { "CD", 0x4 }, |
| 5425 | }, |
| 5426 | }; |
| 5427 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5428 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5429 | * headphone jack and the internal CD lines since these are the only pins at |
| 5430 | * which audio can appear. For flexibility, also allow the option of |
| 5431 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5432 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5433 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5434 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5435 | { |
| 5436 | .num_items = 3, |
| 5437 | .items = { |
| 5438 | { "Mic/Line", 0x0 }, |
| 5439 | { "CD", 0x4 }, |
| 5440 | { "Headphone", 0x2 }, |
| 5441 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5442 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5443 | { |
| 5444 | .num_items = 4, |
| 5445 | .items = { |
| 5446 | { "Mic/Line", 0x0 }, |
| 5447 | { "CD", 0x4 }, |
| 5448 | { "Headphone", 0x2 }, |
| 5449 | { "Mixer", 0x5 }, |
| 5450 | }, |
| 5451 | }, |
| 5452 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5453 | }; |
| 5454 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5455 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5456 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5457 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5458 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5459 | { |
| 5460 | .num_items = 4, |
| 5461 | .items = { |
| 5462 | { "Mic", 0x0 }, |
| 5463 | { "Line", 0x2 }, |
| 5464 | { "CD", 0x4 }, |
| 5465 | { "Headphone", 0x5 }, |
| 5466 | }, |
| 5467 | }, |
| 5468 | { |
| 5469 | .num_items = 5, |
| 5470 | .items = { |
| 5471 | { "Mic", 0x0 }, |
| 5472 | { "Line", 0x2 }, |
| 5473 | { "CD", 0x4 }, |
| 5474 | { "Headphone", 0x6 }, |
| 5475 | { "Mixer", 0x5 }, |
| 5476 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5477 | }, |
| 5478 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5479 | |
| 5480 | /* Maxdata Favorit 100XS */ |
| 5481 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5482 | { |
| 5483 | .num_items = 2, |
| 5484 | .items = { |
| 5485 | { "Line/Mic", 0x0 }, |
| 5486 | { "CD", 0x4 }, |
| 5487 | }, |
| 5488 | }, |
| 5489 | { |
| 5490 | .num_items = 3, |
| 5491 | .items = { |
| 5492 | { "Line/Mic", 0x0 }, |
| 5493 | { "CD", 0x4 }, |
| 5494 | { "Mixer", 0x5 }, |
| 5495 | }, |
| 5496 | }, |
| 5497 | }; |
| 5498 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | /* |
| 5500 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5501 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5502 | * element which allows changing the channel mode, so the verb list is |
| 5503 | * never used. |
| 5504 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5505 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5506 | { 2, NULL }, |
| 5507 | }; |
| 5508 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5509 | |
| 5510 | /* Mixer combinations |
| 5511 | * |
| 5512 | * basic: base_output + input + pc_beep + capture |
| 5513 | * HP: base_output + input + capture_alt |
| 5514 | * HP_3013: hp_3013 + input + capture |
| 5515 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5516 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5517 | */ |
| 5518 | |
| 5519 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5520 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5521 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5522 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5523 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5524 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5525 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5526 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5527 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5528 | |
| 5529 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5531 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5532 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5533 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5534 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5535 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5536 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5537 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5538 | { } /* end */ |
| 5539 | }; |
| 5540 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5541 | /* update HP, line and mono out pins according to the master switch */ |
| 5542 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5543 | hda_nid_t hp, hda_nid_t line, |
| 5544 | hda_nid_t mono) |
| 5545 | { |
| 5546 | struct alc_spec *spec = codec->spec; |
| 5547 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5548 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5549 | 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] | 5550 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5551 | 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] | 5552 | val); |
| 5553 | /* mono (speaker) depending on the HP jack sense */ |
| 5554 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5555 | 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] | 5556 | val); |
| 5557 | } |
| 5558 | |
| 5559 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5560 | struct snd_ctl_elem_value *ucontrol) |
| 5561 | { |
| 5562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5563 | struct alc_spec *spec = codec->spec; |
| 5564 | *ucontrol->value.integer.value = spec->master_sw; |
| 5565 | return 0; |
| 5566 | } |
| 5567 | |
| 5568 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5569 | struct snd_ctl_elem_value *ucontrol) |
| 5570 | { |
| 5571 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5572 | struct alc_spec *spec = codec->spec; |
| 5573 | int val = !!*ucontrol->value.integer.value; |
| 5574 | hda_nid_t hp, line, mono; |
| 5575 | |
| 5576 | if (val == spec->master_sw) |
| 5577 | return 0; |
| 5578 | spec->master_sw = val; |
| 5579 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5580 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5581 | mono = kcontrol->private_value & 0xff; |
| 5582 | alc260_hp_master_update(codec, hp, line, mono); |
| 5583 | return 1; |
| 5584 | } |
| 5585 | |
| 5586 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5587 | { |
| 5588 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5589 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5590 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5591 | .info = snd_ctl_boolean_mono_info, |
| 5592 | .get = alc260_hp_master_sw_get, |
| 5593 | .put = alc260_hp_master_sw_put, |
| 5594 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5595 | }, |
| 5596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5597 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5598 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5599 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5600 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5601 | HDA_OUTPUT), |
| 5602 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5603 | { } /* end */ |
| 5604 | }; |
| 5605 | |
| 5606 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5607 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5608 | {}, |
| 5609 | }; |
| 5610 | |
| 5611 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5612 | { |
| 5613 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5614 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5615 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5616 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5617 | } |
| 5618 | |
| 5619 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5620 | { |
| 5621 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5622 | alc260_hp_automute(codec); |
| 5623 | } |
| 5624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5625 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5626 | { |
| 5627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5628 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5629 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5630 | .info = snd_ctl_boolean_mono_info, |
| 5631 | .get = alc260_hp_master_sw_get, |
| 5632 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5633 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5634 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5635 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5636 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5637 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5638 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5639 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5640 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5641 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5642 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5643 | { } /* end */ |
| 5644 | }; |
| 5645 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5646 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5647 | .ops = &snd_hda_bind_vol, |
| 5648 | .values = { |
| 5649 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5650 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5651 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5652 | 0 |
| 5653 | }, |
| 5654 | }; |
| 5655 | |
| 5656 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5657 | .ops = &snd_hda_bind_sw, |
| 5658 | .values = { |
| 5659 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5660 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5661 | 0 |
| 5662 | }, |
| 5663 | }; |
| 5664 | |
| 5665 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5666 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5667 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5668 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5670 | { } /* end */ |
| 5671 | }; |
| 5672 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5673 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5674 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5675 | {}, |
| 5676 | }; |
| 5677 | |
| 5678 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5679 | { |
| 5680 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5681 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5682 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5683 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5684 | } |
| 5685 | |
| 5686 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5687 | unsigned int res) |
| 5688 | { |
| 5689 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5690 | alc260_hp_3013_automute(codec); |
| 5691 | } |
| 5692 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5693 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5694 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5695 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5696 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5697 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5698 | bits); |
| 5699 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5700 | bits); |
| 5701 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5702 | bits); |
| 5703 | } |
| 5704 | |
| 5705 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5706 | unsigned int res) |
| 5707 | { |
| 5708 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5709 | alc260_hp_3012_automute(codec); |
| 5710 | } |
| 5711 | |
| 5712 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5713 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5714 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5715 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5716 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5717 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5718 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5719 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5720 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5721 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5722 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5723 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5724 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5725 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5726 | { } /* end */ |
| 5727 | }; |
| 5728 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5729 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5730 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5731 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5732 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5733 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5734 | * revisions available in early 2006. Therefore for now allow the |
| 5735 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5736 | * that the lack of mic bias for this NID is intentional we could change the |
| 5737 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5738 | * |
| 5739 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5740 | * don't appear to make the mic bias available from the "line" jack, even |
| 5741 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5742 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5743 | * and the output jack. If this turns out to be the case for all such |
| 5744 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5745 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5746 | * |
| 5747 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5748 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5749 | * controls for such models. On models without a "mono speaker" the control |
| 5750 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5751 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5752 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5753 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5754 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5755 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5756 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5757 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5758 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5759 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5760 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5761 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5762 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5763 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5764 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5765 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5766 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5767 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5768 | { } /* end */ |
| 5769 | }; |
| 5770 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5771 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5772 | */ |
| 5773 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5774 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5775 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5776 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5777 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5778 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5779 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5780 | { } /* end */ |
| 5781 | }; |
| 5782 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5783 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5784 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5785 | */ |
| 5786 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5787 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5788 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5789 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5790 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5791 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5793 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5794 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5796 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5797 | { } /* end */ |
| 5798 | }; |
| 5799 | |
| 5800 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5801 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5802 | */ |
| 5803 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5804 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5805 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5807 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5808 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5809 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5810 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5811 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5812 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5813 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5814 | { } /* end */ |
| 5815 | }; |
| 5816 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5817 | /* |
| 5818 | * initialization verbs |
| 5819 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5820 | static struct hda_verb alc260_init_verbs[] = { |
| 5821 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5822 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5823 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5824 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5825 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5826 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5827 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5828 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5829 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5830 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5831 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5832 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5833 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5834 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5835 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5836 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5837 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5838 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5839 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5840 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5841 | /* set connection select to line in (default select for this ADC) */ |
| 5842 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5843 | /* mute capture amp left and right */ |
| 5844 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5845 | /* set connection select to line in (default select for this ADC) */ |
| 5846 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5847 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5848 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5849 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5850 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5851 | /* set vol=0 HP mixer amp left and right */ |
| 5852 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5853 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5854 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5855 | /* set vol=0 Mono mixer amp left and right */ |
| 5856 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5857 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5858 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5859 | /* unmute LINE-2 out pin */ |
| 5860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
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)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5870 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5871 | /* mute Front out path */ |
| 5872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5873 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5874 | /* mute Headphone out path */ |
| 5875 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5877 | /* mute Mono out path */ |
| 5878 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5879 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5880 | { } |
| 5881 | }; |
| 5882 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5883 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5884 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5885 | /* Headphone and output */ |
| 5886 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5887 | /* mono output */ |
| 5888 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5889 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5890 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5891 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5892 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5893 | /* Line In pin widget for input */ |
| 5894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5895 | /* Line-2 pin widget for output */ |
| 5896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5897 | /* CD pin widget for input */ |
| 5898 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5899 | /* unmute amp left and right */ |
| 5900 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5901 | /* set connection select to line in (default select for this ADC) */ |
| 5902 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5903 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5904 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5905 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5906 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5907 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5908 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5909 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5910 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5911 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5912 | * Line In 2 = 0x03 |
| 5913 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5914 | /* mute analog inputs */ |
| 5915 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5920 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5921 | /* Unmute Front out path */ |
| 5922 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5923 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5924 | /* Unmute Headphone out path */ |
| 5925 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5926 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5927 | /* Unmute Mono out path */ |
| 5928 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5929 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5930 | { } |
| 5931 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5932 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5933 | |
| 5934 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5935 | /* Line out and output */ |
| 5936 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5937 | /* mono output */ |
| 5938 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5939 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5940 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5941 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5942 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5943 | /* Line In pin widget for input */ |
| 5944 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5945 | /* Headphone pin widget for output */ |
| 5946 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5947 | /* CD pin widget for input */ |
| 5948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5949 | /* unmute amp left and right */ |
| 5950 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5951 | /* set connection select to line in (default select for this ADC) */ |
| 5952 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5953 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5954 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5955 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5956 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5957 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5958 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5959 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5960 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5961 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5962 | * Line In 2 = 0x03 |
| 5963 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5964 | /* mute analog inputs */ |
| 5965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5966 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5967 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5968 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5969 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5970 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5971 | /* Unmute Front out path */ |
| 5972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5973 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5974 | /* Unmute Headphone out path */ |
| 5975 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5976 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5977 | /* Unmute Mono out path */ |
| 5978 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5979 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5980 | { } |
| 5981 | }; |
| 5982 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5983 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5984 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5985 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5986 | */ |
| 5987 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5988 | /* Disable all GPIOs */ |
| 5989 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5990 | /* Internal speaker is connected to headphone pin */ |
| 5991 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5992 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5994 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5995 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5996 | /* Ensure all other unused pins are disabled and muted. */ |
| 5997 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5998 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5999 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6000 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6001 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6002 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6004 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6005 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6006 | /* Disable digital (SPDIF) pins */ |
| 6007 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6008 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6009 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6010 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6011 | * when acting as an output. |
| 6012 | */ |
| 6013 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6014 | |
| 6015 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 6016 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6018 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6019 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6020 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6021 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6022 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6023 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6024 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6025 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6026 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 6027 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6028 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 6029 | * If the pin mode is changed by the user the pin mode control will |
| 6030 | * take care of enabling the pin's input/output buffers as needed. |
| 6031 | * Therefore there's no need to enable the input buffer at this |
| 6032 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6033 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6034 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6035 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6036 | * mixer ctrl) |
| 6037 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6038 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6039 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6040 | /* Mute capture amp left and right */ |
| 6041 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6042 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6043 | * in (on mic1 pin) |
| 6044 | */ |
| 6045 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6046 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6047 | /* Do the same for the second ADC: mute capture input amp and |
| 6048 | * set ADC connection to line in (on mic1 pin) |
| 6049 | */ |
| 6050 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6051 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 6052 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6053 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6054 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6058 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6059 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6061 | {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] | 6062 | |
| 6063 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 6064 | }; |
| 6065 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6066 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 6067 | * similar laptops (adapted from Fujitsu init verbs). |
| 6068 | */ |
| 6069 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 6070 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 6071 | * the headphone jack. Turn this on and rely on the standard mute |
| 6072 | * methods whenever the user wants to turn these outputs off. |
| 6073 | */ |
| 6074 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6075 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6076 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6077 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 6078 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6079 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 6080 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6081 | /* Line In jack is connected to Line1 pin */ |
| 6082 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6083 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 6084 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6085 | /* Ensure all other unused pins are disabled and muted. */ |
| 6086 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6087 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6088 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6089 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6090 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6092 | /* Disable digital (SPDIF) pins */ |
| 6093 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6094 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6095 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6096 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6097 | * bus when acting as outputs. |
| 6098 | */ |
| 6099 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6100 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6101 | |
| 6102 | /* Start with output sum widgets muted and their output gains at min */ |
| 6103 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6104 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6105 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6106 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6107 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6108 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6109 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6110 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6111 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6112 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6113 | /* Unmute Line-out pin widget amp left and right |
| 6114 | * (no equiv mixer ctrl) |
| 6115 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6116 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6117 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 6118 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6119 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6120 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6121 | * will take care of enabling the pin's input/output buffers as needed. |
| 6122 | * Therefore there's no need to enable the input buffer at this |
| 6123 | * stage. |
| 6124 | */ |
| 6125 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6127 | |
| 6128 | /* Mute capture amp left and right */ |
| 6129 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6130 | /* Set ADC connection select to match default mixer setting - mic |
| 6131 | * (on mic1 pin) |
| 6132 | */ |
| 6133 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6134 | |
| 6135 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6136 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6137 | */ |
| 6138 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6139 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6140 | |
| 6141 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6143 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6144 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6146 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6147 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6148 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6149 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6150 | |
| 6151 | { } |
| 6152 | }; |
| 6153 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6154 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 6155 | * (adapted from Acer init verbs). |
| 6156 | */ |
| 6157 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6158 | /* GPIO 0 enables the output jack. |
| 6159 | * Turn this on and rely on the standard mute |
| 6160 | * methods whenever the user wants to turn these outputs off. |
| 6161 | */ |
| 6162 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6163 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6164 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6165 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6166 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6167 | /* Ensure all other unused pins are disabled and muted. */ |
| 6168 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6169 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6170 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6171 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6172 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6173 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6174 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6175 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6176 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6177 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6178 | /* Disable digital (SPDIF) pins */ |
| 6179 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6180 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6181 | |
| 6182 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6183 | * bus when acting as outputs. |
| 6184 | */ |
| 6185 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6186 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6187 | |
| 6188 | /* Start with output sum widgets muted and their output gains at min */ |
| 6189 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6190 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6192 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6195 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6196 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6197 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6198 | |
| 6199 | /* Unmute Line-out pin widget amp left and right |
| 6200 | * (no equiv mixer ctrl) |
| 6201 | */ |
| 6202 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6203 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6204 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6205 | * will take care of enabling the pin's input/output buffers as needed. |
| 6206 | * Therefore there's no need to enable the input buffer at this |
| 6207 | * stage. |
| 6208 | */ |
| 6209 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6210 | |
| 6211 | /* Mute capture amp left and right */ |
| 6212 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6213 | /* Set ADC connection select to match default mixer setting - mic |
| 6214 | * (on mic1 pin) |
| 6215 | */ |
| 6216 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6217 | |
| 6218 | /* Do similar with the second ADC: mute capture input amp and |
| 6219 | * set ADC connection to mic to match ALSA's default state. |
| 6220 | */ |
| 6221 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6222 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6223 | |
| 6224 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6228 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6229 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6231 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6232 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6233 | |
| 6234 | { } |
| 6235 | }; |
| 6236 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6237 | static struct hda_verb alc260_will_verbs[] = { |
| 6238 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6239 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6240 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6241 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6242 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6243 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6244 | {} |
| 6245 | }; |
| 6246 | |
| 6247 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6248 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6249 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6250 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6251 | |
| 6252 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6253 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6254 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6255 | |
| 6256 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6257 | {} |
| 6258 | }; |
| 6259 | |
| 6260 | /* toggle speaker-output according to the hp-jack state */ |
| 6261 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6262 | { |
| 6263 | unsigned int present; |
| 6264 | |
| 6265 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6266 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6267 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6268 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6269 | AC_VERB_SET_GPIO_DATA, 1); |
| 6270 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6271 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6272 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6273 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6274 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6275 | AC_VERB_SET_GPIO_DATA, 0); |
| 6276 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6277 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6278 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6279 | } |
| 6280 | } |
| 6281 | |
| 6282 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6283 | unsigned int res) |
| 6284 | { |
| 6285 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6286 | alc260_replacer_672v_automute(codec); |
| 6287 | } |
| 6288 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6289 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6290 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6291 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6292 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6293 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6294 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6296 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6297 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6298 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6299 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6300 | {} |
| 6301 | }; |
| 6302 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6303 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6304 | * configuration. |
| 6305 | */ |
| 6306 | #ifdef CONFIG_SND_DEBUG |
| 6307 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6308 | 0x02, |
| 6309 | }; |
| 6310 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6311 | 0x04, 0x05, |
| 6312 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6313 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6314 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6315 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6316 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6317 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6318 | { |
| 6319 | .num_items = 7, |
| 6320 | .items = { |
| 6321 | { "MIC1 pin", 0x0 }, |
| 6322 | { "MIC2 pin", 0x1 }, |
| 6323 | { "LINE1 pin", 0x2 }, |
| 6324 | { "LINE2 pin", 0x3 }, |
| 6325 | { "CD pin", 0x4 }, |
| 6326 | { "LINE-OUT pin", 0x5 }, |
| 6327 | { "HP-OUT pin", 0x6 }, |
| 6328 | }, |
| 6329 | }, |
| 6330 | { |
| 6331 | .num_items = 8, |
| 6332 | .items = { |
| 6333 | { "MIC1 pin", 0x0 }, |
| 6334 | { "MIC2 pin", 0x1 }, |
| 6335 | { "LINE1 pin", 0x2 }, |
| 6336 | { "LINE2 pin", 0x3 }, |
| 6337 | { "CD pin", 0x4 }, |
| 6338 | { "Mixer", 0x5 }, |
| 6339 | { "LINE-OUT pin", 0x6 }, |
| 6340 | { "HP-OUT pin", 0x7 }, |
| 6341 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6342 | }, |
| 6343 | }; |
| 6344 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6345 | /* Output driver widgets */ |
| 6346 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6347 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6348 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6349 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6350 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6351 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6352 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6353 | /* Modes for retasking pin widgets |
| 6354 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6355 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6356 | * mention this restriction. At this stage it's not clear whether |
| 6357 | * this behaviour is intentional or is a hardware bug in chip |
| 6358 | * revisions available at least up until early 2006. Therefore for |
| 6359 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6360 | * choices, but if it turns out that the lack of mic bias for these |
| 6361 | * NIDs is intentional we could change their modes from |
| 6362 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6363 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6364 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6365 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6366 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6367 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6368 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6369 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6370 | |
| 6371 | /* Loopback mixer controls */ |
| 6372 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6373 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6374 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6375 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6376 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6377 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6378 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6379 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6380 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6381 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6382 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6383 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6384 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6385 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6386 | |
| 6387 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6388 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6389 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6390 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6391 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6392 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6393 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6394 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6395 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6396 | */ |
| 6397 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6398 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6399 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6400 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6401 | * this output to turn on an external amplifier. |
| 6402 | */ |
| 6403 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6404 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6405 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6406 | { } /* end */ |
| 6407 | }; |
| 6408 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6409 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6410 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6411 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6412 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6413 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6414 | /* Enable retasking pins as output, initially without power amp */ |
| 6415 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6416 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6418 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6419 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6420 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6421 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6422 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6423 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6424 | * payload also sets the generation to 0, output to be in "consumer" |
| 6425 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6426 | * control. |
| 6427 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6428 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6429 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6430 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6431 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6432 | * OUT1 sum bus when acting as an output. |
| 6433 | */ |
| 6434 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6435 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6436 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6437 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6438 | |
| 6439 | /* Start with output sum widgets muted and their output gains at min */ |
| 6440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6442 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6447 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6448 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6449 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6450 | /* Unmute retasking pin widget output buffers since the default |
| 6451 | * state appears to be output. As the pin mode is changed by the |
| 6452 | * user the pin mode control will take care of enabling the pin's |
| 6453 | * input/output buffers as needed. |
| 6454 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6455 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6456 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6457 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6458 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6459 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6460 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6461 | /* Also unmute the mono-out pin widget */ |
| 6462 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6463 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6464 | /* Mute capture amp left and right */ |
| 6465 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6466 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6467 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6468 | */ |
| 6469 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6470 | |
| 6471 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6472 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6473 | */ |
| 6474 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6475 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6476 | |
| 6477 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6478 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6479 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6481 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6482 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6483 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6484 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6486 | |
| 6487 | { } |
| 6488 | }; |
| 6489 | #endif |
| 6490 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6491 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6492 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6493 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6494 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6495 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6496 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6497 | /* |
| 6498 | * for BIOS auto-configuration |
| 6499 | */ |
| 6500 | |
| 6501 | 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] | 6502 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6503 | { |
| 6504 | hda_nid_t nid_vol; |
| 6505 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6506 | int err; |
| 6507 | |
| 6508 | if (nid >= 0x0f && nid < 0x11) { |
| 6509 | nid_vol = nid - 0x7; |
| 6510 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6511 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6512 | } else if (nid == 0x11) { |
| 6513 | nid_vol = nid - 0x7; |
| 6514 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6515 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6516 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6517 | nid_vol = 0x08; |
| 6518 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6519 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6520 | } else |
| 6521 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6522 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6523 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6524 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6525 | 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] | 6526 | if (err < 0) |
| 6527 | return err; |
| 6528 | *vol_bits |= (1 << nid_vol); |
| 6529 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6530 | 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] | 6531 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6532 | return err; |
| 6533 | return 1; |
| 6534 | } |
| 6535 | |
| 6536 | /* add playback controls from the parsed DAC table */ |
| 6537 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6538 | const struct auto_pin_cfg *cfg) |
| 6539 | { |
| 6540 | hda_nid_t nid; |
| 6541 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6542 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6543 | |
| 6544 | spec->multiout.num_dacs = 1; |
| 6545 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6546 | spec->multiout.dac_nids[0] = 0x02; |
| 6547 | |
| 6548 | nid = cfg->line_out_pins[0]; |
| 6549 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6550 | const char *pfx; |
| 6551 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6552 | pfx = "Master"; |
| 6553 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6554 | pfx = "Speaker"; |
| 6555 | else |
| 6556 | pfx = "Front"; |
| 6557 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6558 | if (err < 0) |
| 6559 | return err; |
| 6560 | } |
| 6561 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6562 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6563 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6564 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6565 | if (err < 0) |
| 6566 | return err; |
| 6567 | } |
| 6568 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6569 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6570 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6571 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6572 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6573 | if (err < 0) |
| 6574 | return err; |
| 6575 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6576 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6577 | } |
| 6578 | |
| 6579 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6580 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6581 | const struct auto_pin_cfg *cfg) |
| 6582 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6583 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6584 | } |
| 6585 | |
| 6586 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6587 | hda_nid_t nid, int pin_type, |
| 6588 | int sel_idx) |
| 6589 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6590 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | /* need the manual connection? */ |
| 6592 | if (nid >= 0x12) { |
| 6593 | int idx = nid - 0x12; |
| 6594 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6595 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6596 | } |
| 6597 | } |
| 6598 | |
| 6599 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6600 | { |
| 6601 | struct alc_spec *spec = codec->spec; |
| 6602 | hda_nid_t nid; |
| 6603 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6604 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6605 | if (nid) { |
| 6606 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6607 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6608 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6609 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6610 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6611 | if (nid) |
| 6612 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6613 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6614 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6615 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6616 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6617 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6618 | |
| 6619 | #define ALC260_PIN_CD_NID 0x16 |
| 6620 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6621 | { |
| 6622 | struct alc_spec *spec = codec->spec; |
| 6623 | int i; |
| 6624 | |
| 6625 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6626 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6627 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6628 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6629 | if (nid != ALC260_PIN_CD_NID && |
| 6630 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6631 | snd_hda_codec_write(codec, nid, 0, |
| 6632 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6633 | AMP_OUT_MUTE); |
| 6634 | } |
| 6635 | } |
| 6636 | } |
| 6637 | |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6638 | #define alc260_auto_init_input_src alc880_auto_init_input_src |
| 6639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | /* |
| 6641 | * generic initialization of ADC, input mixers and output mixers |
| 6642 | */ |
| 6643 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6644 | /* |
| 6645 | * Unmute ADC0-1 and set the default input to mic-in |
| 6646 | */ |
| 6647 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6648 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6649 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6650 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6652 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6653 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6654 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6655 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6656 | */ |
| 6657 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6658 | /* mute analog inputs */ |
| 6659 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6660 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6662 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6663 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6664 | |
| 6665 | /* |
| 6666 | * Set up output mixers (0x08 - 0x0a) |
| 6667 | */ |
| 6668 | /* set vol=0 to output mixers */ |
| 6669 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6670 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6671 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6672 | /* set up input amps for analog loopback */ |
| 6673 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6674 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6675 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6676 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6677 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6678 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6679 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6680 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6681 | { } |
| 6682 | }; |
| 6683 | |
| 6684 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6685 | { |
| 6686 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6687 | int err; |
| 6688 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6689 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6690 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6691 | alc260_ignore); |
| 6692 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6693 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6694 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6695 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6696 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6697 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6698 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6699 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6700 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6701 | return err; |
| 6702 | |
| 6703 | spec->multiout.max_channels = 2; |
| 6704 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6705 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6706 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6707 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6708 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6709 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6710 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6711 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6712 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6713 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6714 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6715 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6716 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6717 | return 1; |
| 6718 | } |
| 6719 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6720 | /* additional initialization for auto-configuration model */ |
| 6721 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6722 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6723 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6724 | alc260_auto_init_multi_out(codec); |
| 6725 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | 7f311a4 | 2010-04-09 17:32:23 +0200 | [diff] [blame] | 6726 | alc260_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6727 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6728 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6729 | } |
| 6730 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6731 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6732 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6733 | { 0x07, HDA_INPUT, 0 }, |
| 6734 | { 0x07, HDA_INPUT, 1 }, |
| 6735 | { 0x07, HDA_INPUT, 2 }, |
| 6736 | { 0x07, HDA_INPUT, 3 }, |
| 6737 | { 0x07, HDA_INPUT, 4 }, |
| 6738 | { } /* end */ |
| 6739 | }; |
| 6740 | #endif |
| 6741 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6742 | /* |
| 6743 | * ALC260 configurations |
| 6744 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6745 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6746 | [ALC260_BASIC] = "basic", |
| 6747 | [ALC260_HP] = "hp", |
| 6748 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6749 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6750 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6751 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6752 | [ALC260_WILL] = "will", |
| 6753 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6754 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6755 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6756 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6757 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6758 | [ALC260_AUTO] = "auto", |
| 6759 | }; |
| 6760 | |
| 6761 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6762 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6763 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6764 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6765 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6766 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6767 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6768 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6769 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6770 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6771 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6772 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6773 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6774 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6775 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6776 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6777 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6778 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6779 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6780 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6781 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6782 | {} |
| 6783 | }; |
| 6784 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6785 | static struct alc_config_preset alc260_presets[] = { |
| 6786 | [ALC260_BASIC] = { |
| 6787 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6788 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6789 | .init_verbs = { alc260_init_verbs }, |
| 6790 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6791 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6792 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6793 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6794 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6795 | .channel_mode = alc260_modes, |
| 6796 | .input_mux = &alc260_capture_source, |
| 6797 | }, |
| 6798 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6799 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6800 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6801 | .init_verbs = { alc260_init_verbs, |
| 6802 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6803 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6804 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6805 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6806 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6807 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6808 | .channel_mode = alc260_modes, |
| 6809 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6810 | .unsol_event = alc260_hp_unsol_event, |
| 6811 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6812 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6813 | [ALC260_HP_DC7600] = { |
| 6814 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6815 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6816 | .init_verbs = { alc260_init_verbs, |
| 6817 | alc260_hp_dc7600_verbs }, |
| 6818 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6819 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6820 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6821 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6822 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6823 | .channel_mode = alc260_modes, |
| 6824 | .input_mux = &alc260_capture_source, |
| 6825 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6826 | .init_hook = alc260_hp_3012_automute, |
| 6827 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6828 | [ALC260_HP_3013] = { |
| 6829 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6830 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6831 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6832 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6833 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6834 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6835 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6836 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6837 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6838 | .channel_mode = alc260_modes, |
| 6839 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6840 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6841 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6842 | }, |
| 6843 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6844 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6845 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6846 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6847 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6848 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6849 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6850 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6851 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6852 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6853 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6854 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6855 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6856 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6857 | .init_verbs = { alc260_acer_init_verbs }, |
| 6858 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6859 | .dac_nids = alc260_dac_nids, |
| 6860 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6861 | .adc_nids = alc260_dual_adc_nids, |
| 6862 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6863 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6864 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6865 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6866 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6867 | [ALC260_FAVORIT100] = { |
| 6868 | .mixers = { alc260_favorit100_mixer }, |
| 6869 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6870 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6871 | .dac_nids = alc260_dac_nids, |
| 6872 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6873 | .adc_nids = alc260_dual_adc_nids, |
| 6874 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6875 | .channel_mode = alc260_modes, |
| 6876 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6877 | .input_mux = alc260_favorit100_capture_sources, |
| 6878 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6879 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6880 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6881 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6882 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6883 | .dac_nids = alc260_dac_nids, |
| 6884 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6885 | .adc_nids = alc260_adc_nids, |
| 6886 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6887 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6888 | .channel_mode = alc260_modes, |
| 6889 | .input_mux = &alc260_capture_source, |
| 6890 | }, |
| 6891 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6892 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6893 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6894 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6895 | .dac_nids = alc260_dac_nids, |
| 6896 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6897 | .adc_nids = alc260_adc_nids, |
| 6898 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6899 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6900 | .channel_mode = alc260_modes, |
| 6901 | .input_mux = &alc260_capture_source, |
| 6902 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6903 | .init_hook = alc260_replacer_672v_automute, |
| 6904 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6905 | #ifdef CONFIG_SND_DEBUG |
| 6906 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6907 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6908 | .init_verbs = { alc260_test_init_verbs }, |
| 6909 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6910 | .dac_nids = alc260_test_dac_nids, |
| 6911 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6912 | .adc_nids = alc260_test_adc_nids, |
| 6913 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6914 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6915 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6916 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6917 | }, |
| 6918 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6919 | }; |
| 6920 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6921 | static int patch_alc260(struct hda_codec *codec) |
| 6922 | { |
| 6923 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6924 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6925 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6926 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6927 | if (spec == NULL) |
| 6928 | return -ENOMEM; |
| 6929 | |
| 6930 | codec->spec = spec; |
| 6931 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6932 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6933 | alc260_models, |
| 6934 | alc260_cfg_tbl); |
| 6935 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6936 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6937 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6938 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6939 | } |
| 6940 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6941 | if (board_config == ALC260_AUTO) { |
| 6942 | /* automatic parse from the BIOS config */ |
| 6943 | err = alc260_parse_auto_config(codec); |
| 6944 | if (err < 0) { |
| 6945 | alc_free(codec); |
| 6946 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6947 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6948 | printk(KERN_INFO |
| 6949 | "hda_codec: Cannot set up configuration " |
| 6950 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6951 | board_config = ALC260_BASIC; |
| 6952 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6953 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6954 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6955 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6956 | if (err < 0) { |
| 6957 | alc_free(codec); |
| 6958 | return err; |
| 6959 | } |
| 6960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6961 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6962 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6963 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6964 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6965 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6966 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6967 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6968 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6969 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6970 | if (!spec->adc_nids && spec->input_mux) { |
| 6971 | /* check whether NID 0x04 is valid */ |
| 6972 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6973 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6974 | /* get type */ |
| 6975 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6976 | spec->adc_nids = alc260_adc_nids_alt; |
| 6977 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6978 | } else { |
| 6979 | spec->adc_nids = alc260_adc_nids; |
| 6980 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6981 | } |
| 6982 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6983 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6984 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6985 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6986 | spec->vmaster_nid = 0x08; |
| 6987 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6988 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6989 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6990 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6991 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6992 | if (!spec->loopback.amplist) |
| 6993 | spec->loopback.amplist = alc260_loopbacks; |
| 6994 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6995 | |
| 6996 | return 0; |
| 6997 | } |
| 6998 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6999 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7000 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7001 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7002 | * |
| 7003 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 7004 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 7005 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 7006 | * 6-channel independent captures. |
| 7007 | * |
| 7008 | * In addition, an independent DAC for the multi-playback (not used in this |
| 7009 | * driver yet). |
| 7010 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7011 | #define ALC882_DIGOUT_NID 0x06 |
| 7012 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7013 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 7014 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 7015 | #define ALC1200_DIGOUT_NID 0x10 |
| 7016 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7017 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 7018 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7019 | { 8, NULL } |
| 7020 | }; |
| 7021 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7022 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7023 | static hda_nid_t alc882_dac_nids[4] = { |
| 7024 | /* front, rear, clfe, rear_surr */ |
| 7025 | 0x02, 0x03, 0x04, 0x05 |
| 7026 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7027 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7028 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7029 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7030 | #define alc882_adc_nids alc880_adc_nids |
| 7031 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7032 | #define alc883_adc_nids alc882_adc_nids_alt |
| 7033 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 7034 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 7035 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7036 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7037 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 7038 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7039 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 7040 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 7041 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 7042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7043 | /* input MUX */ |
| 7044 | /* FIXME: should be a matrix-type input source selection */ |
| 7045 | |
| 7046 | static struct hda_input_mux alc882_capture_source = { |
| 7047 | .num_items = 4, |
| 7048 | .items = { |
| 7049 | { "Mic", 0x0 }, |
| 7050 | { "Front Mic", 0x1 }, |
| 7051 | { "Line", 0x2 }, |
| 7052 | { "CD", 0x4 }, |
| 7053 | }, |
| 7054 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7055 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7056 | #define alc883_capture_source alc882_capture_source |
| 7057 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7058 | static struct hda_input_mux alc889_capture_source = { |
| 7059 | .num_items = 3, |
| 7060 | .items = { |
| 7061 | { "Front Mic", 0x0 }, |
| 7062 | { "Mic", 0x3 }, |
| 7063 | { "Line", 0x2 }, |
| 7064 | }, |
| 7065 | }; |
| 7066 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7067 | static struct hda_input_mux mb5_capture_source = { |
| 7068 | .num_items = 3, |
| 7069 | .items = { |
| 7070 | { "Mic", 0x1 }, |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7071 | { "Line", 0x7 }, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7072 | { "CD", 0x4 }, |
| 7073 | }, |
| 7074 | }; |
| 7075 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7076 | static struct hda_input_mux macmini3_capture_source = { |
| 7077 | .num_items = 2, |
| 7078 | .items = { |
| 7079 | { "Line", 0x2 }, |
| 7080 | { "CD", 0x4 }, |
| 7081 | }, |
| 7082 | }; |
| 7083 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7084 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 7085 | .num_items = 4, |
| 7086 | .items = { |
| 7087 | { "Mic", 0x1 }, |
| 7088 | { "Front Mic", 0x0 }, |
| 7089 | { "Line", 0x2 }, |
| 7090 | { "CD", 0x4 }, |
| 7091 | }, |
| 7092 | }; |
| 7093 | |
| 7094 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 7095 | .num_items = 2, |
| 7096 | .items = { |
| 7097 | { "Mic", 0x1 }, |
| 7098 | { "Line", 0x2 }, |
| 7099 | }, |
| 7100 | }; |
| 7101 | |
| 7102 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 7103 | .num_items = 4, |
| 7104 | .items = { |
| 7105 | { "Mic", 0x0 }, |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 7106 | { "Int Mic", 0x1 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7107 | { "Line", 0x2 }, |
| 7108 | { "CD", 0x4 }, |
| 7109 | }, |
| 7110 | }; |
| 7111 | |
| 7112 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 7113 | .num_items = 2, |
| 7114 | .items = { |
| 7115 | { "Mic", 0x0 }, |
| 7116 | { "Int Mic", 0x1 }, |
| 7117 | }, |
| 7118 | }; |
| 7119 | |
| 7120 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 7121 | .num_items = 3, |
| 7122 | .items = { |
| 7123 | { "Mic", 0x0 }, |
| 7124 | { "Front Mic", 0x1 }, |
| 7125 | { "Line", 0x4 }, |
| 7126 | }, |
| 7127 | }; |
| 7128 | |
| 7129 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 7130 | .num_items = 2, |
| 7131 | .items = { |
| 7132 | { "Mic", 0x0 }, |
| 7133 | { "Line", 0x2 }, |
| 7134 | }, |
| 7135 | }; |
| 7136 | |
| 7137 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 7138 | .num_items = 2, |
| 7139 | .items = { |
| 7140 | { "Mic", 0x0 }, |
| 7141 | /* Front Mic (0x01) unused */ |
| 7142 | { "Line", 0x2 }, |
| 7143 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 7144 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7145 | }, |
| 7146 | }; |
| 7147 | |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7148 | static struct hda_input_mux alc889A_imac91_capture_source = { |
| 7149 | .num_items = 2, |
| 7150 | .items = { |
| 7151 | { "Mic", 0x01 }, |
| 7152 | { "Line", 0x2 }, /* Not sure! */ |
| 7153 | }, |
| 7154 | }; |
| 7155 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7156 | /* |
| 7157 | * 2ch mode |
| 7158 | */ |
| 7159 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 7160 | { 2, NULL } |
| 7161 | }; |
| 7162 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7163 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7164 | * 2ch mode |
| 7165 | */ |
| 7166 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 7167 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7168 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7169 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7170 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7171 | { } /* end */ |
| 7172 | }; |
| 7173 | |
| 7174 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7175 | * 4ch mode |
| 7176 | */ |
| 7177 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7178 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7179 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7180 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7181 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7182 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7183 | { } /* end */ |
| 7184 | }; |
| 7185 | |
| 7186 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7187 | * 6ch mode |
| 7188 | */ |
| 7189 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7190 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7191 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7192 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7193 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7194 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7195 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7196 | { } /* end */ |
| 7197 | }; |
| 7198 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7199 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7200 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7201 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7202 | { 6, alc882_3ST_ch6_init }, |
| 7203 | }; |
| 7204 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7205 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7206 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7207 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7208 | * 2ch mode |
| 7209 | */ |
| 7210 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7211 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7212 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7213 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7214 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7215 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7216 | { } /* end */ |
| 7217 | }; |
| 7218 | |
| 7219 | /* |
| 7220 | * 4ch mode |
| 7221 | */ |
| 7222 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7223 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7224 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7225 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7226 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7227 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7228 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7229 | { } /* end */ |
| 7230 | }; |
| 7231 | |
| 7232 | /* |
| 7233 | * 6ch mode |
| 7234 | */ |
| 7235 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7236 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7237 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7238 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7239 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7240 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7241 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7242 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7243 | { } /* end */ |
| 7244 | }; |
| 7245 | |
| 7246 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7247 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7248 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7249 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7250 | }; |
| 7251 | |
| 7252 | |
| 7253 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7254 | * 6ch mode |
| 7255 | */ |
| 7256 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7257 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7258 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7259 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7260 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7261 | { } /* end */ |
| 7262 | }; |
| 7263 | |
| 7264 | /* |
| 7265 | * 8ch mode |
| 7266 | */ |
| 7267 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7268 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7269 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7270 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7271 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7272 | { } /* end */ |
| 7273 | }; |
| 7274 | |
| 7275 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7276 | { 6, alc882_sixstack_ch6_init }, |
| 7277 | { 8, alc882_sixstack_ch8_init }, |
| 7278 | }; |
| 7279 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7280 | |
| 7281 | /* Macbook Air 2,1 */ |
| 7282 | |
| 7283 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7284 | { 2, NULL }, |
| 7285 | }; |
| 7286 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7287 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7288 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7289 | */ |
| 7290 | |
| 7291 | /* |
| 7292 | * 2ch mode |
| 7293 | */ |
| 7294 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7295 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7296 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7297 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7298 | { } /* end */ |
| 7299 | }; |
| 7300 | |
| 7301 | /* |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7302 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7303 | */ |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7304 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7305 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7306 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7307 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7308 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7309 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7310 | { } /* end */ |
| 7311 | }; |
| 7312 | |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7313 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7314 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7315 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7316 | }; |
| 7317 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7318 | /* |
| 7319 | * 2ch |
| 7320 | * Speakers/Woofer/HP = Front |
| 7321 | * LineIn = Input |
| 7322 | */ |
| 7323 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7324 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7325 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7326 | { } /* end */ |
| 7327 | }; |
| 7328 | |
| 7329 | /* |
| 7330 | * 6ch mode |
| 7331 | * Speakers/HP = Front |
| 7332 | * Woofer = LFE |
| 7333 | * LineIn = Surround |
| 7334 | */ |
| 7335 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7336 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7337 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7338 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7339 | { } /* end */ |
| 7340 | }; |
| 7341 | |
| 7342 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7343 | { 2, alc885_mb5_ch2_init }, |
| 7344 | { 6, alc885_mb5_ch6_init }, |
| 7345 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7346 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7347 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7348 | |
| 7349 | /* |
| 7350 | * 2ch mode |
| 7351 | */ |
| 7352 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7353 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7354 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7355 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7356 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7357 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7358 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7359 | { } /* end */ |
| 7360 | }; |
| 7361 | |
| 7362 | /* |
| 7363 | * 4ch mode |
| 7364 | */ |
| 7365 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7366 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7367 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7368 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7369 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7370 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7371 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7372 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7373 | { } /* end */ |
| 7374 | }; |
| 7375 | |
| 7376 | /* |
| 7377 | * 6ch mode |
| 7378 | */ |
| 7379 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7380 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7381 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7382 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7383 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7384 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7385 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7386 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7387 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7388 | { } /* end */ |
| 7389 | }; |
| 7390 | |
| 7391 | /* |
| 7392 | * 8ch mode |
| 7393 | */ |
| 7394 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7395 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7396 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7397 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7398 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7399 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7400 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7401 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7402 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7403 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7404 | { } /* end */ |
| 7405 | }; |
| 7406 | |
| 7407 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7408 | { 2, alc883_4ST_ch2_init }, |
| 7409 | { 4, alc883_4ST_ch4_init }, |
| 7410 | { 6, alc883_4ST_ch6_init }, |
| 7411 | { 8, alc883_4ST_ch8_init }, |
| 7412 | }; |
| 7413 | |
| 7414 | |
| 7415 | /* |
| 7416 | * 2ch mode |
| 7417 | */ |
| 7418 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7419 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7420 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7421 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7422 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7423 | { } /* end */ |
| 7424 | }; |
| 7425 | |
| 7426 | /* |
| 7427 | * 4ch mode |
| 7428 | */ |
| 7429 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7430 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7431 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7432 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7433 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7434 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7435 | { } /* end */ |
| 7436 | }; |
| 7437 | |
| 7438 | /* |
| 7439 | * 6ch mode |
| 7440 | */ |
| 7441 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7442 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7443 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7444 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7445 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7446 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7447 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7448 | { } /* end */ |
| 7449 | }; |
| 7450 | |
| 7451 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7452 | { 2, alc883_3ST_ch2_intel_init }, |
| 7453 | { 4, alc883_3ST_ch4_intel_init }, |
| 7454 | { 6, alc883_3ST_ch6_intel_init }, |
| 7455 | }; |
| 7456 | |
| 7457 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7458 | * 2ch mode |
| 7459 | */ |
| 7460 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7461 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7462 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7463 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7464 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7465 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7466 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7467 | { } /* end */ |
| 7468 | }; |
| 7469 | |
| 7470 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7471 | * 6ch mode |
| 7472 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7473 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7474 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7475 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7476 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7477 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7478 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7479 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7480 | { } /* end */ |
| 7481 | }; |
| 7482 | |
| 7483 | /* |
| 7484 | * 8ch mode |
| 7485 | */ |
| 7486 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7487 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7488 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7489 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7490 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7491 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7492 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7493 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7494 | { } /* end */ |
| 7495 | }; |
| 7496 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7497 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7498 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7499 | { 6, alc889_ch6_intel_init }, |
| 7500 | { 8, alc889_ch8_intel_init }, |
| 7501 | }; |
| 7502 | |
| 7503 | /* |
| 7504 | * 6ch mode |
| 7505 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7506 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7507 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7508 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7509 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7510 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7511 | { } /* end */ |
| 7512 | }; |
| 7513 | |
| 7514 | /* |
| 7515 | * 8ch mode |
| 7516 | */ |
| 7517 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7518 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7519 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7520 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7521 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7522 | { } /* end */ |
| 7523 | }; |
| 7524 | |
| 7525 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7526 | { 6, alc883_sixstack_ch6_init }, |
| 7527 | { 8, alc883_sixstack_ch8_init }, |
| 7528 | }; |
| 7529 | |
| 7530 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7531 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7532 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7533 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7534 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7535 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7536 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7537 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7538 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7539 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7540 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7541 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7542 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7543 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7544 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7545 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7546 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7547 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7548 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7549 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7550 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7551 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7553 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7554 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7555 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7556 | { } /* end */ |
| 7557 | }; |
| 7558 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7559 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7560 | |
| 7561 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7562 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7563 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7564 | { } |
| 7565 | }; |
| 7566 | |
| 7567 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7568 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7569 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7570 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7571 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7572 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7573 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7574 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7575 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7577 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7578 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7579 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7580 | { } /* end */ |
| 7581 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7582 | |
| 7583 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7585 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7586 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7587 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7588 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7589 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7590 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7591 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7592 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7593 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7595 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7596 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7598 | { } /* end */ |
| 7599 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7600 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7601 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7603 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7604 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7605 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7606 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7607 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7608 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7609 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7611 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7612 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7613 | { } /* end */ |
| 7614 | }; |
| 7615 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7616 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 7617 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7618 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7619 | { } /* end */ |
| 7620 | }; |
| 7621 | |
| 7622 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7623 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7624 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7625 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7626 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7627 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7628 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7629 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7632 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7633 | { } /* end */ |
| 7634 | }; |
| 7635 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7636 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7637 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7638 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7639 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7641 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7645 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7646 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7647 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7648 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7649 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7650 | { } /* end */ |
| 7651 | }; |
| 7652 | |
| 7653 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7654 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7655 | */ |
| 7656 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7658 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7659 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7660 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7661 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7662 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7666 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7667 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7668 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7669 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7670 | { } /* end */ |
| 7671 | }; |
| 7672 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7673 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7674 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7675 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7677 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7678 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7679 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7680 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7682 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7683 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7684 | { } /* end */ |
| 7685 | }; |
| 7686 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7687 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7688 | { |
| 7689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7690 | .name = "Channel Mode", |
| 7691 | .info = alc_ch_mode_info, |
| 7692 | .get = alc_ch_mode_get, |
| 7693 | .put = alc_ch_mode_put, |
| 7694 | }, |
| 7695 | { } /* end */ |
| 7696 | }; |
| 7697 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7698 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7699 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7700 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7701 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7702 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7703 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7704 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7705 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7706 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7708 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7710 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7712 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7713 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7714 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7715 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7716 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7718 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7719 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7720 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7721 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7722 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7723 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7724 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7725 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7726 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7727 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7728 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7729 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7730 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7731 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7732 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7733 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7734 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7737 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7738 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7739 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7740 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7741 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7742 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7743 | |
| 7744 | /* FIXME: use matrix-type input source selection */ |
| 7745 | /* 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] | 7746 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7747 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7748 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7750 | /* ADC2: mute amp left and right */ |
| 7751 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7752 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7753 | /* ADC3: mute amp left and right */ |
| 7754 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7755 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7756 | |
| 7757 | { } |
| 7758 | }; |
| 7759 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7760 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7761 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7762 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7765 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7766 | /* ADC1: mute amp left and right */ |
| 7767 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7768 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7769 | { } |
| 7770 | }; |
| 7771 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7772 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7773 | /* change to EAPD mode */ |
| 7774 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7775 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7776 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7777 | }; |
| 7778 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7779 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7780 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7781 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7782 | { } |
| 7783 | }; |
| 7784 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7785 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7786 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7787 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7788 | {} |
| 7789 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7790 | |
| 7791 | static struct hda_verb alc885_init_verbs[] = { |
| 7792 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7793 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7794 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7795 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7796 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7797 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7798 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7799 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7800 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7801 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7802 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7803 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7804 | |
| 7805 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7808 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7809 | /* Front Pin: output 0 (0x0c) */ |
| 7810 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7811 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7812 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7813 | /* Rear Pin: output 1 (0x0d) */ |
| 7814 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7815 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7816 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7817 | /* CLFE Pin: output 2 (0x0e) */ |
| 7818 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7819 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7820 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7821 | /* Side Pin: output 3 (0x0f) */ |
| 7822 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7823 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7824 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7825 | /* Mic (rear) pin: input vref at 80% */ |
| 7826 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7827 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7828 | /* Front Mic pin: input vref at 80% */ |
| 7829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7831 | /* Line In pin: input */ |
| 7832 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7833 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7834 | |
| 7835 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7836 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7838 | /* Input mixer2 */ |
| 7839 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7840 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7841 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7842 | /* ADC2: mute amp left and right */ |
| 7843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7844 | /* ADC3: mute amp left and right */ |
| 7845 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7846 | |
| 7847 | { } |
| 7848 | }; |
| 7849 | |
| 7850 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7851 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7852 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7854 | { } |
| 7855 | }; |
| 7856 | |
| 7857 | |
| 7858 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7859 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7860 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7862 | { } |
| 7863 | }; |
| 7864 | |
| 7865 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7866 | #define alc883_init_verbs alc882_base_init_verbs |
| 7867 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7868 | /* Mac Pro test */ |
| 7869 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7870 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7871 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7872 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7874 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7875 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7876 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7877 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7878 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7879 | { } /* end */ |
| 7880 | }; |
| 7881 | |
| 7882 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7883 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7887 | /* Front Pin: output 0 (0x0c) */ |
| 7888 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7890 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7891 | /* Front Mic pin: input vref at 80% */ |
| 7892 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7893 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7894 | /* Speaker: output */ |
| 7895 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7896 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7897 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7898 | /* Headphone output (output 0 - 0x0c) */ |
| 7899 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7900 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7901 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7902 | |
| 7903 | /* FIXME: use matrix-type input source selection */ |
| 7904 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7905 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7906 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7907 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7908 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7909 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7910 | /* Input mixer2 */ |
| 7911 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7912 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7913 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7914 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7915 | /* Input mixer3 */ |
| 7916 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7917 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7918 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7919 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7920 | /* ADC1: mute amp left and right */ |
| 7921 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7922 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7923 | /* ADC2: mute amp left and right */ |
| 7924 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7925 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7926 | /* ADC3: mute amp left and right */ |
| 7927 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7928 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7929 | |
| 7930 | { } |
| 7931 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7932 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7933 | /* Macbook 5,1 */ |
| 7934 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7935 | /* DACs */ |
| 7936 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7937 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7938 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7939 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7940 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7941 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7943 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7944 | /* Surround mixer */ |
| 7945 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7946 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7947 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7948 | /* LFE mixer */ |
| 7949 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7950 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7952 | /* HP mixer */ |
| 7953 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7954 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7955 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7956 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7957 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7958 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7959 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7960 | /* LFE Pin (0x0e) */ |
| 7961 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7962 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7963 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7964 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7967 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7968 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7969 | /* Front Mic pin: input vref at 80% */ |
| 7970 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7971 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7972 | /* Line In pin */ |
| 7973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7975 | |
Alex Murray | b8f171e | 2010-06-14 12:08:43 +0930 | [diff] [blame] | 7976 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, |
| 7977 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, |
| 7978 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7979 | { } |
| 7980 | }; |
| 7981 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7982 | /* Macmini 3,1 */ |
| 7983 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7984 | /* DACs */ |
| 7985 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7986 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7987 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7988 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7989 | /* Front mixer */ |
| 7990 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7991 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7992 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7993 | /* Surround mixer */ |
| 7994 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7995 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7996 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7997 | /* LFE mixer */ |
| 7998 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8000 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8001 | /* HP mixer */ |
| 8002 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8003 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8004 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8005 | /* Front Pin (0x0c) */ |
| 8006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8007 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8008 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8009 | /* LFE Pin (0x0e) */ |
| 8010 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 8011 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8012 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8013 | /* HP Pin (0x0f) */ |
| 8014 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8015 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8016 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8017 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8018 | /* Line In pin */ |
| 8019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8021 | |
| 8022 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8023 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8024 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8026 | { } |
| 8027 | }; |
| 8028 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8029 | |
| 8030 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 8031 | /*Internal and HP Speaker Mixer*/ |
| 8032 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8033 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8034 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8035 | /*Internal Speaker Pin (0x0c)*/ |
| 8036 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8037 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8038 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8039 | /* HP Pin: output 0 (0x0e) */ |
| 8040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 8041 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8042 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8044 | /* Line in (is hp when jack connected)*/ |
| 8045 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8046 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8047 | |
| 8048 | { } |
| 8049 | }; |
| 8050 | |
| 8051 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8052 | /* Macbook Pro rev3 */ |
| 8053 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 8054 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 8055 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8056 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8057 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8058 | /* Rear mixer */ |
| 8059 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8060 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8061 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8062 | /* HP mixer */ |
| 8063 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8064 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8065 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8066 | /* Front Pin: output 0 (0x0c) */ |
| 8067 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8068 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8069 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8070 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8071 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730af | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 8072 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8073 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8074 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8075 | /* Mic (rear) pin: input vref at 80% */ |
| 8076 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8077 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8078 | /* Front Mic pin: input vref at 80% */ |
| 8079 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8081 | /* Line In pin: use output 1 when in LineOut mode */ |
| 8082 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8084 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8085 | |
| 8086 | /* FIXME: use matrix-type input source selection */ |
| 8087 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8088 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8089 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8090 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8091 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8092 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8093 | /* Input mixer2 */ |
| 8094 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8095 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8096 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8097 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8098 | /* Input mixer3 */ |
| 8099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8101 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8102 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8103 | /* ADC1: mute amp left and right */ |
| 8104 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8105 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8106 | /* ADC2: mute amp left and right */ |
| 8107 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8109 | /* ADC3: mute amp left and right */ |
| 8110 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8111 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8112 | |
| 8113 | { } |
| 8114 | }; |
| 8115 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8116 | /* iMac 9,1 */ |
| 8117 | static struct hda_verb alc885_imac91_init_verbs[] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8118 | /* Internal Speaker Pin (0x0c) */ |
| 8119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8121 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8122 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 8123 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8124 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8125 | /* HP Pin: Rear */ |
| 8126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8127 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8128 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8129 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 8130 | /* Line in Rear */ |
| 8131 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 8132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8133 | /* Front Mic pin: input vref at 80% */ |
| 8134 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8135 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8136 | /* Rear mixer */ |
| 8137 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8138 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8139 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8140 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 8141 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8144 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8149 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8152 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8154 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8159 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8161 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8162 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8163 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8164 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8165 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8166 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8167 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8168 | { } |
| 8169 | }; |
| 8170 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8171 | /* iMac 24 mixer. */ |
| 8172 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8173 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8174 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8175 | { } /* end */ |
| 8176 | }; |
| 8177 | |
| 8178 | /* iMac 24 init verbs. */ |
| 8179 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8180 | /* Internal speakers: output 0 (0x0c) */ |
| 8181 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8182 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8183 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8184 | /* Internal speakers: output 0 (0x0c) */ |
| 8185 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8186 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8187 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8188 | /* Headphone: output 0 (0x0c) */ |
| 8189 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8190 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8191 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8192 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8193 | /* Front Mic: input vref at 80% */ |
| 8194 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8195 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8196 | { } |
| 8197 | }; |
| 8198 | |
| 8199 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8200 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8201 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8202 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8203 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8204 | spec->autocfg.hp_pins[0] = 0x14; |
| 8205 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8206 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8207 | } |
| 8208 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8209 | #define alc885_mb5_setup alc885_imac24_setup |
| 8210 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8211 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8212 | /* Macbook Air 2,1 */ |
| 8213 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8214 | { |
| 8215 | struct alc_spec *spec = codec->spec; |
| 8216 | |
| 8217 | spec->autocfg.hp_pins[0] = 0x14; |
| 8218 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8219 | } |
| 8220 | |
| 8221 | |
| 8222 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8223 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8224 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8225 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8226 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8227 | spec->autocfg.hp_pins[0] = 0x15; |
| 8228 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8229 | } |
| 8230 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8231 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8232 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8233 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8234 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8235 | spec->autocfg.hp_pins[0] = 0x14; |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 8236 | spec->autocfg.speaker_pins[0] = 0x18; |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8237 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8238 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8239 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8240 | static struct hda_verb alc882_targa_verbs[] = { |
| 8241 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8242 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8243 | |
| 8244 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8245 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8246 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8247 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8248 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8249 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8250 | |
| 8251 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8252 | { } /* end */ |
| 8253 | }; |
| 8254 | |
| 8255 | /* toggle speaker-output according to the hp-jack state */ |
| 8256 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8257 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8258 | struct alc_spec *spec = codec->spec; |
| 8259 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8260 | 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] | 8261 | spec->jack_present ? 1 : 3); |
| 8262 | } |
| 8263 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8264 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8265 | { |
| 8266 | struct alc_spec *spec = codec->spec; |
| 8267 | |
| 8268 | spec->autocfg.hp_pins[0] = 0x14; |
| 8269 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8270 | } |
| 8271 | |
| 8272 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8273 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8274 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8275 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8276 | } |
| 8277 | |
| 8278 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8279 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8280 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8281 | |
| 8282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8283 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8284 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8285 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8286 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8288 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8289 | |
| 8290 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8291 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8292 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8293 | { } /* end */ |
| 8294 | }; |
| 8295 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8296 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8298 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8299 | |
| 8300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8302 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8303 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8304 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8305 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8306 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8307 | |
| 8308 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8309 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8310 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8311 | { } /* end */ |
| 8312 | }; |
| 8313 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8314 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8315 | { |
| 8316 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8317 | |
| 8318 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8319 | AC_VERB_GET_GPIO_DATA, 0); |
| 8320 | |
| 8321 | if (!muted) |
| 8322 | gpiostate |= (1 << pin); |
| 8323 | else |
| 8324 | gpiostate &= ~(1 << pin); |
| 8325 | |
| 8326 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8327 | AC_VERB_GET_GPIO_MASK, 0); |
| 8328 | gpiomask |= (1 << pin); |
| 8329 | |
| 8330 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8331 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8332 | gpiodir |= (1 << pin); |
| 8333 | |
| 8334 | |
| 8335 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8336 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8337 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8338 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8339 | |
| 8340 | msleep(1); |
| 8341 | |
| 8342 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8343 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8344 | } |
| 8345 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8346 | /* set up GPIO at initialization */ |
| 8347 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8348 | { |
| 8349 | alc882_gpio_mute(codec, 0, 0); |
| 8350 | alc882_gpio_mute(codec, 1, 0); |
| 8351 | } |
| 8352 | |
| 8353 | /* set up GPIO and update auto-muting at initialization */ |
| 8354 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8355 | { |
| 8356 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8357 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8358 | } |
| 8359 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8360 | /* |
| 8361 | * generic initialization of ADC, input mixers and output mixers |
| 8362 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8363 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8364 | /* |
| 8365 | * Unmute ADC0-2 and set the default input to mic-in |
| 8366 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8367 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8368 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8369 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8370 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8371 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8372 | /* |
| 8373 | * Set up output mixers (0x0c - 0x0f) |
| 8374 | */ |
| 8375 | /* set vol=0 to output mixers */ |
| 8376 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8377 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8378 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8379 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8380 | /* set up input amps for analog loopback */ |
| 8381 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8384 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8385 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8386 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8387 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8388 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8390 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8391 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8392 | |
| 8393 | /* FIXME: use matrix-type input source selection */ |
| 8394 | /* 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] | 8395 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8396 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8397 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8399 | { } |
| 8400 | }; |
| 8401 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8402 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8403 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8404 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8405 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8406 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8407 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8408 | { } /* end */ |
| 8409 | }; |
| 8410 | |
| 8411 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8412 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8413 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8414 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8415 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8416 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8417 | { } /* end */ |
| 8418 | }; |
| 8419 | |
| 8420 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8421 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8422 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8423 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8424 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8425 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8426 | { } /* end */ |
| 8427 | }; |
| 8428 | |
| 8429 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8430 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8431 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8432 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8433 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8434 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8435 | { } /* end */ |
| 8436 | }; |
| 8437 | |
| 8438 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8439 | { 2, alc889A_mb31_ch2_init }, |
| 8440 | { 4, alc889A_mb31_ch4_init }, |
| 8441 | { 5, alc889A_mb31_ch5_init }, |
| 8442 | { 6, alc889A_mb31_ch6_init }, |
| 8443 | }; |
| 8444 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8445 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8446 | /* eanable EAPD on medion laptop */ |
| 8447 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8448 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8449 | { } |
| 8450 | }; |
| 8451 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8452 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8453 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8454 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8455 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8456 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8457 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8458 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8459 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8460 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8461 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8462 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8463 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8464 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8465 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8466 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8467 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8468 | { } /* end */ |
| 8469 | }; |
| 8470 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8471 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8472 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8473 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8474 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8475 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8477 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8478 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8479 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8480 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8481 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8482 | { } /* end */ |
| 8483 | }; |
| 8484 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8485 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8486 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8487 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8488 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8489 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8491 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8493 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8494 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8495 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8496 | { } /* end */ |
| 8497 | }; |
| 8498 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8499 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8500 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8501 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8502 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8503 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8504 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8506 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8510 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8511 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8512 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8513 | { } /* end */ |
| 8514 | }; |
| 8515 | |
| 8516 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8518 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8519 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8520 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8521 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8522 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8523 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8524 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8525 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8526 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8527 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8528 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8529 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8530 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8531 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8532 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8533 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8534 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8535 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8536 | { } /* end */ |
| 8537 | }; |
| 8538 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8539 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8541 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8542 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8543 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8544 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8545 | HDA_OUTPUT), |
| 8546 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8547 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8548 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8550 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8551 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8552 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8553 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8554 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8555 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8557 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8558 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8559 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8560 | { } /* end */ |
| 8561 | }; |
| 8562 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8563 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8564 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8565 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8566 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8567 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8568 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8569 | HDA_OUTPUT), |
| 8570 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8571 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8572 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8573 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8574 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8575 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8576 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8577 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8579 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8581 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8582 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8583 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8584 | { } /* end */ |
| 8585 | }; |
| 8586 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8587 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8588 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8589 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8590 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8591 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8592 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8593 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8594 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8595 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8596 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8597 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8598 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8599 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8600 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8601 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8602 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8603 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8604 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8605 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8607 | { } /* end */ |
| 8608 | }; |
| 8609 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8610 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8612 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8613 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8614 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8615 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8616 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8617 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8618 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8619 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8620 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8621 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8622 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8623 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8624 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8626 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8628 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8629 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8630 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8631 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8632 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8633 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8635 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8639 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8641 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8642 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8643 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8644 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8645 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8646 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8647 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8648 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8649 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8650 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8651 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8652 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8653 | { } /* end */ |
| 8654 | }; |
| 8655 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8656 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8657 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8658 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8659 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8660 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8661 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8662 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8664 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8665 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8666 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8667 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8668 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8669 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8670 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8672 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8673 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
David Henningsson | 150b432 | 2010-07-29 14:46:42 +0200 | [diff] [blame] | 8676 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8677 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8678 | { } /* end */ |
| 8679 | }; |
| 8680 | |
| 8681 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8682 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8683 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8684 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8685 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8686 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8687 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8688 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8691 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8692 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8693 | |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 8694 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { |
| 8695 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8696 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8697 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8698 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), |
| 8699 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), |
| 8700 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), |
| 8701 | { } /* end */ |
| 8702 | }; |
| 8703 | |
| 8704 | static struct hda_verb alc883_medion_wim2160_verbs[] = { |
| 8705 | /* Unmute front mixer */ |
| 8706 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8708 | |
| 8709 | /* Set speaker pin to front mixer */ |
| 8710 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8711 | |
| 8712 | /* Init headphone pin */ |
| 8713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8714 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8715 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8716 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8717 | |
| 8718 | { } /* end */ |
| 8719 | }; |
| 8720 | |
| 8721 | /* toggle speaker-output according to the hp-jack state */ |
| 8722 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) |
| 8723 | { |
| 8724 | struct alc_spec *spec = codec->spec; |
| 8725 | |
| 8726 | spec->autocfg.hp_pins[0] = 0x1a; |
| 8727 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8728 | } |
| 8729 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8730 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8731 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8732 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8733 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8734 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8735 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8736 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8737 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8739 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8740 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8741 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8742 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8743 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8744 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8745 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8746 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8747 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8748 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8749 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8750 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8752 | { } /* end */ |
| 8753 | }; |
| 8754 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8755 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8759 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8761 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8762 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8763 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8764 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8765 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8766 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8768 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8769 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8770 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8772 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8774 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8777 | { } /* end */ |
| 8778 | }; |
| 8779 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8780 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8781 | /* Output mixers */ |
| 8782 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8783 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8784 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8785 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8786 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8787 | HDA_OUTPUT), |
| 8788 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8789 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8790 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8791 | /* Output switches */ |
| 8792 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8793 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8794 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8795 | /* Boost mixers */ |
| 8796 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8797 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8798 | /* Input mixers */ |
| 8799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8801 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8802 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8803 | { } /* end */ |
| 8804 | }; |
| 8805 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8806 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8807 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8808 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8811 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8813 | { } /* end */ |
| 8814 | }; |
| 8815 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8816 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8817 | .ops = &snd_hda_bind_vol, |
| 8818 | .values = { |
| 8819 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8820 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8821 | 0 |
| 8822 | }, |
| 8823 | }; |
| 8824 | |
| 8825 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8826 | .ops = &snd_hda_bind_sw, |
| 8827 | .values = { |
| 8828 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8829 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8830 | 0 |
| 8831 | }, |
| 8832 | }; |
| 8833 | |
| 8834 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8835 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8836 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8837 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8838 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8839 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8841 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8843 | { } /* end */ |
| 8844 | }; |
| 8845 | |
| 8846 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8847 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8848 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8849 | { |
| 8850 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8851 | /* .name = "Capture Source", */ |
| 8852 | .name = "Input Source", |
| 8853 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8854 | .info = alc_mux_enum_info, |
| 8855 | .get = alc_mux_enum_get, |
| 8856 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8857 | }, |
| 8858 | { } /* end */ |
| 8859 | }; |
| 8860 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8861 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8862 | { |
| 8863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8864 | .name = "Channel Mode", |
| 8865 | .info = alc_ch_mode_info, |
| 8866 | .get = alc_ch_mode_get, |
| 8867 | .put = alc_ch_mode_put, |
| 8868 | }, |
| 8869 | { } /* end */ |
| 8870 | }; |
| 8871 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8872 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8873 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8874 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8875 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8876 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8877 | spec->autocfg.hp_pins[0] = 0x15; |
| 8878 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8879 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8880 | } |
| 8881 | |
| 8882 | /* auto-toggle front mic */ |
| 8883 | /* |
| 8884 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8885 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8886 | 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] | 8887 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8888 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8889 | } |
| 8890 | */ |
| 8891 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8892 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8893 | /* HP */ |
| 8894 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8896 | /* Subwoofer */ |
| 8897 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8898 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8899 | |
| 8900 | /* enable unsolicited event */ |
| 8901 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8902 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8903 | |
| 8904 | { } /* end */ |
| 8905 | }; |
| 8906 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8907 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8908 | /* HP */ |
| 8909 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8910 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8911 | /* Int speaker */ |
| 8912 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8913 | |
| 8914 | /* enable unsolicited event */ |
| 8915 | /* |
| 8916 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8917 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8918 | */ |
| 8919 | |
| 8920 | { } /* end */ |
| 8921 | }; |
| 8922 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8923 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8924 | /* HP */ |
| 8925 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8926 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8927 | /* Int speaker */ |
| 8928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8929 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8930 | |
| 8931 | /* enable unsolicited event */ |
| 8932 | {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] | 8933 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8934 | |
| 8935 | { } /* end */ |
| 8936 | }; |
| 8937 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8938 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8939 | /* HP */ |
| 8940 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8941 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8942 | /* Subwoofer */ |
| 8943 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8944 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8945 | |
| 8946 | /* enable unsolicited event */ |
| 8947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8948 | |
| 8949 | { } /* end */ |
| 8950 | }; |
| 8951 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8952 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8953 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8954 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8955 | |
| 8956 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8957 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8958 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8959 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8960 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8961 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8962 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8963 | /* Connect Mic jack to CLFE */ |
| 8964 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8965 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8966 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8967 | /* Connect Line-in jack to Surround */ |
| 8968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8970 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8971 | /* Connect HP out jack to Front */ |
| 8972 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8973 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8974 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8975 | |
| 8976 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8977 | |
| 8978 | { } /* end */ |
| 8979 | }; |
| 8980 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8981 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8982 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8983 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8984 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8985 | { } /* end */ |
| 8986 | }; |
| 8987 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8988 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8989 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8990 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8991 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8992 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8993 | { } /* end */ |
| 8994 | }; |
| 8995 | |
| 8996 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8998 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8999 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9000 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 9001 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9002 | { } /* end */ |
| 9003 | }; |
| 9004 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9005 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 9006 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9007 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9008 | |
| 9009 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9010 | |
| 9011 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9012 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9013 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9014 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9015 | { } /* end */ |
| 9016 | }; |
| 9017 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9018 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 9019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9022 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9023 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9024 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9025 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9026 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9027 | { } /* end */ |
| 9028 | }; |
| 9029 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9030 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 9031 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9032 | { } |
| 9033 | }; |
| 9034 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9035 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 9036 | /* HP */ |
| 9037 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9038 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9039 | |
| 9040 | /* enable unsolicited event */ |
| 9041 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9042 | |
| 9043 | { } /* end */ |
| 9044 | }; |
| 9045 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9046 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9047 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9048 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9049 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9050 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9051 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9052 | spec->autocfg.speaker_pins[1] = 0x16; |
| 9053 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 9054 | } |
| 9055 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9056 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9057 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 9058 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 9059 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9060 | {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] | 9061 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9062 | }; |
| 9063 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9064 | /* |
| 9065 | * 2ch mode |
| 9066 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9067 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9068 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9069 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9070 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 9071 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9072 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9073 | }; |
| 9074 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9075 | /* |
| 9076 | * 4ch mode |
| 9077 | */ |
| 9078 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 9079 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 9080 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 9081 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9082 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9083 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9084 | { } /* end */ |
| 9085 | }; |
| 9086 | |
| 9087 | /* |
| 9088 | * 6ch mode |
| 9089 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9090 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9091 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9092 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9093 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9094 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9095 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9096 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 9097 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9098 | }; |
| 9099 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9100 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9101 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 9102 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9103 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9104 | }; |
| 9105 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9106 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 9107 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 9108 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9109 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9110 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9111 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9112 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9113 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9114 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9115 | } |
| 9116 | |
| 9117 | /* toggle RCA according to the front-jack state */ |
| 9118 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 9119 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9120 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9121 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9122 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9123 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9124 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9125 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9126 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 9127 | unsigned int res) |
| 9128 | { |
| 9129 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9130 | alc888_lenovo_ms7195_front_automute(codec); |
| 9131 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9132 | alc888_lenovo_ms7195_rca_automute(codec); |
| 9133 | } |
| 9134 | |
| 9135 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 9136 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9137 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9138 | |
| 9139 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9140 | |
| 9141 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9142 | { } /* end */ |
| 9143 | }; |
| 9144 | |
| 9145 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9146 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9147 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9148 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9149 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9150 | spec->autocfg.hp_pins[0] = 0x14; |
| 9151 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9152 | } |
| 9153 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9154 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9155 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 9156 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9157 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9158 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 9159 | { |
| 9160 | unsigned int present; |
| 9161 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 9162 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9163 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 9164 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9165 | } |
| 9166 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9167 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9168 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9169 | struct alc_spec *spec = codec->spec; |
| 9170 | |
| 9171 | spec->autocfg.hp_pins[0] = 0x15; |
| 9172 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9173 | } |
| 9174 | |
| 9175 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 9176 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9177 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9178 | alc883_clevo_m720_mic_automute(codec); |
| 9179 | } |
| 9180 | |
| 9181 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9182 | unsigned int res) |
| 9183 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9184 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9185 | case ALC880_MIC_EVENT: |
| 9186 | alc883_clevo_m720_mic_automute(codec); |
| 9187 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9188 | default: |
| 9189 | alc_automute_amp_unsol_event(codec, res); |
| 9190 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9191 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9192 | } |
| 9193 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9194 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9195 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9196 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9197 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9198 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9199 | spec->autocfg.hp_pins[0] = 0x14; |
| 9200 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9201 | } |
| 9202 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9203 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9204 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9205 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9206 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9207 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9208 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9209 | } |
| 9210 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9211 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9212 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9213 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9214 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9215 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9216 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9217 | } |
| 9218 | |
| 9219 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9220 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9221 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9222 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9223 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9224 | HDA_AMP_MUTE, bits); |
| 9225 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9226 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9227 | } |
| 9228 | |
| 9229 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9230 | unsigned int res) |
| 9231 | { |
| 9232 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9233 | alc883_lenovo_101e_all_automute(codec); |
| 9234 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9235 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9236 | } |
| 9237 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9238 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9239 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9240 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9241 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9242 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9243 | spec->autocfg.hp_pins[0] = 0x14; |
| 9244 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9245 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9246 | } |
| 9247 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9248 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9249 | /* HP Pin: output 0 (0x0c) */ |
| 9250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9251 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9252 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9253 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9255 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9256 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9257 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9258 | /* eanable EAPD on medion laptop */ |
| 9259 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9260 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9261 | /* enable unsolicited event */ |
| 9262 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9263 | { } |
| 9264 | }; |
| 9265 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9266 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9267 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9268 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9269 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9270 | { } /* end */ |
| 9271 | }; |
| 9272 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9273 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9274 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9275 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9276 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9277 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9278 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9279 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9280 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9281 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9282 | } |
| 9283 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9284 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9285 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9286 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9287 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9288 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9289 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9290 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9291 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9292 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9293 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9294 | } |
| 9295 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9296 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9297 | { |
| 9298 | struct alc_spec *spec = codec->spec; |
| 9299 | |
| 9300 | spec->autocfg.hp_pins[0] = 0x15; |
| 9301 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9302 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9303 | } |
| 9304 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9305 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9306 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9307 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9308 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9309 | /* enable unsolicited event */ |
| 9310 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9311 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9312 | { } /* end */ |
| 9313 | }; |
| 9314 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9315 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9316 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9317 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9318 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9319 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9320 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9321 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9322 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9323 | spec->ext_mic.pin = 0x18; |
| 9324 | spec->int_mic.pin = 0x19; |
| 9325 | spec->ext_mic.mux_idx = 0; |
| 9326 | spec->int_mic.mux_idx = 1; |
| 9327 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9328 | } |
| 9329 | |
| 9330 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9331 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9332 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9334 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9335 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9336 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9337 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9338 | /* enable unsolicited event */ |
| 9339 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9340 | { } /* end */ |
| 9341 | }; |
| 9342 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9343 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9344 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9345 | struct alc_spec *spec = codec->spec; |
| 9346 | |
| 9347 | spec->autocfg.hp_pins[0] = 0x14; |
| 9348 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9349 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9350 | } |
| 9351 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9352 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9353 | /* Init rear pin (used as headphone output) */ |
| 9354 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9357 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9358 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9359 | /* Init line 2 pin (used as headphone out by default) */ |
| 9360 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9361 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9362 | { } /* end */ |
| 9363 | }; |
| 9364 | |
| 9365 | /* Mute speakers according to the headphone jack state */ |
| 9366 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9367 | { |
| 9368 | unsigned int present; |
| 9369 | |
| 9370 | /* Mute only in 2ch or 4ch mode */ |
| 9371 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9372 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9373 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9374 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9375 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9376 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9377 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9378 | } |
| 9379 | } |
| 9380 | |
| 9381 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9382 | { |
| 9383 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9384 | alc889A_mb31_automute(codec); |
| 9385 | } |
| 9386 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9387 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9388 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9389 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9390 | #endif |
| 9391 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9392 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9393 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9394 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9395 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9396 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9397 | |
| 9398 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9399 | ALC1200_DIGOUT_NID, 0, |
| 9400 | }; |
| 9401 | |
| 9402 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9403 | ALC883_DIGOUT_NID, 0, |
| 9404 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9405 | |
| 9406 | /* |
| 9407 | * configuration and preset |
| 9408 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9409 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9410 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9411 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9412 | [ALC882_ARIMA] = "arima", |
| 9413 | [ALC882_W2JC] = "w2jc", |
| 9414 | [ALC882_TARGA] = "targa", |
| 9415 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9416 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9417 | [ALC885_MACPRO] = "macpro", |
| 9418 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9419 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9420 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9421 | [ALC885_MBP3] = "mbp3", |
| 9422 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9423 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9424 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9425 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9426 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9427 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9428 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9429 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9430 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9431 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9432 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9433 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9434 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9435 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9436 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9437 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9438 | [ALC883_MEDION_MD2] = "medion-md2", |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 9439 | [ALC883_MEDION_WIM2160] = "medion-wim2160", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9440 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9441 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9442 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9443 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9444 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9445 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9446 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9447 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9448 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9449 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9450 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9451 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9452 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9453 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9454 | [ALC889A_INTEL] = "intel-alc889a", |
| 9455 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9456 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9457 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9458 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9459 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9460 | }; |
| 9461 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9462 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9463 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9464 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9465 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9466 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9467 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9468 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9469 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9470 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9471 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9472 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9473 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9474 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9475 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9476 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9477 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9478 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9479 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9480 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9481 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9482 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9483 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9484 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9485 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9486 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9487 | /* default Acer -- disabled as it causes more problems. |
| 9488 | * model=auto should work fine now |
| 9489 | */ |
| 9490 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9491 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9492 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9493 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9494 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9495 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9496 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9497 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9498 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9499 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9500 | |
| 9501 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9502 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9503 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9504 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9506 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9507 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9508 | 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] | 9509 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9510 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9512 | |
| 9513 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9514 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9515 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9516 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9517 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9518 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9519 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9520 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9521 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9522 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9523 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9524 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9525 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9527 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9528 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9529 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9530 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9531 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9532 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9533 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9534 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9535 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9536 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9537 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9538 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9539 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9540 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9541 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9542 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9543 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9544 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9545 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9546 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9547 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9548 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9549 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9550 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9551 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9552 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9553 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9554 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9555 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Joerg Schirottke | d1501ea | 2010-04-15 08:37:41 +0200 | [diff] [blame] | 9556 | 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] | 9557 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9558 | 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] | 9559 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9560 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9561 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9562 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9563 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9564 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9565 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9566 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9567 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9568 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9569 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9570 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9571 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9572 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9573 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9574 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9575 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9576 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9577 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9578 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9579 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9580 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9581 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9582 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9583 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9584 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9585 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9586 | {} |
| 9587 | }; |
| 9588 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9589 | /* codec SSID table for Intel Mac */ |
| 9590 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9591 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9592 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9593 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9594 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9595 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9596 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9597 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
Daniel T Chen | 26fd74f | 2010-05-30 09:55:23 -0400 | [diff] [blame] | 9598 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), |
Justin P. Mattock | ab66996 | 2010-06-06 16:09:53 -0700 | [diff] [blame] | 9599 | 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] | 9600 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), |
Justin P. Mattock | 6e12970 | 2010-06-06 16:09:49 -0700 | [diff] [blame] | 9601 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9602 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9603 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9604 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9605 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9606 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Luke Yelavich | 3bfea98 | 2010-06-22 11:04:19 +1000 | [diff] [blame] | 9607 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9608 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9609 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9610 | */ |
| 9611 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9612 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9613 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9614 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9615 | }; |
| 9616 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9617 | static struct alc_config_preset alc882_presets[] = { |
| 9618 | [ALC882_3ST_DIG] = { |
| 9619 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9620 | .init_verbs = { alc882_base_init_verbs, |
| 9621 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9622 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9623 | .dac_nids = alc882_dac_nids, |
| 9624 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9625 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9626 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9627 | .channel_mode = alc882_ch_modes, |
| 9628 | .need_dac_fix = 1, |
| 9629 | .input_mux = &alc882_capture_source, |
| 9630 | }, |
| 9631 | [ALC882_6ST_DIG] = { |
| 9632 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9633 | .init_verbs = { alc882_base_init_verbs, |
| 9634 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9635 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9636 | .dac_nids = alc882_dac_nids, |
| 9637 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9638 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9639 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9640 | .channel_mode = alc882_sixstack_modes, |
| 9641 | .input_mux = &alc882_capture_source, |
| 9642 | }, |
| 9643 | [ALC882_ARIMA] = { |
| 9644 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9645 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9646 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9647 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9648 | .dac_nids = alc882_dac_nids, |
| 9649 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9650 | .channel_mode = alc882_sixstack_modes, |
| 9651 | .input_mux = &alc882_capture_source, |
| 9652 | }, |
| 9653 | [ALC882_W2JC] = { |
| 9654 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9655 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9656 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9657 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9658 | .dac_nids = alc882_dac_nids, |
| 9659 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9660 | .channel_mode = alc880_threestack_modes, |
| 9661 | .need_dac_fix = 1, |
| 9662 | .input_mux = &alc882_capture_source, |
| 9663 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9664 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9665 | [ALC885_MBA21] = { |
| 9666 | .mixers = { alc885_mba21_mixer }, |
| 9667 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9668 | .num_dacs = 2, |
| 9669 | .dac_nids = alc882_dac_nids, |
| 9670 | .channel_mode = alc885_mba21_ch_modes, |
| 9671 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9672 | .input_mux = &alc882_capture_source, |
| 9673 | .unsol_event = alc_automute_amp_unsol_event, |
| 9674 | .setup = alc885_mba21_setup, |
| 9675 | .init_hook = alc_automute_amp, |
| 9676 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9677 | [ALC885_MBP3] = { |
| 9678 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9679 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9680 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9681 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9682 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9683 | .hp_nid = 0x04, |
| 9684 | .channel_mode = alc885_mbp_4ch_modes, |
| 9685 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9686 | .input_mux = &alc882_capture_source, |
| 9687 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9688 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9689 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9690 | .setup = alc885_mbp3_setup, |
| 9691 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9692 | }, |
| 9693 | [ALC885_MB5] = { |
| 9694 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9695 | .init_verbs = { alc885_mb5_init_verbs, |
| 9696 | alc880_gpio1_init_verbs }, |
| 9697 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9698 | .dac_nids = alc882_dac_nids, |
| 9699 | .channel_mode = alc885_mb5_6ch_modes, |
| 9700 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9701 | .input_mux = &mb5_capture_source, |
| 9702 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9703 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9704 | .unsol_event = alc_automute_amp_unsol_event, |
| 9705 | .setup = alc885_mb5_setup, |
| 9706 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9707 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9708 | [ALC885_MACMINI3] = { |
| 9709 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9710 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9711 | alc880_gpio1_init_verbs }, |
| 9712 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9713 | .dac_nids = alc882_dac_nids, |
| 9714 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9715 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9716 | .input_mux = &macmini3_capture_source, |
| 9717 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9718 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9719 | .unsol_event = alc_automute_amp_unsol_event, |
| 9720 | .setup = alc885_macmini3_setup, |
| 9721 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9722 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9723 | [ALC885_MACPRO] = { |
| 9724 | .mixers = { alc882_macpro_mixer }, |
| 9725 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9726 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9727 | .dac_nids = alc882_dac_nids, |
| 9728 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9729 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9730 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9731 | .channel_mode = alc882_ch_modes, |
| 9732 | .input_mux = &alc882_capture_source, |
| 9733 | .init_hook = alc885_macpro_init_hook, |
| 9734 | }, |
| 9735 | [ALC885_IMAC24] = { |
| 9736 | .mixers = { alc885_imac24_mixer }, |
| 9737 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9738 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9739 | .dac_nids = alc882_dac_nids, |
| 9740 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9741 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9742 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9743 | .channel_mode = alc882_ch_modes, |
| 9744 | .input_mux = &alc882_capture_source, |
| 9745 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9746 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9747 | .init_hook = alc885_imac24_init_hook, |
| 9748 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9749 | [ALC885_IMAC91] = { |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9750 | .mixers = {alc885_imac91_mixer}, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9751 | .init_verbs = { alc885_imac91_init_verbs, |
| 9752 | alc880_gpio1_init_verbs }, |
| 9753 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9754 | .dac_nids = alc882_dac_nids, |
Justin P. Mattock | b7cccc5 | 2010-05-23 10:55:00 -0700 | [diff] [blame] | 9755 | .channel_mode = alc885_mba21_ch_modes, |
| 9756 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9757 | .input_mux = &alc889A_imac91_capture_source, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9758 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9759 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9760 | .unsol_event = alc_automute_amp_unsol_event, |
| 9761 | .setup = alc885_imac91_setup, |
| 9762 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9763 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9764 | [ALC882_TARGA] = { |
| 9765 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9766 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9767 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9768 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9769 | .dac_nids = alc882_dac_nids, |
| 9770 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9771 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9772 | .adc_nids = alc882_adc_nids, |
| 9773 | .capsrc_nids = alc882_capsrc_nids, |
| 9774 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9775 | .channel_mode = alc882_3ST_6ch_modes, |
| 9776 | .need_dac_fix = 1, |
| 9777 | .input_mux = &alc882_capture_source, |
| 9778 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9779 | .setup = alc882_targa_setup, |
| 9780 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9781 | }, |
| 9782 | [ALC882_ASUS_A7J] = { |
| 9783 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9784 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9785 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9786 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9787 | .dac_nids = alc882_dac_nids, |
| 9788 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9789 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9790 | .adc_nids = alc882_adc_nids, |
| 9791 | .capsrc_nids = alc882_capsrc_nids, |
| 9792 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9793 | .channel_mode = alc882_3ST_6ch_modes, |
| 9794 | .need_dac_fix = 1, |
| 9795 | .input_mux = &alc882_capture_source, |
| 9796 | }, |
| 9797 | [ALC882_ASUS_A7M] = { |
| 9798 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9799 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9800 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9801 | alc882_asus_a7m_verbs }, |
| 9802 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9803 | .dac_nids = alc882_dac_nids, |
| 9804 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9805 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9806 | .channel_mode = alc880_threestack_modes, |
| 9807 | .need_dac_fix = 1, |
| 9808 | .input_mux = &alc882_capture_source, |
| 9809 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9810 | [ALC883_3ST_2ch_DIG] = { |
| 9811 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9812 | .init_verbs = { alc883_init_verbs }, |
| 9813 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9814 | .dac_nids = alc883_dac_nids, |
| 9815 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9816 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9817 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9818 | .channel_mode = alc883_3ST_2ch_modes, |
| 9819 | .input_mux = &alc883_capture_source, |
| 9820 | }, |
| 9821 | [ALC883_3ST_6ch_DIG] = { |
| 9822 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9823 | .init_verbs = { alc883_init_verbs }, |
| 9824 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9825 | .dac_nids = alc883_dac_nids, |
| 9826 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9827 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9828 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9829 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9830 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9831 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9832 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9833 | [ALC883_3ST_6ch] = { |
| 9834 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9835 | .init_verbs = { alc883_init_verbs }, |
| 9836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9837 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9838 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9839 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9840 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9841 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9842 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9843 | [ALC883_3ST_6ch_INTEL] = { |
| 9844 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9845 | .init_verbs = { alc883_init_verbs }, |
| 9846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9847 | .dac_nids = alc883_dac_nids, |
| 9848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9849 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9850 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9851 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9852 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9853 | .need_dac_fix = 1, |
| 9854 | .input_mux = &alc883_3stack_6ch_intel, |
| 9855 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9856 | [ALC889A_INTEL] = { |
| 9857 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9858 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9859 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9860 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9861 | .dac_nids = alc883_dac_nids, |
| 9862 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9863 | .adc_nids = alc889_adc_nids, |
| 9864 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9865 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9866 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9867 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9868 | .channel_mode = alc889_8ch_intel_modes, |
| 9869 | .capsrc_nids = alc889_capsrc_nids, |
| 9870 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9871 | .setup = alc889_automute_setup, |
| 9872 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9873 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9874 | .need_dac_fix = 1, |
| 9875 | }, |
| 9876 | [ALC889_INTEL] = { |
| 9877 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9878 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9879 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9880 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9881 | .dac_nids = alc883_dac_nids, |
| 9882 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9883 | .adc_nids = alc889_adc_nids, |
| 9884 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9885 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9886 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9887 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9888 | .channel_mode = alc889_8ch_intel_modes, |
| 9889 | .capsrc_nids = alc889_capsrc_nids, |
| 9890 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9891 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9892 | .init_hook = alc889_intel_init_hook, |
| 9893 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9894 | .need_dac_fix = 1, |
| 9895 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9896 | [ALC883_6ST_DIG] = { |
| 9897 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9898 | .init_verbs = { alc883_init_verbs }, |
| 9899 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9900 | .dac_nids = alc883_dac_nids, |
| 9901 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9902 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9903 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9904 | .channel_mode = alc883_sixstack_modes, |
| 9905 | .input_mux = &alc883_capture_source, |
| 9906 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9907 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9908 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9909 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9910 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9911 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9912 | .dac_nids = alc883_dac_nids, |
| 9913 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9914 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9915 | .channel_mode = alc883_3ST_6ch_modes, |
| 9916 | .need_dac_fix = 1, |
| 9917 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9918 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9919 | .setup = alc882_targa_setup, |
| 9920 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9921 | }, |
| 9922 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9923 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9924 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9925 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9926 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9927 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9928 | .adc_nids = alc883_adc_nids_alt, |
| 9929 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9930 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9931 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9932 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9933 | .channel_mode = alc883_3ST_2ch_modes, |
| 9934 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9935 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9936 | .setup = alc882_targa_setup, |
| 9937 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9938 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9939 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9940 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9941 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9942 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9943 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9944 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9945 | .dac_nids = alc883_dac_nids, |
| 9946 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9947 | .adc_nids = alc883_adc_nids_rev, |
| 9948 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9949 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9950 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9951 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9952 | .channel_mode = alc883_4ST_8ch_modes, |
| 9953 | .need_dac_fix = 1, |
| 9954 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9955 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9956 | .setup = alc882_targa_setup, |
| 9957 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9958 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9959 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9960 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9961 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9962 | * and the headphone jack. Turn this on and rely on the |
| 9963 | * standard mute methods whenever the user wants to turn |
| 9964 | * these outputs off. |
| 9965 | */ |
| 9966 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9967 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9968 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9969 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9970 | .channel_mode = alc883_3ST_2ch_modes, |
| 9971 | .input_mux = &alc883_capture_source, |
| 9972 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9973 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9974 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9975 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9976 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9977 | .dac_nids = alc883_dac_nids, |
| 9978 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9979 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9980 | .channel_mode = alc883_3ST_2ch_modes, |
| 9981 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9982 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9983 | .setup = alc883_acer_aspire_setup, |
| 9984 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9985 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9986 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9987 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9988 | alc883_chmode_mixer }, |
| 9989 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9990 | alc888_acer_aspire_4930g_verbs }, |
| 9991 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9992 | .dac_nids = alc883_dac_nids, |
| 9993 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9994 | .adc_nids = alc883_adc_nids_rev, |
| 9995 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9996 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9997 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9998 | .channel_mode = alc883_3ST_6ch_modes, |
| 9999 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 10000 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10001 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10002 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10003 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10004 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10005 | .setup = alc888_acer_aspire_4930g_setup, |
| 10006 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 10007 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10008 | [ALC888_ACER_ASPIRE_6530G] = { |
| 10009 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 10010 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10011 | alc888_acer_aspire_6530g_verbs }, |
| 10012 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10013 | .dac_nids = alc883_dac_nids, |
| 10014 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10015 | .adc_nids = alc883_adc_nids_rev, |
| 10016 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10017 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10018 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10019 | .channel_mode = alc883_3ST_2ch_modes, |
| 10020 | .num_mux_defs = |
| 10021 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10022 | .input_mux = alc888_acer_aspire_6530_sources, |
| 10023 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10024 | .setup = alc888_acer_aspire_6530g_setup, |
| 10025 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 10026 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10027 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 10028 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10029 | alc883_chmode_mixer }, |
| 10030 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 10031 | alc889_acer_aspire_8930g_verbs, |
| 10032 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10033 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10034 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10035 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 10036 | .adc_nids = alc889_adc_nids, |
| 10037 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10038 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10039 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10040 | .channel_mode = alc883_3ST_6ch_modes, |
| 10041 | .need_dac_fix = 1, |
| 10042 | .const_channel_count = 6, |
| 10043 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 10044 | ARRAY_SIZE(alc889_capture_sources), |
| 10045 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10046 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10047 | .setup = alc889_acer_aspire_8930g_setup, |
| 10048 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10049 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 10050 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 10051 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 10052 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 10053 | [ALC888_ACER_ASPIRE_7730G] = { |
| 10054 | .mixers = { alc883_3ST_6ch_mixer, |
| 10055 | alc883_chmode_mixer }, |
| 10056 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 10057 | alc888_acer_aspire_7730G_verbs }, |
| 10058 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10059 | .dac_nids = alc883_dac_nids, |
| 10060 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10061 | .adc_nids = alc883_adc_nids_rev, |
| 10062 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10063 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10064 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10065 | .channel_mode = alc883_3ST_6ch_modes, |
| 10066 | .need_dac_fix = 1, |
| 10067 | .const_channel_count = 6, |
| 10068 | .input_mux = &alc883_capture_source, |
| 10069 | .unsol_event = alc_automute_amp_unsol_event, |
| 10070 | .setup = alc888_acer_aspire_6530g_setup, |
| 10071 | .init_hook = alc_automute_amp, |
| 10072 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10073 | [ALC883_MEDION] = { |
| 10074 | .mixers = { alc883_fivestack_mixer, |
| 10075 | alc883_chmode_mixer }, |
| 10076 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10077 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10078 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10079 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10080 | .adc_nids = alc883_adc_nids_alt, |
| 10081 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10082 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 10083 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10084 | .channel_mode = alc883_sixstack_modes, |
| 10085 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10086 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10087 | [ALC883_MEDION_MD2] = { |
| 10088 | .mixers = { alc883_medion_md2_mixer}, |
| 10089 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 10090 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10091 | .dac_nids = alc883_dac_nids, |
| 10092 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10093 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10094 | .channel_mode = alc883_3ST_2ch_modes, |
| 10095 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10096 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10097 | .setup = alc883_medion_md2_setup, |
| 10098 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10099 | }, |
Maurus Cuelenaere | 7ad7b21 | 2010-04-06 18:12:52 +0200 | [diff] [blame] | 10100 | [ALC883_MEDION_WIM2160] = { |
| 10101 | .mixers = { alc883_medion_wim2160_mixer }, |
| 10102 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, |
| 10103 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10104 | .dac_nids = alc883_dac_nids, |
| 10105 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10106 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 10107 | .adc_nids = alc883_adc_nids, |
| 10108 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10109 | .channel_mode = alc883_3ST_2ch_modes, |
| 10110 | .input_mux = &alc883_capture_source, |
| 10111 | .unsol_event = alc_automute_amp_unsol_event, |
| 10112 | .setup = alc883_medion_wim2160_setup, |
| 10113 | .init_hook = alc_automute_amp, |
| 10114 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10115 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 10116 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10117 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 10118 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10119 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 10120 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10121 | .channel_mode = alc883_3ST_2ch_modes, |
| 10122 | .input_mux = &alc883_capture_source, |
| 10123 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 10124 | [ALC883_CLEVO_M540R] = { |
| 10125 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10126 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 10127 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10128 | .dac_nids = alc883_dac_nids, |
| 10129 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10130 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10131 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 10132 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 10133 | .need_dac_fix = 1, |
| 10134 | .input_mux = &alc883_capture_source, |
| 10135 | /* This machine has the hardware HP auto-muting, thus |
| 10136 | * we need no software mute via unsol event |
| 10137 | */ |
| 10138 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10139 | [ALC883_CLEVO_M720] = { |
| 10140 | .mixers = { alc883_clevo_m720_mixer }, |
| 10141 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10142 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10143 | .dac_nids = alc883_dac_nids, |
| 10144 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10145 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10146 | .channel_mode = alc883_3ST_2ch_modes, |
| 10147 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 10148 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10149 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10150 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 10151 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10152 | [ALC883_LENOVO_101E_2ch] = { |
| 10153 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 10154 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 10155 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10156 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10157 | .adc_nids = alc883_adc_nids_alt, |
| 10158 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10159 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 10160 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10161 | .channel_mode = alc883_3ST_2ch_modes, |
| 10162 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 10163 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 10164 | .init_hook = alc883_lenovo_101e_all_automute, |
| 10165 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10166 | [ALC883_LENOVO_NB0763] = { |
| 10167 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 10168 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 10169 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10170 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10171 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10172 | .channel_mode = alc883_3ST_2ch_modes, |
| 10173 | .need_dac_fix = 1, |
| 10174 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10175 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10176 | .setup = alc883_medion_md2_setup, |
| 10177 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10178 | }, |
| 10179 | [ALC888_LENOVO_MS7195_DIG] = { |
| 10180 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10181 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 10182 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10183 | .dac_nids = alc883_dac_nids, |
| 10184 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10185 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10186 | .channel_mode = alc883_3ST_6ch_modes, |
| 10187 | .need_dac_fix = 1, |
| 10188 | .input_mux = &alc883_capture_source, |
| 10189 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 10190 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10191 | }, |
| 10192 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 10193 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10194 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 10195 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10196 | .dac_nids = alc883_dac_nids, |
| 10197 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 10198 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10199 | .channel_mode = alc883_3ST_2ch_modes, |
| 10200 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10201 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10202 | .setup = alc883_haier_w66_setup, |
| 10203 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10204 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10205 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 10206 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10207 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10208 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10209 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 10210 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10211 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10212 | .need_dac_fix = 1, |
| 10213 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10214 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10215 | .setup = alc888_3st_hp_setup, |
| 10216 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10217 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10218 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10219 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10220 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10221 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10222 | .dac_nids = alc883_dac_nids, |
| 10223 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10224 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10225 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10226 | .channel_mode = alc883_sixstack_modes, |
| 10227 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10228 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10229 | .setup = alc888_6st_dell_setup, |
| 10230 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10231 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10232 | [ALC883_MITAC] = { |
| 10233 | .mixers = { alc883_mitac_mixer }, |
| 10234 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10235 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10236 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10237 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10238 | .channel_mode = alc883_3ST_2ch_modes, |
| 10239 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10240 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10241 | .setup = alc883_mitac_setup, |
| 10242 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10243 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10244 | [ALC883_FUJITSU_PI2515] = { |
| 10245 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10246 | .init_verbs = { alc883_init_verbs, |
| 10247 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10248 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10249 | .dac_nids = alc883_dac_nids, |
| 10250 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10251 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10252 | .channel_mode = alc883_3ST_2ch_modes, |
| 10253 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10254 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10255 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10256 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10257 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10258 | [ALC888_FUJITSU_XA3530] = { |
| 10259 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10260 | .init_verbs = { alc883_init_verbs, |
| 10261 | alc888_fujitsu_xa3530_verbs }, |
| 10262 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10263 | .dac_nids = alc883_dac_nids, |
| 10264 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10265 | .adc_nids = alc883_adc_nids_rev, |
| 10266 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10267 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10268 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10269 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10270 | .num_mux_defs = |
| 10271 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10272 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10273 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10274 | .setup = alc888_fujitsu_xa3530_setup, |
| 10275 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10276 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10277 | [ALC888_LENOVO_SKY] = { |
| 10278 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10279 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10280 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10281 | .dac_nids = alc883_dac_nids, |
| 10282 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10283 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10284 | .channel_mode = alc883_sixstack_modes, |
| 10285 | .need_dac_fix = 1, |
| 10286 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10287 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10288 | .setup = alc888_lenovo_sky_setup, |
| 10289 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10290 | }, |
| 10291 | [ALC888_ASUS_M90V] = { |
| 10292 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10293 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10294 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10295 | .dac_nids = alc883_dac_nids, |
| 10296 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10297 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10298 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10299 | .channel_mode = alc883_3ST_6ch_modes, |
| 10300 | .need_dac_fix = 1, |
| 10301 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10302 | .unsol_event = alc_sku_unsol_event, |
| 10303 | .setup = alc883_mode2_setup, |
| 10304 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10305 | }, |
| 10306 | [ALC888_ASUS_EEE1601] = { |
| 10307 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10308 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10309 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10310 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10311 | .dac_nids = alc883_dac_nids, |
| 10312 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10313 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10314 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10315 | .channel_mode = alc883_3ST_2ch_modes, |
| 10316 | .need_dac_fix = 1, |
| 10317 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10318 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10319 | .init_hook = alc883_eee1601_inithook, |
| 10320 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10321 | [ALC1200_ASUS_P5Q] = { |
| 10322 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10323 | .init_verbs = { alc883_init_verbs }, |
| 10324 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10325 | .dac_nids = alc883_dac_nids, |
| 10326 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10327 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10328 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10329 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10330 | .channel_mode = alc883_sixstack_modes, |
| 10331 | .input_mux = &alc883_capture_source, |
| 10332 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10333 | [ALC889A_MB31] = { |
| 10334 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10335 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10336 | alc880_gpio1_init_verbs }, |
| 10337 | .adc_nids = alc883_adc_nids, |
| 10338 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10339 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10340 | .dac_nids = alc883_dac_nids, |
| 10341 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10342 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10343 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10344 | .input_mux = &alc889A_mb31_capture_source, |
| 10345 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10346 | .unsol_event = alc889A_mb31_unsol_event, |
| 10347 | .init_hook = alc889A_mb31_automute, |
| 10348 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10349 | [ALC883_SONY_VAIO_TT] = { |
| 10350 | .mixers = { alc883_vaiott_mixer }, |
| 10351 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10352 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10353 | .dac_nids = alc883_dac_nids, |
| 10354 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10355 | .channel_mode = alc883_3ST_2ch_modes, |
| 10356 | .input_mux = &alc883_capture_source, |
| 10357 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10358 | .setup = alc883_vaiott_setup, |
| 10359 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10360 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10361 | }; |
| 10362 | |
| 10363 | |
| 10364 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10365 | * Pin config fixes |
| 10366 | */ |
| 10367 | enum { |
| 10368 | PINFIX_ABIT_AW9D_MAX |
| 10369 | }; |
| 10370 | |
| 10371 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10372 | { 0x15, 0x01080104 }, /* side */ |
| 10373 | { 0x16, 0x01011012 }, /* rear */ |
| 10374 | { 0x17, 0x01016011 }, /* clfe */ |
| 10375 | { } |
| 10376 | }; |
| 10377 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10378 | static const struct alc_fixup alc882_fixups[] = { |
| 10379 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10380 | .pins = alc882_abit_aw9d_pinfix |
| 10381 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10382 | }; |
| 10383 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10384 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10385 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10386 | {} |
| 10387 | }; |
| 10388 | |
| 10389 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10390 | * BIOS auto configuration |
| 10391 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10392 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10393 | const struct auto_pin_cfg *cfg) |
| 10394 | { |
| 10395 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10396 | } |
| 10397 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10398 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10399 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10400 | hda_nid_t dac) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10401 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10402 | int idx; |
| 10403 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10404 | /* set as output */ |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10405 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10406 | |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10407 | if (dac == 0x25) |
| 10408 | idx = 4; |
| 10409 | else if (dac >= 0x02 && dac <= 0x05) |
| 10410 | idx = dac - 2; |
| 10411 | else |
| 10412 | return; |
| 10413 | 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] | 10414 | } |
| 10415 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10416 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10417 | { |
| 10418 | struct alc_spec *spec = codec->spec; |
| 10419 | int i; |
| 10420 | |
| 10421 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10422 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10423 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10424 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10425 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10426 | spec->multiout.dac_nids[i]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10427 | } |
| 10428 | } |
| 10429 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10430 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10431 | { |
| 10432 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10433 | hda_nid_t pin, dac; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10434 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10435 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10436 | if (pin) { |
| 10437 | dac = spec->multiout.hp_nid; |
| 10438 | if (!dac) |
| 10439 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10440 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); |
| 10441 | } |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10442 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10443 | if (pin) { |
| 10444 | dac = spec->multiout.extra_out_nid[0]; |
| 10445 | if (!dac) |
| 10446 | dac = spec->multiout.dac_nids[0]; /* to front */ |
| 10447 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); |
| 10448 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10449 | } |
| 10450 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10451 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10452 | { |
| 10453 | struct alc_spec *spec = codec->spec; |
| 10454 | int i; |
| 10455 | |
| 10456 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10457 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10458 | if (!nid) |
| 10459 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10460 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10461 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10462 | snd_hda_codec_write(codec, nid, 0, |
| 10463 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10464 | AMP_OUT_MUTE); |
| 10465 | } |
| 10466 | } |
| 10467 | |
| 10468 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10469 | { |
| 10470 | struct alc_spec *spec = codec->spec; |
| 10471 | int c; |
| 10472 | |
| 10473 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10474 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10475 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10476 | unsigned int mux_idx; |
| 10477 | const struct hda_input_mux *imux; |
| 10478 | int conns, mute, idx, item; |
| 10479 | |
| 10480 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10481 | ARRAY_SIZE(conn_list)); |
| 10482 | if (conns < 0) |
| 10483 | continue; |
| 10484 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10485 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10486 | if (!imux->num_items && mux_idx > 0) |
| 10487 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10488 | for (idx = 0; idx < conns; idx++) { |
| 10489 | /* if the current connection is the selected one, |
| 10490 | * unmute it as default - otherwise mute it |
| 10491 | */ |
| 10492 | mute = AMP_IN_MUTE(idx); |
| 10493 | for (item = 0; item < imux->num_items; item++) { |
| 10494 | if (imux->items[item].index == idx) { |
| 10495 | if (spec->cur_mux[c] == item) |
| 10496 | mute = AMP_IN_UNMUTE(idx); |
| 10497 | break; |
| 10498 | } |
| 10499 | } |
| 10500 | /* check if we have a selector or mixer |
| 10501 | * we could check for the widget type instead, but |
| 10502 | * just check for Amp-In presence (in case of mixer |
| 10503 | * without amp-in there is something wrong, this |
| 10504 | * function shouldn't be used or capsrc nid is wrong) |
| 10505 | */ |
| 10506 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10507 | snd_hda_codec_write(codec, nid, 0, |
| 10508 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10509 | mute); |
| 10510 | else if (mute != AMP_IN_MUTE(idx)) |
| 10511 | snd_hda_codec_write(codec, nid, 0, |
| 10512 | AC_VERB_SET_CONNECT_SEL, |
| 10513 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10514 | } |
| 10515 | } |
| 10516 | } |
| 10517 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10518 | /* add mic boosts if needed */ |
| 10519 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10520 | { |
| 10521 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10522 | int err; |
| 10523 | hda_nid_t nid; |
| 10524 | |
| 10525 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10526 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10527 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10528 | "Mic Boost", |
| 10529 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10530 | if (err < 0) |
| 10531 | return err; |
| 10532 | } |
| 10533 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10534 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10535 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10536 | "Front Mic Boost", |
| 10537 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10538 | if (err < 0) |
| 10539 | return err; |
| 10540 | } |
| 10541 | return 0; |
| 10542 | } |
| 10543 | |
| 10544 | /* almost identical with ALC880 parser... */ |
| 10545 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10546 | { |
| 10547 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10548 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10549 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10550 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10551 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10552 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10553 | if (err < 0) |
| 10554 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10555 | if (!spec->autocfg.line_outs) |
| 10556 | return 0; /* can't find valid BIOS pin config */ |
| 10557 | |
| 10558 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10559 | if (err < 0) |
| 10560 | return err; |
| 10561 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10562 | if (err < 0) |
| 10563 | return err; |
Takashi Iwai | 489008c | 2010-04-07 09:06:00 +0200 | [diff] [blame] | 10564 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10565 | "Headphone"); |
| 10566 | if (err < 0) |
| 10567 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10568 | err = alc880_auto_create_extra_out(spec, |
| 10569 | spec->autocfg.speaker_pins[0], |
| 10570 | "Speaker"); |
| 10571 | if (err < 0) |
| 10572 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10573 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10574 | if (err < 0) |
| 10575 | return err; |
| 10576 | |
| 10577 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10578 | |
| 10579 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10580 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10581 | hda_nid_t dig_nid; |
| 10582 | err = snd_hda_get_connections(codec, |
| 10583 | spec->autocfg.dig_out_pins[i], |
| 10584 | &dig_nid, 1); |
| 10585 | if (err < 0) |
| 10586 | continue; |
| 10587 | if (!i) |
| 10588 | spec->multiout.dig_out_nid = dig_nid; |
| 10589 | else { |
| 10590 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10591 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10592 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10593 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10594 | } |
| 10595 | } |
| 10596 | if (spec->autocfg.dig_in_pin) |
| 10597 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10598 | |
| 10599 | if (spec->kctls.list) |
| 10600 | add_mixer(spec, spec->kctls.list); |
| 10601 | |
| 10602 | add_verb(spec, alc883_auto_init_verbs); |
| 10603 | /* if ADC 0x07 is available, initialize it, too */ |
| 10604 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10605 | add_verb(spec, alc882_adc1_init_verbs); |
| 10606 | |
| 10607 | spec->num_mux_defs = 1; |
| 10608 | spec->input_mux = &spec->private_imux[0]; |
| 10609 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10610 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10611 | |
| 10612 | err = alc_auto_add_mic_boost(codec); |
| 10613 | if (err < 0) |
| 10614 | return err; |
| 10615 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10616 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10617 | } |
| 10618 | |
| 10619 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10620 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10621 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10622 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10623 | alc882_auto_init_multi_out(codec); |
| 10624 | alc882_auto_init_hp_out(codec); |
| 10625 | alc882_auto_init_analog_input(codec); |
| 10626 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10627 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10628 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10629 | } |
| 10630 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10631 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10632 | { |
| 10633 | struct alc_spec *spec; |
| 10634 | int err, board_config; |
| 10635 | |
| 10636 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10637 | if (spec == NULL) |
| 10638 | return -ENOMEM; |
| 10639 | |
| 10640 | codec->spec = spec; |
| 10641 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10642 | alc_auto_parse_customize_define(codec); |
| 10643 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10644 | switch (codec->vendor_id) { |
| 10645 | case 0x10ec0882: |
| 10646 | case 0x10ec0885: |
| 10647 | break; |
| 10648 | default: |
| 10649 | /* ALC883 and variants */ |
| 10650 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10651 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10652 | } |
| 10653 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10654 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10655 | alc882_models, |
| 10656 | alc882_cfg_tbl); |
| 10657 | |
| 10658 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10659 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10660 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10661 | |
| 10662 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10663 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10664 | codec->chip_name); |
| 10665 | board_config = ALC882_AUTO; |
| 10666 | } |
| 10667 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10668 | if (board_config == ALC882_AUTO) |
| 10669 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10670 | |
| 10671 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10672 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10673 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10674 | if (err < 0) { |
| 10675 | alc_free(codec); |
| 10676 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10677 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10678 | printk(KERN_INFO |
| 10679 | "hda_codec: Cannot set up configuration " |
| 10680 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10681 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10682 | } |
| 10683 | } |
| 10684 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10685 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 10686 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10687 | if (err < 0) { |
| 10688 | alc_free(codec); |
| 10689 | return err; |
| 10690 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10691 | } |
| 10692 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10693 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10694 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10695 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10696 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10697 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10698 | /* FIXME: setup DAC5 */ |
| 10699 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10700 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10701 | |
| 10702 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10703 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10704 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10705 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10706 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10707 | spec->num_adc_nids = 0; |
| 10708 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10709 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10710 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10711 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10712 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10713 | unsigned int wcap = get_wcaps(codec, nid); |
| 10714 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10715 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10716 | if (wcap != AC_WID_AUD_IN) |
| 10717 | continue; |
| 10718 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10719 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10720 | if (err < 0) |
| 10721 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10722 | err = snd_hda_get_connections(codec, cap, items, |
| 10723 | ARRAY_SIZE(items)); |
| 10724 | if (err < 0) |
| 10725 | continue; |
| 10726 | for (j = 0; j < imux->num_items; j++) |
| 10727 | if (imux->items[j].index >= err) |
| 10728 | break; |
| 10729 | if (j < imux->num_items) |
| 10730 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10731 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10732 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10733 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10734 | spec->adc_nids = spec->private_adc_nids; |
| 10735 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10736 | } |
| 10737 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10738 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10739 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 10740 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10741 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10742 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 10743 | if (board_config == ALC882_AUTO) |
| 10744 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); |
| 10745 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10746 | spec->vmaster_nid = 0x0c; |
| 10747 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10748 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10749 | if (board_config == ALC882_AUTO) |
| 10750 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10751 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10752 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10753 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10754 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10755 | |
| 10756 | return 0; |
| 10757 | } |
| 10758 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10759 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10760 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10761 | * ALC262 support |
| 10762 | */ |
| 10763 | |
| 10764 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10765 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10766 | |
| 10767 | #define alc262_dac_nids alc260_dac_nids |
| 10768 | #define alc262_adc_nids alc882_adc_nids |
| 10769 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10770 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10771 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10772 | |
| 10773 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10774 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10775 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10776 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10777 | /* ADC0 */ |
| 10778 | 0x09 |
| 10779 | }; |
| 10780 | |
| 10781 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10783 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10784 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10785 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10787 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10788 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10789 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10790 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10791 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10792 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10793 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10794 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10795 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10796 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10797 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10798 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10799 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10800 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10801 | }; |
| 10802 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10803 | /* update HP, line and mono-out pins according to the master switch */ |
| 10804 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10805 | { |
| 10806 | struct alc_spec *spec = codec->spec; |
| 10807 | int val = spec->master_sw; |
| 10808 | |
| 10809 | /* HP & line-out */ |
| 10810 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10811 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10812 | val ? PIN_HP : 0); |
| 10813 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10814 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10815 | val ? PIN_HP : 0); |
| 10816 | /* mono (speaker) depending on the HP jack sense */ |
| 10817 | val = val && !spec->jack_present; |
| 10818 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10819 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10820 | val ? PIN_OUT : 0); |
| 10821 | } |
| 10822 | |
| 10823 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10824 | { |
| 10825 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10826 | |
| 10827 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10828 | alc262_hp_master_update(codec); |
| 10829 | } |
| 10830 | |
| 10831 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10832 | { |
| 10833 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10834 | return; |
| 10835 | alc262_hp_bpc_automute(codec); |
| 10836 | } |
| 10837 | |
| 10838 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10839 | { |
| 10840 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10841 | |
| 10842 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10843 | alc262_hp_master_update(codec); |
| 10844 | } |
| 10845 | |
| 10846 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10847 | unsigned int res) |
| 10848 | { |
| 10849 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10850 | return; |
| 10851 | alc262_hp_wildwest_automute(codec); |
| 10852 | } |
| 10853 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10854 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10855 | |
| 10856 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10857 | struct snd_ctl_elem_value *ucontrol) |
| 10858 | { |
| 10859 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10860 | struct alc_spec *spec = codec->spec; |
| 10861 | int val = !!*ucontrol->value.integer.value; |
| 10862 | |
| 10863 | if (val == spec->master_sw) |
| 10864 | return 0; |
| 10865 | spec->master_sw = val; |
| 10866 | alc262_hp_master_update(codec); |
| 10867 | return 1; |
| 10868 | } |
| 10869 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10870 | #define ALC262_HP_MASTER_SWITCH \ |
| 10871 | { \ |
| 10872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10873 | .name = "Master Playback Switch", \ |
| 10874 | .info = snd_ctl_boolean_mono_info, \ |
| 10875 | .get = alc262_hp_master_sw_get, \ |
| 10876 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10877 | }, \ |
| 10878 | { \ |
| 10879 | .iface = NID_MAPPING, \ |
| 10880 | .name = "Master Playback Switch", \ |
| 10881 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10882 | } |
| 10883 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10884 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10885 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10886 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10887 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10888 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10890 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10891 | HDA_OUTPUT), |
| 10892 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10893 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10894 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10896 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10897 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10898 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10899 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10900 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10901 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10902 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10903 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10904 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10905 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10906 | { } /* end */ |
| 10907 | }; |
| 10908 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10909 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10910 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10911 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10912 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10913 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10914 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10915 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10916 | HDA_OUTPUT), |
| 10917 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10918 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10919 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10920 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10921 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10922 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10923 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10924 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10925 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10926 | { } /* end */ |
| 10927 | }; |
| 10928 | |
| 10929 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10930 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10931 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10932 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10933 | { } /* end */ |
| 10934 | }; |
| 10935 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10936 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10937 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10938 | { |
| 10939 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10940 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10941 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10942 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10943 | } |
| 10944 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10945 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10946 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10947 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10948 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10949 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10951 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10952 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10953 | { } /* end */ |
| 10954 | }; |
| 10955 | |
| 10956 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10959 | |
| 10960 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10961 | { } |
| 10962 | }; |
| 10963 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10964 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10965 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10967 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10968 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10969 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10970 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10971 | { } /* end */ |
| 10972 | }; |
| 10973 | |
| 10974 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10975 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10976 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10977 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10978 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10979 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10980 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10983 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10985 | {} |
| 10986 | }; |
| 10987 | |
| 10988 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10989 | .num_items = 1, |
| 10990 | .items = { |
| 10991 | { "Line", 0x1 }, |
| 10992 | }, |
| 10993 | }; |
| 10994 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10995 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10996 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10997 | { |
| 10998 | struct alc_spec *spec = codec->spec; |
| 10999 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 11000 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 11001 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 11002 | unsigned int mute; |
| 11003 | |
| 11004 | /* HP */ |
| 11005 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 11006 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 11007 | HDA_AMP_MUTE, mute); |
| 11008 | /* mute internal speaker per jack sense */ |
| 11009 | if (spec->jack_present) |
| 11010 | mute = HDA_AMP_MUTE; |
| 11011 | if (line_nid) |
| 11012 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 11013 | HDA_AMP_MUTE, mute); |
| 11014 | if (speaker_nid && speaker_nid != line_nid) |
| 11015 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 11016 | HDA_AMP_MUTE, mute); |
| 11017 | } |
| 11018 | |
| 11019 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 11020 | |
| 11021 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11022 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11023 | { |
| 11024 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11025 | struct alc_spec *spec = codec->spec; |
| 11026 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11027 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11028 | if (val == spec->master_sw) |
| 11029 | return 0; |
| 11030 | spec->master_sw = val; |
| 11031 | alc262_hippo_master_update(codec); |
| 11032 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11033 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 11034 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11035 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 11036 | { \ |
| 11037 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 11038 | .name = "Master Playback Switch", \ |
| 11039 | .info = snd_ctl_boolean_mono_info, \ |
| 11040 | .get = alc262_hippo_master_sw_get, \ |
| 11041 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11042 | }, \ |
| 11043 | { \ |
| 11044 | .iface = NID_MAPPING, \ |
| 11045 | .name = "Master Playback Switch", \ |
| 11046 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 11047 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11048 | } |
| 11049 | |
| 11050 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 11051 | ALC262_HIPPO_MASTER_SWITCH, |
| 11052 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11053 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11054 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11055 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11056 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11059 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11060 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11061 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11062 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11063 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11064 | { } /* end */ |
| 11065 | }; |
| 11066 | |
| 11067 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 11068 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11069 | ALC262_HIPPO_MASTER_SWITCH, |
| 11070 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11071 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11072 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11073 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11074 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11075 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11076 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11077 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11078 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11079 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11080 | { } /* end */ |
| 11081 | }; |
| 11082 | |
| 11083 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11084 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 11085 | { |
| 11086 | struct alc_spec *spec = codec->spec; |
| 11087 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11088 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11089 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11090 | alc262_hippo_master_update(codec); |
| 11091 | } |
| 11092 | |
| 11093 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 11094 | { |
| 11095 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11096 | return; |
| 11097 | alc262_hippo_automute(codec); |
| 11098 | } |
| 11099 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11100 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11101 | { |
| 11102 | struct alc_spec *spec = codec->spec; |
| 11103 | |
| 11104 | spec->autocfg.hp_pins[0] = 0x15; |
| 11105 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11106 | } |
| 11107 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11108 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11109 | { |
| 11110 | struct alc_spec *spec = codec->spec; |
| 11111 | |
| 11112 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11113 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11114 | } |
| 11115 | |
| 11116 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11117 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 11118 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11119 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11120 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11121 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11122 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11123 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11124 | { } /* end */ |
| 11125 | }; |
| 11126 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11127 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11128 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11129 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11131 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11132 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11133 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11134 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11135 | { } /* end */ |
| 11136 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11137 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11138 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 11139 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11140 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11141 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 11142 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 11143 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11144 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11146 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11147 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11148 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11149 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11150 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11151 | { } /* end */ |
| 11152 | }; |
| 11153 | |
| 11154 | static struct hda_verb alc262_tyan_verbs[] = { |
| 11155 | /* Headphone automute */ |
| 11156 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11158 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11159 | |
| 11160 | /* P11 AUX_IN, white 4-pin connector */ |
| 11161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11162 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 11163 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 11164 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 11165 | |
| 11166 | {} |
| 11167 | }; |
| 11168 | |
| 11169 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11170 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11171 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11172 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11173 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11174 | spec->autocfg.hp_pins[0] = 0x1b; |
| 11175 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11176 | } |
| 11177 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11179 | #define alc262_capture_mixer alc882_capture_mixer |
| 11180 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 11181 | |
| 11182 | /* |
| 11183 | * generic initialization of ADC, input mixers and output mixers |
| 11184 | */ |
| 11185 | static struct hda_verb alc262_init_verbs[] = { |
| 11186 | /* |
| 11187 | * Unmute ADC0-2 and set the default input to mic-in |
| 11188 | */ |
| 11189 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11191 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11192 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11193 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11194 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11195 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11196 | /* 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] | 11197 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11198 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11199 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11200 | */ |
| 11201 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11207 | |
| 11208 | /* |
| 11209 | * Set up output mixers (0x0c - 0x0e) |
| 11210 | */ |
| 11211 | /* set vol=0 to output mixers */ |
| 11212 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11213 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11214 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11215 | /* set up input amps for analog loopback */ |
| 11216 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11219 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11221 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11222 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11223 | |
| 11224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11225 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11228 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11229 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11230 | |
| 11231 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11232 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11233 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11234 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11235 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11237 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11239 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11240 | /* FIXME: use matrix-type input source selection */ |
| 11241 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11242 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11243 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11244 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11245 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11246 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11247 | /* Input mixer2 */ |
| 11248 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11249 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11250 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11251 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11252 | /* Input mixer3 */ |
| 11253 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11255 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11256 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11257 | |
| 11258 | { } |
| 11259 | }; |
| 11260 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11261 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11262 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11263 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11264 | { } |
| 11265 | }; |
| 11266 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11267 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11269 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11270 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11271 | |
| 11272 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11273 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11274 | {} |
| 11275 | }; |
| 11276 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11277 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11278 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11279 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11280 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11281 | |
| 11282 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11283 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11284 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11285 | }; |
| 11286 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11287 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11288 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11289 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11290 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11291 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11292 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11293 | { } /* end */ |
| 11294 | }; |
| 11295 | |
| 11296 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11297 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11298 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11299 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11300 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11301 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11302 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11303 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11304 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11305 | {} |
| 11306 | }; |
| 11307 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11308 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11309 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11310 | struct alc_spec *spec = codec->spec; |
| 11311 | |
| 11312 | spec->autocfg.hp_pins[0] = 0x15; |
| 11313 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11314 | spec->ext_mic.pin = 0x18; |
| 11315 | spec->ext_mic.mux_idx = 0; |
| 11316 | spec->int_mic.pin = 0x12; |
| 11317 | spec->int_mic.mux_idx = 9; |
| 11318 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11319 | } |
| 11320 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11321 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11322 | * nec model |
| 11323 | * 0x15 = headphone |
| 11324 | * 0x16 = internal speaker |
| 11325 | * 0x18 = external mic |
| 11326 | */ |
| 11327 | |
| 11328 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11329 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11330 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11331 | |
| 11332 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11333 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11334 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11335 | |
| 11336 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11337 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11338 | { } /* end */ |
| 11339 | }; |
| 11340 | |
| 11341 | static struct hda_verb alc262_nec_verbs[] = { |
| 11342 | /* Unmute Speaker */ |
| 11343 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11344 | |
| 11345 | /* Headphone */ |
| 11346 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11348 | |
| 11349 | /* External mic to headphone */ |
| 11350 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11351 | /* External mic to speaker */ |
| 11352 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11353 | {} |
| 11354 | }; |
| 11355 | |
| 11356 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11357 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11358 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11359 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11360 | */ |
| 11361 | |
| 11362 | #define ALC_HP_EVENT 0x37 |
| 11363 | |
| 11364 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11365 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11366 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11367 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11368 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11369 | {} |
| 11370 | }; |
| 11371 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11372 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11373 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11374 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11375 | {} |
| 11376 | }; |
| 11377 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11378 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11379 | /* Front Mic pin: input vref at 50% */ |
| 11380 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11381 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11382 | {} |
| 11383 | }; |
| 11384 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11385 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11386 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11387 | .items = { |
| 11388 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11389 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11390 | { "CD", 0x4 }, |
| 11391 | }, |
| 11392 | }; |
| 11393 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11394 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11395 | .num_items = 5, |
| 11396 | .items = { |
| 11397 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11398 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11399 | { "Line", 0x2 }, |
| 11400 | { "CD", 0x4 }, |
| 11401 | { "AUX IN", 0x6 }, |
| 11402 | }, |
| 11403 | }; |
| 11404 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11405 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11406 | .num_items = 4, |
| 11407 | .items = { |
| 11408 | { "Mic", 0x0 }, |
| 11409 | { "Front Mic", 0x2 }, |
| 11410 | { "Line", 0x1 }, |
| 11411 | { "CD", 0x4 }, |
| 11412 | }, |
| 11413 | }; |
| 11414 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11415 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11416 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11417 | { |
| 11418 | struct alc_spec *spec = codec->spec; |
| 11419 | unsigned int mute; |
| 11420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11421 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11422 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11423 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11424 | spec->sense_updated = 1; |
| 11425 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11426 | /* unmute internal speaker only if both HPs are unplugged and |
| 11427 | * master switch is on |
| 11428 | */ |
| 11429 | if (spec->jack_present) |
| 11430 | mute = HDA_AMP_MUTE; |
| 11431 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11432 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11433 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11434 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11435 | } |
| 11436 | |
| 11437 | /* unsolicited event for HP jack sensing */ |
| 11438 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11439 | unsigned int res) |
| 11440 | { |
| 11441 | if ((res >> 26) != ALC_HP_EVENT) |
| 11442 | return; |
| 11443 | alc262_fujitsu_automute(codec, 1); |
| 11444 | } |
| 11445 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11446 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11447 | { |
| 11448 | alc262_fujitsu_automute(codec, 1); |
| 11449 | } |
| 11450 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11451 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11452 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11453 | .ops = &snd_hda_bind_vol, |
| 11454 | .values = { |
| 11455 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11456 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11457 | 0 |
| 11458 | }, |
| 11459 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11460 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11461 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11462 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11463 | { |
| 11464 | struct alc_spec *spec = codec->spec; |
| 11465 | unsigned int mute; |
| 11466 | |
| 11467 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11468 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11469 | spec->sense_updated = 1; |
| 11470 | } |
| 11471 | if (spec->jack_present) { |
| 11472 | /* mute internal speaker */ |
| 11473 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11474 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11475 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11476 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11477 | } else { |
| 11478 | /* unmute internal speaker if necessary */ |
| 11479 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11480 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11481 | HDA_AMP_MUTE, mute); |
| 11482 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11483 | HDA_AMP_MUTE, mute); |
| 11484 | } |
| 11485 | } |
| 11486 | |
| 11487 | /* unsolicited event for HP jack sensing */ |
| 11488 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11489 | unsigned int res) |
| 11490 | { |
| 11491 | if ((res >> 26) != ALC_HP_EVENT) |
| 11492 | return; |
| 11493 | alc262_lenovo_3000_automute(codec, 1); |
| 11494 | } |
| 11495 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11496 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11497 | int dir, int idx, long *valp) |
| 11498 | { |
| 11499 | int i, change = 0; |
| 11500 | |
| 11501 | for (i = 0; i < 2; i++, valp++) |
| 11502 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11503 | HDA_AMP_MUTE, |
| 11504 | *valp ? 0 : HDA_AMP_MUTE); |
| 11505 | return change; |
| 11506 | } |
| 11507 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11508 | /* bind hp and internal speaker mute (with plug check) */ |
| 11509 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11510 | struct snd_ctl_elem_value *ucontrol) |
| 11511 | { |
| 11512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11513 | long *valp = ucontrol->value.integer.value; |
| 11514 | int change; |
| 11515 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11516 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11517 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11518 | if (change) |
| 11519 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11520 | return change; |
| 11521 | } |
| 11522 | |
| 11523 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11524 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11525 | { |
| 11526 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11527 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11528 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11529 | .info = snd_hda_mixer_amp_switch_info, |
| 11530 | .get = snd_hda_mixer_amp_switch_get, |
| 11531 | .put = alc262_fujitsu_master_sw_put, |
| 11532 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11533 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11534 | { |
| 11535 | .iface = NID_MAPPING, |
| 11536 | .name = "Master Playback Switch", |
| 11537 | .private_value = 0x1b, |
| 11538 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11539 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11540 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11541 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11542 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11543 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11544 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11545 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11546 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11547 | { } /* end */ |
| 11548 | }; |
| 11549 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11550 | /* bind hp and internal speaker mute (with plug check) */ |
| 11551 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11552 | struct snd_ctl_elem_value *ucontrol) |
| 11553 | { |
| 11554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11555 | long *valp = ucontrol->value.integer.value; |
| 11556 | int change; |
| 11557 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11558 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11559 | if (change) |
| 11560 | alc262_lenovo_3000_automute(codec, 0); |
| 11561 | return change; |
| 11562 | } |
| 11563 | |
| 11564 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11565 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11566 | { |
| 11567 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11568 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11569 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11570 | .info = snd_hda_mixer_amp_switch_info, |
| 11571 | .get = snd_hda_mixer_amp_switch_get, |
| 11572 | .put = alc262_lenovo_3000_master_sw_put, |
| 11573 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11574 | }, |
| 11575 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11576 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11577 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11578 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11580 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11581 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11582 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11583 | { } /* end */ |
| 11584 | }; |
| 11585 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11586 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11587 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11588 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11592 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11594 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11595 | { } /* end */ |
| 11596 | }; |
| 11597 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11598 | /* additional init verbs for Benq laptops */ |
| 11599 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11600 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11601 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11602 | {} |
| 11603 | }; |
| 11604 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11605 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11606 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11607 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11608 | |
| 11609 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11610 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11611 | {} |
| 11612 | }; |
| 11613 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11614 | /* Samsung Q1 Ultra Vista model setup */ |
| 11615 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11616 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11617 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11620 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11621 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11622 | { } /* end */ |
| 11623 | }; |
| 11624 | |
| 11625 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11626 | /* output mixer */ |
| 11627 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11628 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11629 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11630 | /* speaker */ |
| 11631 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11632 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11633 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11634 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11635 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11637 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11639 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11640 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11641 | /* internal mic */ |
| 11642 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11643 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11644 | /* ADC, choose mic */ |
| 11645 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11646 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11647 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11648 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11649 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11650 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11651 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11652 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11653 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11654 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11655 | {} |
| 11656 | }; |
| 11657 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11658 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11659 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11660 | { |
| 11661 | struct alc_spec *spec = codec->spec; |
| 11662 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11663 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11664 | mute = 0; |
| 11665 | /* auto-mute only when HP is used as HP */ |
| 11666 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11667 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11668 | if (spec->jack_present) |
| 11669 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11670 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11671 | /* mute/unmute internal speaker */ |
| 11672 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11673 | HDA_AMP_MUTE, mute); |
| 11674 | /* mute/unmute HP */ |
| 11675 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11676 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11677 | } |
| 11678 | |
| 11679 | /* unsolicited event for HP jack sensing */ |
| 11680 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11681 | unsigned int res) |
| 11682 | { |
| 11683 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11684 | return; |
| 11685 | alc262_ultra_automute(codec); |
| 11686 | } |
| 11687 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11688 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11689 | .num_items = 2, |
| 11690 | .items = { |
| 11691 | { "Mic", 0x1 }, |
| 11692 | { "Headphone", 0x7 }, |
| 11693 | }, |
| 11694 | }; |
| 11695 | |
| 11696 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11697 | struct snd_ctl_elem_value *ucontrol) |
| 11698 | { |
| 11699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11700 | struct alc_spec *spec = codec->spec; |
| 11701 | int ret; |
| 11702 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11703 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11704 | if (!ret) |
| 11705 | return 0; |
| 11706 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11707 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11708 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11709 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11710 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11711 | return ret; |
| 11712 | } |
| 11713 | |
| 11714 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11715 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11716 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11717 | { |
| 11718 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11719 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11720 | .info = alc_mux_enum_info, |
| 11721 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11722 | .put = alc262_ultra_mux_enum_put, |
| 11723 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11724 | { |
| 11725 | .iface = NID_MAPPING, |
| 11726 | .name = "Capture Source", |
| 11727 | .private_value = 0x15, |
| 11728 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11729 | { } /* end */ |
| 11730 | }; |
| 11731 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11732 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11733 | * and thus it's bound with a different mixer. |
| 11734 | * This function returns which mixer amp should be used. |
| 11735 | */ |
| 11736 | static int alc262_check_volbit(hda_nid_t nid) |
| 11737 | { |
| 11738 | if (!nid) |
| 11739 | return 0; |
| 11740 | else if (nid == 0x16) |
| 11741 | return 2; |
| 11742 | else |
| 11743 | return 1; |
| 11744 | } |
| 11745 | |
| 11746 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11747 | const char *pfx, int *vbits) |
| 11748 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11749 | unsigned long val; |
| 11750 | int vbit; |
| 11751 | |
| 11752 | vbit = alc262_check_volbit(nid); |
| 11753 | if (!vbit) |
| 11754 | return 0; |
| 11755 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11756 | return 0; |
| 11757 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11758 | if (vbit == 2) |
| 11759 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11760 | else |
| 11761 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11762 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11763 | } |
| 11764 | |
| 11765 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11766 | const char *pfx) |
| 11767 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11768 | unsigned long val; |
| 11769 | |
| 11770 | if (!nid) |
| 11771 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11772 | if (nid == 0x16) |
| 11773 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11774 | else |
| 11775 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11776 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11777 | } |
| 11778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11779 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11780 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11781 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11782 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11783 | const char *pfx; |
| 11784 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11785 | int err; |
| 11786 | |
| 11787 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11788 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11789 | spec->multiout.dac_nids[0] = 2; |
| 11790 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11791 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11792 | pfx = "Master"; |
| 11793 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11794 | pfx = "Speaker"; |
| 11795 | else |
| 11796 | pfx = "Front"; |
| 11797 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11798 | if (err < 0) |
| 11799 | return err; |
| 11800 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11801 | if (err < 0) |
| 11802 | return err; |
| 11803 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11804 | if (err < 0) |
| 11805 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11806 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11807 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11808 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11809 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11810 | if (vbits == 1 || vbits == 2) |
| 11811 | pfx = "Master"; /* only one mixer is used */ |
| 11812 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11813 | pfx = "Speaker"; |
| 11814 | else |
| 11815 | pfx = "Front"; |
| 11816 | vbits = 0; |
| 11817 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11818 | if (err < 0) |
| 11819 | return err; |
| 11820 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11821 | &vbits); |
| 11822 | if (err < 0) |
| 11823 | return err; |
| 11824 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11825 | &vbits); |
| 11826 | if (err < 0) |
| 11827 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11828 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11829 | } |
| 11830 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11831 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11832 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11833 | |
| 11834 | /* |
| 11835 | * generic initialization of ADC, input mixers and output mixers |
| 11836 | */ |
| 11837 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11838 | /* |
| 11839 | * Unmute ADC0-2 and set the default input to mic-in |
| 11840 | */ |
| 11841 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11842 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11843 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11844 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11845 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11846 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11847 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11848 | /* 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] | 11849 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11850 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11851 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11852 | */ |
| 11853 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11854 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11856 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11857 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11858 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11859 | |
| 11860 | /* |
| 11861 | * Set up output mixers (0x0c - 0x0f) |
| 11862 | */ |
| 11863 | /* set vol=0 to output mixers */ |
| 11864 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11865 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11866 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11867 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11868 | /* set up input amps for analog loopback */ |
| 11869 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11870 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11871 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11872 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11873 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11874 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11875 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11876 | |
| 11877 | /* FIXME: use matrix-type input source selection */ |
| 11878 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11879 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11880 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11881 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11883 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11884 | /* Input mixer2 */ |
| 11885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11886 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11888 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11889 | /* Input mixer3 */ |
| 11890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11894 | |
| 11895 | { } |
| 11896 | }; |
| 11897 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11898 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11899 | /* |
| 11900 | * Unmute ADC0-2 and set the default input to mic-in |
| 11901 | */ |
| 11902 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11904 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11905 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11906 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11907 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11908 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11909 | /* 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] | 11910 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11911 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11912 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11913 | */ |
| 11914 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11915 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11916 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11917 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11918 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11919 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11922 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11923 | /* |
| 11924 | * Set up output mixers (0x0c - 0x0e) |
| 11925 | */ |
| 11926 | /* set vol=0 to output mixers */ |
| 11927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11928 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11929 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11930 | |
| 11931 | /* set up input amps for analog loopback */ |
| 11932 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11935 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11936 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11937 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11938 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11939 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11940 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11942 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11943 | |
| 11944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11945 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11946 | |
| 11947 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11948 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11949 | |
| 11950 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11951 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11952 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11953 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11954 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11955 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11957 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11959 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11960 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11961 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11962 | |
| 11963 | |
| 11964 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11965 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11966 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11967 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11976 | /* Input mixer2 */ |
| 11977 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11982 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11983 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11984 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11985 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11986 | /* Input mixer3 */ |
| 11987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11990 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11995 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11996 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11997 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11998 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11999 | { } |
| 12000 | }; |
| 12001 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12002 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 12003 | /* |
| 12004 | * Unmute ADC0-2 and set the default input to mic-in |
| 12005 | */ |
| 12006 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12007 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12010 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12012 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12013 | /* 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] | 12014 | * mixer widget |
| 12015 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12016 | * panel mic (mic 2) |
| 12017 | */ |
| 12018 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12019 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12021 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 12026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12027 | /* |
| 12028 | * Set up output mixers (0x0c - 0x0e) |
| 12029 | */ |
| 12030 | /* set vol=0 to output mixers */ |
| 12031 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12032 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12034 | |
| 12035 | /* set up input amps for analog loopback */ |
| 12036 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12039 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12041 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12043 | |
| 12044 | |
| 12045 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 12046 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 12047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 12048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 12049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 12051 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 12052 | |
| 12053 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12054 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12055 | |
| 12056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12057 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12058 | |
| 12059 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 12060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12061 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 12063 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12064 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 12065 | |
| 12066 | /* FIXME: use matrix-type input source selection */ |
| 12067 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12068 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 12069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 12070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 12071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 12072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 12073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 12074 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 12076 | /* Input mixer2 */ |
| 12077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12079 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12082 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12083 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12084 | /* Input mixer3 */ |
| 12085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 12086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 12087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 12088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 12089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 12090 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 12091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 12092 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12093 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12094 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12095 | { } |
| 12096 | }; |
| 12097 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12098 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 12099 | |
| 12100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 12101 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12102 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12103 | |
| 12104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 12105 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 12106 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12107 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 12108 | |
| 12109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 12110 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12111 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12112 | {} |
| 12113 | }; |
| 12114 | |
| 12115 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12116 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12117 | #define alc262_loopbacks alc880_loopbacks |
| 12118 | #endif |
| 12119 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12120 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12121 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 12122 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 12123 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 12124 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 12125 | |
| 12126 | /* |
| 12127 | * BIOS auto configuration |
| 12128 | */ |
| 12129 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 12130 | { |
| 12131 | struct alc_spec *spec = codec->spec; |
| 12132 | int err; |
| 12133 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 12134 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12135 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12136 | alc262_ignore); |
| 12137 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12138 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12139 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12140 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12141 | spec->multiout.max_channels = 2; |
| 12142 | spec->no_analog = 1; |
| 12143 | goto dig_only; |
| 12144 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12145 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12146 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12147 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12148 | if (err < 0) |
| 12149 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12150 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12151 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12152 | return err; |
| 12153 | |
| 12154 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12155 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12156 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12157 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12158 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 12159 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12160 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12161 | if (spec->autocfg.dig_in_pin) |
| 12162 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 12163 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12164 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12165 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12166 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12167 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12168 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12169 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12170 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12171 | err = alc_auto_add_mic_boost(codec); |
| 12172 | if (err < 0) |
| 12173 | return err; |
| 12174 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 12175 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 12176 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12177 | return 1; |
| 12178 | } |
| 12179 | |
| 12180 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 12181 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 12182 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12183 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12184 | |
| 12185 | |
| 12186 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12187 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12188 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12189 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12190 | alc262_auto_init_multi_out(codec); |
| 12191 | alc262_auto_init_hp_out(codec); |
| 12192 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 12193 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12194 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12195 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12196 | } |
| 12197 | |
| 12198 | /* |
| 12199 | * configuration and preset |
| 12200 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12201 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 12202 | [ALC262_BASIC] = "basic", |
| 12203 | [ALC262_HIPPO] = "hippo", |
| 12204 | [ALC262_HIPPO_1] = "hippo_1", |
| 12205 | [ALC262_FUJITSU] = "fujitsu", |
| 12206 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12207 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 12208 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12209 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12210 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 12211 | [ALC262_BENQ_T31] = "benq-t31", |
| 12212 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 12213 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12214 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12215 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12216 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12217 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12218 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12219 | [ALC262_AUTO] = "auto", |
| 12220 | }; |
| 12221 | |
| 12222 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12223 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12224 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12225 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12226 | ALC262_HP_BPC), |
| 12227 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12228 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12229 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12230 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12231 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12232 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12233 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12234 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12235 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12236 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12237 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12238 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12239 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12240 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12241 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12242 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12243 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12244 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12245 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12246 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12247 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12248 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12249 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12250 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12251 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12252 | #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] | 12253 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12254 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12255 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12256 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12257 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12258 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12259 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12260 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12261 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12262 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12263 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12264 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12265 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12266 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12267 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12268 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12269 | {} |
| 12270 | }; |
| 12271 | |
| 12272 | static struct alc_config_preset alc262_presets[] = { |
| 12273 | [ALC262_BASIC] = { |
| 12274 | .mixers = { alc262_base_mixer }, |
| 12275 | .init_verbs = { alc262_init_verbs }, |
| 12276 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12277 | .dac_nids = alc262_dac_nids, |
| 12278 | .hp_nid = 0x03, |
| 12279 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12280 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12281 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12282 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12283 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12284 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12285 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12286 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12287 | .dac_nids = alc262_dac_nids, |
| 12288 | .hp_nid = 0x03, |
| 12289 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12290 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12291 | .channel_mode = alc262_modes, |
| 12292 | .input_mux = &alc262_capture_source, |
| 12293 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12294 | .setup = alc262_hippo_setup, |
| 12295 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12296 | }, |
| 12297 | [ALC262_HIPPO_1] = { |
| 12298 | .mixers = { alc262_hippo1_mixer }, |
| 12299 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12300 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12301 | .dac_nids = alc262_dac_nids, |
| 12302 | .hp_nid = 0x02, |
| 12303 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12304 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12305 | .channel_mode = alc262_modes, |
| 12306 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12307 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12308 | .setup = alc262_hippo1_setup, |
| 12309 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12310 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12311 | [ALC262_FUJITSU] = { |
| 12312 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12313 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12314 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12315 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12316 | .dac_nids = alc262_dac_nids, |
| 12317 | .hp_nid = 0x03, |
| 12318 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12319 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12320 | .channel_mode = alc262_modes, |
| 12321 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12322 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12323 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12324 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12325 | [ALC262_HP_BPC] = { |
| 12326 | .mixers = { alc262_HP_BPC_mixer }, |
| 12327 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12328 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12329 | .dac_nids = alc262_dac_nids, |
| 12330 | .hp_nid = 0x03, |
| 12331 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12332 | .channel_mode = alc262_modes, |
| 12333 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12334 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12335 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12336 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12337 | [ALC262_HP_BPC_D7000_WF] = { |
| 12338 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12339 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12340 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12341 | .dac_nids = alc262_dac_nids, |
| 12342 | .hp_nid = 0x03, |
| 12343 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12344 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12345 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12346 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12347 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12348 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12349 | [ALC262_HP_BPC_D7000_WL] = { |
| 12350 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12351 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12352 | .init_verbs = { alc262_HP_BPC_WildWest_init_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, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12358 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12359 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12360 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12361 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12362 | [ALC262_HP_TC_T5735] = { |
| 12363 | .mixers = { alc262_hp_t5735_mixer }, |
| 12364 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12365 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12366 | .dac_nids = alc262_dac_nids, |
| 12367 | .hp_nid = 0x03, |
| 12368 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12369 | .channel_mode = alc262_modes, |
| 12370 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12371 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12372 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12373 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12374 | }, |
| 12375 | [ALC262_HP_RP5700] = { |
| 12376 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12377 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12378 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12379 | .dac_nids = alc262_dac_nids, |
| 12380 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12381 | .channel_mode = alc262_modes, |
| 12382 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12383 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12384 | [ALC262_BENQ_ED8] = { |
| 12385 | .mixers = { alc262_base_mixer }, |
| 12386 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12387 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12388 | .dac_nids = alc262_dac_nids, |
| 12389 | .hp_nid = 0x03, |
| 12390 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12391 | .channel_mode = alc262_modes, |
| 12392 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12393 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12394 | [ALC262_SONY_ASSAMD] = { |
| 12395 | .mixers = { alc262_sony_mixer }, |
| 12396 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12397 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12398 | .dac_nids = alc262_dac_nids, |
| 12399 | .hp_nid = 0x02, |
| 12400 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12401 | .channel_mode = alc262_modes, |
| 12402 | .input_mux = &alc262_capture_source, |
| 12403 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12404 | .setup = alc262_hippo_setup, |
| 12405 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12406 | }, |
| 12407 | [ALC262_BENQ_T31] = { |
| 12408 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12409 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12410 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12411 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12412 | .dac_nids = alc262_dac_nids, |
| 12413 | .hp_nid = 0x03, |
| 12414 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12415 | .channel_mode = alc262_modes, |
| 12416 | .input_mux = &alc262_capture_source, |
| 12417 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12418 | .setup = alc262_hippo_setup, |
| 12419 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12420 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12421 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12422 | .mixers = { alc262_ultra_mixer }, |
| 12423 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12424 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12425 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12426 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12427 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12428 | .channel_mode = alc262_modes, |
| 12429 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12430 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12431 | .capsrc_nids = alc262_capsrc_nids, |
| 12432 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12433 | .unsol_event = alc262_ultra_unsol_event, |
| 12434 | .init_hook = alc262_ultra_automute, |
| 12435 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12436 | [ALC262_LENOVO_3000] = { |
| 12437 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12438 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12439 | alc262_lenovo_3000_unsol_verbs, |
| 12440 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12441 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12442 | .dac_nids = alc262_dac_nids, |
| 12443 | .hp_nid = 0x03, |
| 12444 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12445 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12446 | .channel_mode = alc262_modes, |
| 12447 | .input_mux = &alc262_fujitsu_capture_source, |
| 12448 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12449 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12450 | [ALC262_NEC] = { |
| 12451 | .mixers = { alc262_nec_mixer }, |
| 12452 | .init_verbs = { alc262_nec_verbs }, |
| 12453 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12454 | .dac_nids = alc262_dac_nids, |
| 12455 | .hp_nid = 0x03, |
| 12456 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12457 | .channel_mode = alc262_modes, |
| 12458 | .input_mux = &alc262_capture_source, |
| 12459 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12460 | [ALC262_TOSHIBA_S06] = { |
| 12461 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12462 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12463 | alc262_eapd_verbs }, |
| 12464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12465 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12466 | .dac_nids = alc262_dac_nids, |
| 12467 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12468 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12469 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12470 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12471 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12472 | .unsol_event = alc_sku_unsol_event, |
| 12473 | .setup = alc262_toshiba_s06_setup, |
| 12474 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12475 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12476 | [ALC262_TOSHIBA_RX1] = { |
| 12477 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12478 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12479 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12480 | .dac_nids = alc262_dac_nids, |
| 12481 | .hp_nid = 0x03, |
| 12482 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12483 | .channel_mode = alc262_modes, |
| 12484 | .input_mux = &alc262_capture_source, |
| 12485 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12486 | .setup = alc262_hippo_setup, |
| 12487 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12488 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12489 | [ALC262_TYAN] = { |
| 12490 | .mixers = { alc262_tyan_mixer }, |
| 12491 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12492 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12493 | .dac_nids = alc262_dac_nids, |
| 12494 | .hp_nid = 0x02, |
| 12495 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12496 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12497 | .channel_mode = alc262_modes, |
| 12498 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12499 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12500 | .setup = alc262_tyan_setup, |
| 12501 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12502 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12503 | }; |
| 12504 | |
| 12505 | static int patch_alc262(struct hda_codec *codec) |
| 12506 | { |
| 12507 | struct alc_spec *spec; |
| 12508 | int board_config; |
| 12509 | int err; |
| 12510 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12511 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12512 | if (spec == NULL) |
| 12513 | return -ENOMEM; |
| 12514 | |
| 12515 | codec->spec = spec; |
| 12516 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12517 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12518 | * under-run |
| 12519 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12520 | { |
| 12521 | int tmp; |
| 12522 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12523 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12524 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12525 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12526 | } |
| 12527 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12528 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12529 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12530 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12531 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12532 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12533 | alc262_models, |
| 12534 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12535 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12536 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12537 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12538 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12539 | board_config = ALC262_AUTO; |
| 12540 | } |
| 12541 | |
| 12542 | if (board_config == ALC262_AUTO) { |
| 12543 | /* automatic parse from the BIOS config */ |
| 12544 | err = alc262_parse_auto_config(codec); |
| 12545 | if (err < 0) { |
| 12546 | alc_free(codec); |
| 12547 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12548 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12549 | printk(KERN_INFO |
| 12550 | "hda_codec: Cannot set up configuration " |
| 12551 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12552 | board_config = ALC262_BASIC; |
| 12553 | } |
| 12554 | } |
| 12555 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12556 | if (!spec->no_analog && has_cdefine_beep(codec)) { |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12557 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12558 | if (err < 0) { |
| 12559 | alc_free(codec); |
| 12560 | return err; |
| 12561 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12562 | } |
| 12563 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12564 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12565 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12567 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12568 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12569 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12570 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12571 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12572 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12573 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12574 | int i; |
| 12575 | /* check whether the digital-mic has to be supported */ |
| 12576 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12577 | if (spec->input_mux->items[i].index >= 9) |
| 12578 | break; |
| 12579 | } |
| 12580 | if (i < spec->input_mux->num_items) { |
| 12581 | /* use only ADC0 */ |
| 12582 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12583 | spec->num_adc_nids = 1; |
| 12584 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12585 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12586 | /* all analog inputs */ |
| 12587 | /* check whether NID 0x07 is valid */ |
| 12588 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12589 | |
| 12590 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12591 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12592 | if (wcap != AC_WID_AUD_IN) { |
| 12593 | spec->adc_nids = alc262_adc_nids_alt; |
| 12594 | spec->num_adc_nids = |
| 12595 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12596 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12597 | } else { |
| 12598 | spec->adc_nids = alc262_adc_nids; |
| 12599 | spec->num_adc_nids = |
| 12600 | ARRAY_SIZE(alc262_adc_nids); |
| 12601 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12602 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12603 | } |
| 12604 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12605 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12606 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 12607 | if (!spec->no_analog && has_cdefine_beep(codec)) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12608 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12609 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12610 | spec->vmaster_nid = 0x0c; |
| 12611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12612 | codec->patch_ops = alc_patch_ops; |
| 12613 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12614 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12615 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12616 | if (!spec->loopback.amplist) |
| 12617 | spec->loopback.amplist = alc262_loopbacks; |
| 12618 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12619 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12620 | return 0; |
| 12621 | } |
| 12622 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12623 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12624 | * ALC268 channel source setting (2 channel) |
| 12625 | */ |
| 12626 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12627 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12628 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12629 | static hda_nid_t alc268_dac_nids[2] = { |
| 12630 | /* front, hp */ |
| 12631 | 0x02, 0x03 |
| 12632 | }; |
| 12633 | |
| 12634 | static hda_nid_t alc268_adc_nids[2] = { |
| 12635 | /* ADC0-1 */ |
| 12636 | 0x08, 0x07 |
| 12637 | }; |
| 12638 | |
| 12639 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12640 | /* ADC0 */ |
| 12641 | 0x08 |
| 12642 | }; |
| 12643 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12644 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12645 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12646 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12647 | /* output mixer control */ |
| 12648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12649 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12650 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12651 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12652 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12653 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12654 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12655 | { } |
| 12656 | }; |
| 12657 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12658 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12659 | /* output mixer control */ |
| 12660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12661 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12662 | ALC262_HIPPO_MASTER_SWITCH, |
| 12663 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12664 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12665 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12666 | { } |
| 12667 | }; |
| 12668 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12669 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12670 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12671 | .ops = &snd_hda_bind_sw, |
| 12672 | .values = { |
| 12673 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12674 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12675 | 0 |
| 12676 | }, |
| 12677 | }; |
| 12678 | |
| 12679 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12680 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12681 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12682 | { } |
| 12683 | }; |
| 12684 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12685 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12686 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12687 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12688 | { } |
| 12689 | }; |
| 12690 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12691 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12692 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12693 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12694 | { } /* end */ |
| 12695 | }; |
| 12696 | |
| 12697 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12698 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12699 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12700 | .ops = &snd_hda_bind_vol, |
| 12701 | .values = { |
| 12702 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12703 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12704 | 0 |
| 12705 | }, |
| 12706 | }; |
| 12707 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12708 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12709 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12710 | { |
| 12711 | struct alc_spec *spec = codec->spec; |
| 12712 | unsigned int mute; |
| 12713 | |
| 12714 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12715 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12716 | spec->sense_updated = 1; |
| 12717 | } |
| 12718 | if (spec->jack_present) |
| 12719 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12720 | else /* unmute internal speaker if necessary */ |
| 12721 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12722 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12723 | HDA_AMP_MUTE, mute); |
| 12724 | } |
| 12725 | |
| 12726 | |
| 12727 | /* bind hp and internal speaker mute (with plug check) */ |
| 12728 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12729 | struct snd_ctl_elem_value *ucontrol) |
| 12730 | { |
| 12731 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12732 | long *valp = ucontrol->value.integer.value; |
| 12733 | int change; |
| 12734 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12735 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12736 | if (change) |
| 12737 | alc268_acer_automute(codec, 0); |
| 12738 | return change; |
| 12739 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12740 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12741 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12742 | /* output mixer control */ |
| 12743 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12744 | { |
| 12745 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12746 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12747 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12748 | .info = snd_hda_mixer_amp_switch_info, |
| 12749 | .get = snd_hda_mixer_amp_switch_get, |
| 12750 | .put = alc268_acer_master_sw_put, |
| 12751 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12752 | }, |
| 12753 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12754 | { } |
| 12755 | }; |
| 12756 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12757 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12758 | /* output mixer control */ |
| 12759 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12760 | { |
| 12761 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12762 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12763 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12764 | .info = snd_hda_mixer_amp_switch_info, |
| 12765 | .get = snd_hda_mixer_amp_switch_get, |
| 12766 | .put = alc268_acer_master_sw_put, |
| 12767 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12768 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12770 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12771 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12772 | { } |
| 12773 | }; |
| 12774 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12775 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12776 | /* output mixer control */ |
| 12777 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12778 | { |
| 12779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12780 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12781 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12782 | .info = snd_hda_mixer_amp_switch_info, |
| 12783 | .get = snd_hda_mixer_amp_switch_get, |
| 12784 | .put = alc268_acer_master_sw_put, |
| 12785 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12786 | }, |
| 12787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12788 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12789 | { } |
| 12790 | }; |
| 12791 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12792 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12793 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12794 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12795 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12796 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12797 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12798 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12799 | { } |
| 12800 | }; |
| 12801 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12802 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12803 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12804 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12805 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12806 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12807 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12808 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12809 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12810 | { } |
| 12811 | }; |
| 12812 | |
| 12813 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12814 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12815 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12816 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12817 | |
| 12818 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12819 | unsigned int res) |
| 12820 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12821 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12822 | return; |
| 12823 | alc268_acer_automute(codec, 1); |
| 12824 | } |
| 12825 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12826 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12827 | { |
| 12828 | alc268_acer_automute(codec, 1); |
| 12829 | } |
| 12830 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12831 | /* toggle speaker-output according to the hp-jack state */ |
| 12832 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12833 | { |
| 12834 | unsigned int present; |
| 12835 | unsigned char bits; |
| 12836 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12837 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12838 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12839 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12840 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12841 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12842 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12843 | } |
| 12844 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12845 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12846 | unsigned int res) |
| 12847 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12848 | switch (res >> 26) { |
| 12849 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12850 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12851 | break; |
| 12852 | case ALC880_MIC_EVENT: |
| 12853 | alc_mic_automute(codec); |
| 12854 | break; |
| 12855 | } |
| 12856 | } |
| 12857 | |
| 12858 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12859 | { |
| 12860 | struct alc_spec *spec = codec->spec; |
| 12861 | spec->ext_mic.pin = 0x18; |
| 12862 | spec->ext_mic.mux_idx = 0; |
| 12863 | spec->int_mic.pin = 0x12; |
| 12864 | spec->int_mic.mux_idx = 6; |
| 12865 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12866 | } |
| 12867 | |
| 12868 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12869 | { |
| 12870 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12871 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12872 | } |
| 12873 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12874 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12875 | /* output mixer control */ |
| 12876 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12877 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12878 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12881 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12882 | { } |
| 12883 | }; |
| 12884 | |
| 12885 | static struct hda_verb alc268_dell_verbs[] = { |
| 12886 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12887 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12888 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12889 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12890 | { } |
| 12891 | }; |
| 12892 | |
| 12893 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12894 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12895 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12896 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12897 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12898 | spec->autocfg.hp_pins[0] = 0x15; |
| 12899 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12900 | spec->ext_mic.pin = 0x18; |
| 12901 | spec->ext_mic.mux_idx = 0; |
| 12902 | spec->int_mic.pin = 0x19; |
| 12903 | spec->int_mic.mux_idx = 1; |
| 12904 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12905 | } |
| 12906 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12907 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12908 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12909 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12910 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12911 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12912 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12913 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12914 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12915 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12916 | { } |
| 12917 | }; |
| 12918 | |
| 12919 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12920 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12921 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12922 | { } |
| 12923 | }; |
| 12924 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12925 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12926 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12927 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12928 | spec->autocfg.hp_pins[0] = 0x15; |
| 12929 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12930 | spec->ext_mic.pin = 0x18; |
| 12931 | spec->ext_mic.mux_idx = 0; |
| 12932 | spec->int_mic.pin = 0x19; |
| 12933 | spec->int_mic.mux_idx = 1; |
| 12934 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12935 | } |
| 12936 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12937 | /* |
| 12938 | * generic initialization of ADC, input mixers and output mixers |
| 12939 | */ |
| 12940 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12941 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12942 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12943 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12944 | |
| 12945 | /* |
| 12946 | * Set up output mixers (0x0c - 0x0e) |
| 12947 | */ |
| 12948 | /* set vol=0 to output mixers */ |
| 12949 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12950 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12951 | |
| 12952 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12953 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12954 | |
| 12955 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12958 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12959 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12960 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12961 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12962 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12963 | |
| 12964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12965 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12966 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12967 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12968 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12969 | |
| 12970 | /* set PCBEEP vol = 0, mute connections */ |
| 12971 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12972 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12973 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12974 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12975 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12976 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12977 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12978 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12979 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12980 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12981 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12982 | { } |
| 12983 | }; |
| 12984 | |
| 12985 | /* |
| 12986 | * generic initialization of ADC, input mixers and output mixers |
| 12987 | */ |
| 12988 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12989 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12990 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12991 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12992 | |
| 12993 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12994 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12995 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12996 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12997 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12998 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13000 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13001 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13002 | |
| 13003 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13004 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13005 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13006 | /* set PCBEEP vol = 0, mute connections */ |
| 13007 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13008 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13009 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13010 | |
| 13011 | { } |
| 13012 | }; |
| 13013 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13014 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 13015 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13016 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13017 | { } /* end */ |
| 13018 | }; |
| 13019 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13020 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 13021 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13022 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13023 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13024 | { } /* end */ |
| 13025 | }; |
| 13026 | |
| 13027 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 13028 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13029 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 13030 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 13031 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13032 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13033 | { } /* end */ |
| 13034 | }; |
| 13035 | |
| 13036 | static struct hda_input_mux alc268_capture_source = { |
| 13037 | .num_items = 4, |
| 13038 | .items = { |
| 13039 | { "Mic", 0x0 }, |
| 13040 | { "Front Mic", 0x1 }, |
| 13041 | { "Line", 0x2 }, |
| 13042 | { "CD", 0x3 }, |
| 13043 | }, |
| 13044 | }; |
| 13045 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13046 | static struct hda_input_mux alc268_acer_capture_source = { |
| 13047 | .num_items = 3, |
| 13048 | .items = { |
| 13049 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13050 | { "Internal Mic", 0x1 }, |
| 13051 | { "Line", 0x2 }, |
| 13052 | }, |
| 13053 | }; |
| 13054 | |
| 13055 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 13056 | .num_items = 3, |
| 13057 | .items = { |
| 13058 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13059 | { "Internal Mic", 0x6 }, |
| 13060 | { "Line", 0x2 }, |
| 13061 | }, |
| 13062 | }; |
| 13063 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13064 | #ifdef CONFIG_SND_DEBUG |
| 13065 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13066 | /* Volume widgets */ |
| 13067 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13068 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13069 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 13070 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 13071 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 13072 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 13073 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 13074 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 13075 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 13076 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 13077 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 13078 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 13079 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 13080 | /* The below appears problematic on some hardwares */ |
| 13081 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13082 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 13083 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 13084 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 13085 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 13086 | |
| 13087 | /* Modes for retasking pin widgets */ |
| 13088 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 13089 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 13090 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 13091 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 13092 | |
| 13093 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 13094 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 13095 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 13096 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 13097 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 13098 | |
| 13099 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 13100 | * The ALC268 does not have an SPDIF input. |
| 13101 | */ |
| 13102 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 13103 | |
| 13104 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 13105 | * this output to turn on an external amplifier. |
| 13106 | */ |
| 13107 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 13108 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 13109 | |
| 13110 | { } /* end */ |
| 13111 | }; |
| 13112 | #endif |
| 13113 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13114 | /* create input playback/capture controls for the given pin */ |
| 13115 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 13116 | const char *ctlname, int idx) |
| 13117 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13118 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13119 | int err; |
| 13120 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13121 | switch (nid) { |
| 13122 | case 0x14: |
| 13123 | case 0x16: |
| 13124 | dac = 0x02; |
| 13125 | break; |
| 13126 | case 0x15: |
Kailang Yang | 531d879 | 2010-04-09 10:57:33 +0200 | [diff] [blame] | 13127 | case 0x21: /* ALC269vb has this pin, too */ |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13128 | dac = 0x03; |
| 13129 | break; |
| 13130 | default: |
| 13131 | return 0; |
| 13132 | } |
| 13133 | if (spec->multiout.dac_nids[0] != dac && |
| 13134 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13135 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13136 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13137 | HDA_OUTPUT)); |
| 13138 | if (err < 0) |
| 13139 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13140 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 13141 | } |
| 13142 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13143 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13144 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13145 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13146 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13147 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13148 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13149 | if (err < 0) |
| 13150 | return err; |
| 13151 | return 0; |
| 13152 | } |
| 13153 | |
| 13154 | /* add playback controls from the parsed DAC table */ |
| 13155 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13156 | const struct auto_pin_cfg *cfg) |
| 13157 | { |
| 13158 | hda_nid_t nid; |
| 13159 | int err; |
| 13160 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13161 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13162 | |
| 13163 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13164 | if (nid) { |
| 13165 | const char *name; |
| 13166 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 13167 | name = "Speaker"; |
| 13168 | else |
| 13169 | name = "Front"; |
| 13170 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 13171 | if (err < 0) |
| 13172 | return err; |
| 13173 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13174 | |
| 13175 | nid = cfg->speaker_pins[0]; |
| 13176 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13177 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13178 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 13179 | if (err < 0) |
| 13180 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13181 | } else { |
| 13182 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 13183 | if (err < 0) |
| 13184 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13185 | } |
| 13186 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13187 | if (nid) { |
| 13188 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 13189 | if (err < 0) |
| 13190 | return err; |
| 13191 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13192 | |
| 13193 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 13194 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 13195 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 13196 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13197 | if (err < 0) |
| 13198 | return err; |
| 13199 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13200 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13201 | } |
| 13202 | |
| 13203 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13204 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13205 | const struct auto_pin_cfg *cfg) |
| 13206 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13207 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13208 | } |
| 13209 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13210 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13211 | hda_nid_t nid, int pin_type) |
| 13212 | { |
| 13213 | int idx; |
| 13214 | |
| 13215 | alc_set_pin_output(codec, nid, pin_type); |
| 13216 | if (nid == 0x14 || nid == 0x16) |
| 13217 | idx = 0; |
| 13218 | else |
| 13219 | idx = 1; |
| 13220 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13221 | } |
| 13222 | |
| 13223 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13224 | { |
| 13225 | struct alc_spec *spec = codec->spec; |
| 13226 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13227 | if (nid) { |
| 13228 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13229 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13230 | } |
| 13231 | } |
| 13232 | |
| 13233 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13234 | { |
| 13235 | struct alc_spec *spec = codec->spec; |
| 13236 | hda_nid_t pin; |
| 13237 | |
| 13238 | pin = spec->autocfg.hp_pins[0]; |
| 13239 | if (pin) |
| 13240 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13241 | pin = spec->autocfg.speaker_pins[0]; |
| 13242 | if (pin) |
| 13243 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13244 | } |
| 13245 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13246 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13247 | { |
| 13248 | struct alc_spec *spec = codec->spec; |
| 13249 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13250 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13251 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13252 | unsigned int dac_vol1, dac_vol2; |
| 13253 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13254 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13255 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13256 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13257 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13258 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13259 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13260 | AMP_IN_UNMUTE(1)); |
| 13261 | snd_hda_codec_write(codec, 0x10, 0, |
| 13262 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13263 | AMP_IN_UNMUTE(1)); |
| 13264 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13265 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13266 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13267 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13268 | snd_hda_codec_write(codec, 0x10, 0, |
| 13269 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13270 | } |
| 13271 | |
| 13272 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13273 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13274 | dac_vol2 = AMP_OUT_ZERO; |
| 13275 | else if (line_nid == 0x15) |
| 13276 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13277 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13278 | dac_vol2 = AMP_OUT_ZERO; |
| 13279 | else if (hp_nid == 0x15) |
| 13280 | dac_vol1 = AMP_OUT_ZERO; |
| 13281 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13282 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13283 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13284 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13285 | |
| 13286 | snd_hda_codec_write(codec, 0x02, 0, |
| 13287 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13288 | snd_hda_codec_write(codec, 0x03, 0, |
| 13289 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13290 | } |
| 13291 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13292 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13293 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13294 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13295 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13296 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13297 | |
| 13298 | /* |
| 13299 | * BIOS auto configuration |
| 13300 | */ |
| 13301 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13302 | { |
| 13303 | struct alc_spec *spec = codec->spec; |
| 13304 | int err; |
| 13305 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13306 | |
| 13307 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13308 | alc268_ignore); |
| 13309 | if (err < 0) |
| 13310 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13311 | if (!spec->autocfg.line_outs) { |
| 13312 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13313 | spec->multiout.max_channels = 2; |
| 13314 | spec->no_analog = 1; |
| 13315 | goto dig_only; |
| 13316 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13317 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13318 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13319 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13320 | if (err < 0) |
| 13321 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13322 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13323 | if (err < 0) |
| 13324 | return err; |
| 13325 | |
| 13326 | spec->multiout.max_channels = 2; |
| 13327 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13328 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13329 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13330 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13331 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13332 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13333 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13334 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13335 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13336 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13337 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13338 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13339 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13340 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13341 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13342 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13343 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13344 | err = alc_auto_add_mic_boost(codec); |
| 13345 | if (err < 0) |
| 13346 | return err; |
| 13347 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13348 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13349 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13350 | return 1; |
| 13351 | } |
| 13352 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13353 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13354 | |
| 13355 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13356 | static void alc268_auto_init(struct hda_codec *codec) |
| 13357 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13358 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13359 | alc268_auto_init_multi_out(codec); |
| 13360 | alc268_auto_init_hp_out(codec); |
| 13361 | alc268_auto_init_mono_speaker_out(codec); |
| 13362 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13363 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13364 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13365 | } |
| 13366 | |
| 13367 | /* |
| 13368 | * configuration and preset |
| 13369 | */ |
| 13370 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13371 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13372 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13373 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13374 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13375 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13376 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13377 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13378 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13379 | #ifdef CONFIG_SND_DEBUG |
| 13380 | [ALC268_TEST] = "test", |
| 13381 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13382 | [ALC268_AUTO] = "auto", |
| 13383 | }; |
| 13384 | |
| 13385 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13386 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13387 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13388 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13389 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13390 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13391 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13392 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13393 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13394 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13395 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13396 | /* almost compatible with toshiba but with optional digital outs; |
| 13397 | * auto-probing seems working fine |
| 13398 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13399 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13400 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13402 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13403 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13404 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13405 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13406 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13407 | {} |
| 13408 | }; |
| 13409 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13410 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13411 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13412 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13413 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13414 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13415 | ALC268_TOSHIBA), |
| 13416 | {} |
| 13417 | }; |
| 13418 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13419 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13420 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13421 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13422 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13423 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13424 | alc267_quanta_il1_verbs }, |
| 13425 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13426 | .dac_nids = alc268_dac_nids, |
| 13427 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13428 | .adc_nids = alc268_adc_nids_alt, |
| 13429 | .hp_nid = 0x03, |
| 13430 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13431 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13432 | .unsol_event = alc_sku_unsol_event, |
| 13433 | .setup = alc267_quanta_il1_setup, |
| 13434 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13435 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13436 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13437 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13438 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13439 | .init_verbs = { alc268_base_init_verbs }, |
| 13440 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13441 | .dac_nids = alc268_dac_nids, |
| 13442 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13443 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13444 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13445 | .hp_nid = 0x03, |
| 13446 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13447 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13448 | .channel_mode = alc268_modes, |
| 13449 | .input_mux = &alc268_capture_source, |
| 13450 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13451 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13452 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13453 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13454 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13455 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13456 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13457 | .dac_nids = alc268_dac_nids, |
| 13458 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13459 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13460 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13461 | .hp_nid = 0x03, |
| 13462 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13463 | .channel_mode = alc268_modes, |
| 13464 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13465 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13466 | .setup = alc268_toshiba_setup, |
| 13467 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13468 | }, |
| 13469 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13470 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13471 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13472 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13473 | alc268_acer_verbs }, |
| 13474 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13475 | .dac_nids = alc268_dac_nids, |
| 13476 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13477 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13478 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13479 | .hp_nid = 0x02, |
| 13480 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13481 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13482 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13483 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13484 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13485 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13486 | [ALC268_ACER_DMIC] = { |
| 13487 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13488 | alc268_beep_mixer }, |
| 13489 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13490 | alc268_acer_verbs }, |
| 13491 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13492 | .dac_nids = alc268_dac_nids, |
| 13493 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13494 | .adc_nids = alc268_adc_nids_alt, |
| 13495 | .capsrc_nids = alc268_capsrc_nids, |
| 13496 | .hp_nid = 0x02, |
| 13497 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13498 | .channel_mode = alc268_modes, |
| 13499 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13500 | .unsol_event = alc268_acer_unsol_event, |
| 13501 | .init_hook = alc268_acer_init_hook, |
| 13502 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13503 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13504 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13505 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13506 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13507 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13508 | alc268_acer_aspire_one_verbs }, |
| 13509 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13510 | .dac_nids = alc268_dac_nids, |
| 13511 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13512 | .adc_nids = alc268_adc_nids_alt, |
| 13513 | .capsrc_nids = alc268_capsrc_nids, |
| 13514 | .hp_nid = 0x03, |
| 13515 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13516 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13517 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13518 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13519 | .init_hook = alc268_acer_lc_init_hook, |
| 13520 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13521 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13522 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13523 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13524 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13525 | alc268_dell_verbs }, |
| 13526 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13527 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13528 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13529 | .adc_nids = alc268_adc_nids_alt, |
| 13530 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13531 | .hp_nid = 0x02, |
| 13532 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13533 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13534 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13535 | .setup = alc268_dell_setup, |
| 13536 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13537 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13538 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13539 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13540 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13541 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13542 | alc268_toshiba_verbs }, |
| 13543 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13544 | .dac_nids = alc268_dac_nids, |
| 13545 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13546 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13547 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13548 | .hp_nid = 0x03, |
| 13549 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13550 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13551 | .channel_mode = alc268_modes, |
| 13552 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13553 | .setup = alc268_toshiba_setup, |
| 13554 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13555 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13556 | #ifdef CONFIG_SND_DEBUG |
| 13557 | [ALC268_TEST] = { |
| 13558 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13559 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13560 | alc268_volume_init_verbs }, |
| 13561 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13562 | .dac_nids = alc268_dac_nids, |
| 13563 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13564 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13565 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13566 | .hp_nid = 0x03, |
| 13567 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13568 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13569 | .channel_mode = alc268_modes, |
| 13570 | .input_mux = &alc268_capture_source, |
| 13571 | }, |
| 13572 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13573 | }; |
| 13574 | |
| 13575 | static int patch_alc268(struct hda_codec *codec) |
| 13576 | { |
| 13577 | struct alc_spec *spec; |
| 13578 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13579 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13580 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13581 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13582 | if (spec == NULL) |
| 13583 | return -ENOMEM; |
| 13584 | |
| 13585 | codec->spec = spec; |
| 13586 | |
| 13587 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13588 | alc268_models, |
| 13589 | alc268_cfg_tbl); |
| 13590 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13591 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13592 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13593 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13594 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13595 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13596 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13597 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13598 | board_config = ALC268_AUTO; |
| 13599 | } |
| 13600 | |
| 13601 | if (board_config == ALC268_AUTO) { |
| 13602 | /* automatic parse from the BIOS config */ |
| 13603 | err = alc268_parse_auto_config(codec); |
| 13604 | if (err < 0) { |
| 13605 | alc_free(codec); |
| 13606 | return err; |
| 13607 | } else if (!err) { |
| 13608 | printk(KERN_INFO |
| 13609 | "hda_codec: Cannot set up configuration " |
| 13610 | "from BIOS. Using base mode...\n"); |
| 13611 | board_config = ALC268_3ST; |
| 13612 | } |
| 13613 | } |
| 13614 | |
| 13615 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13616 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13617 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13618 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13619 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13620 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13621 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13622 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13623 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13624 | has_beep = 0; |
| 13625 | for (i = 0; i < spec->num_mixers; i++) { |
| 13626 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13627 | has_beep = 1; |
| 13628 | break; |
| 13629 | } |
| 13630 | } |
| 13631 | |
| 13632 | if (has_beep) { |
| 13633 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13634 | if (err < 0) { |
| 13635 | alc_free(codec); |
| 13636 | return err; |
| 13637 | } |
| 13638 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13639 | /* override the amp caps for beep generator */ |
| 13640 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13641 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13642 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13643 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13644 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13645 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13646 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13647 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13648 | /* check whether NID 0x07 is valid */ |
| 13649 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13650 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13651 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13652 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13653 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13654 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13655 | if (spec->auto_mic || |
| 13656 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13657 | spec->adc_nids = alc268_adc_nids_alt; |
| 13658 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13659 | if (spec->auto_mic) |
| 13660 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13661 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13662 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13663 | else |
| 13664 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13665 | } else { |
| 13666 | spec->adc_nids = alc268_adc_nids; |
| 13667 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13668 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13669 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13670 | /* set default input source */ |
| 13671 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13672 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13673 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13674 | i < spec->num_mux_defs ? |
| 13675 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13676 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13677 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13678 | |
| 13679 | spec->vmaster_nid = 0x02; |
| 13680 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13681 | codec->patch_ops = alc_patch_ops; |
| 13682 | if (board_config == ALC268_AUTO) |
| 13683 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13684 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13685 | return 0; |
| 13686 | } |
| 13687 | |
| 13688 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13689 | * ALC269 channel source setting (2 channel) |
| 13690 | */ |
| 13691 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13692 | |
| 13693 | #define alc269_dac_nids alc260_dac_nids |
| 13694 | |
| 13695 | static hda_nid_t alc269_adc_nids[1] = { |
| 13696 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13697 | 0x08, |
| 13698 | }; |
| 13699 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13700 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13701 | 0x23, |
| 13702 | }; |
| 13703 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13704 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13705 | /* ADC1 */ |
| 13706 | 0x09, |
| 13707 | }; |
| 13708 | |
| 13709 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13710 | 0x22, |
| 13711 | }; |
| 13712 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13713 | static hda_nid_t alc269_adc_candidates[] = { |
| 13714 | 0x08, 0x09, 0x07, |
| 13715 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13716 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13717 | #define alc269_modes alc260_modes |
| 13718 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13719 | |
| 13720 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13721 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13722 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13723 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13724 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13725 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13726 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13728 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13729 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13730 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13731 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13732 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13733 | { } /* end */ |
| 13734 | }; |
| 13735 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13736 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13737 | /* output mixer control */ |
| 13738 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13739 | { |
| 13740 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13741 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13742 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13743 | .info = snd_hda_mixer_amp_switch_info, |
| 13744 | .get = snd_hda_mixer_amp_switch_get, |
| 13745 | .put = alc268_acer_master_sw_put, |
| 13746 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13747 | }, |
| 13748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13750 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13751 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13752 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13753 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13754 | { } |
| 13755 | }; |
| 13756 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13757 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13758 | /* output mixer control */ |
| 13759 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13760 | { |
| 13761 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13762 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13763 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13764 | .info = snd_hda_mixer_amp_switch_info, |
| 13765 | .get = snd_hda_mixer_amp_switch_get, |
| 13766 | .put = alc268_acer_master_sw_put, |
| 13767 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13768 | }, |
| 13769 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13771 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13772 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13773 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13774 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13775 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13776 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13777 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13778 | { } |
| 13779 | }; |
| 13780 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13781 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13782 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13783 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13785 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13786 | { } /* end */ |
| 13787 | }; |
| 13788 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13789 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13790 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13791 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13792 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13793 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13794 | { } /* end */ |
| 13795 | }; |
| 13796 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13797 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13798 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13799 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13800 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13801 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13802 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13803 | { } /* end */ |
| 13804 | }; |
| 13805 | |
| 13806 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13807 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13808 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13810 | { } /* end */ |
| 13811 | }; |
| 13812 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13813 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13814 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13815 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13816 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13817 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13818 | { } /* end */ |
| 13819 | }; |
| 13820 | |
| 13821 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13822 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13823 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13824 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13825 | { } /* end */ |
| 13826 | }; |
| 13827 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13828 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13829 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13830 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13831 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13832 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13833 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13835 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13836 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13837 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13838 | { } |
| 13839 | }; |
| 13840 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13841 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13842 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13843 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13844 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13846 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13847 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13848 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13849 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13850 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13851 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13852 | { } |
| 13853 | }; |
| 13854 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13855 | /* toggle speaker-output according to the hp-jack state */ |
| 13856 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13857 | { |
| 13858 | unsigned int present; |
| 13859 | unsigned char bits; |
| 13860 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13861 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13862 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13863 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13864 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13865 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13866 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13867 | |
| 13868 | snd_hda_codec_write(codec, 0x20, 0, |
| 13869 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13870 | snd_hda_codec_write(codec, 0x20, 0, |
| 13871 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13872 | |
| 13873 | snd_hda_codec_write(codec, 0x20, 0, |
| 13874 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13875 | snd_hda_codec_write(codec, 0x20, 0, |
| 13876 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13877 | } |
| 13878 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13879 | /* toggle speaker-output according to the hp-jacks state */ |
| 13880 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13881 | { |
| 13882 | unsigned int present; |
| 13883 | unsigned char bits; |
| 13884 | |
| 13885 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13886 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13887 | |
| 13888 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13889 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13890 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13891 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13892 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13893 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13894 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13895 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13896 | |
| 13897 | snd_hda_codec_write(codec, 0x20, 0, |
| 13898 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13899 | snd_hda_codec_write(codec, 0x20, 0, |
| 13900 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13901 | |
| 13902 | snd_hda_codec_write(codec, 0x20, 0, |
| 13903 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13904 | snd_hda_codec_write(codec, 0x20, 0, |
| 13905 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13906 | } |
| 13907 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13908 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13909 | { |
| 13910 | unsigned int present_laptop; |
| 13911 | unsigned int present_dock; |
| 13912 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13913 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13914 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13915 | |
| 13916 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13917 | if (present_dock) |
| 13918 | snd_hda_codec_write(codec, 0x23, 0, |
| 13919 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13920 | if (present_laptop) |
| 13921 | snd_hda_codec_write(codec, 0x23, 0, |
| 13922 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13923 | if (!present_dock && !present_laptop) |
| 13924 | snd_hda_codec_write(codec, 0x23, 0, |
| 13925 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13926 | } |
| 13927 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13928 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13929 | unsigned int res) |
| 13930 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13931 | switch (res >> 26) { |
| 13932 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13933 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13934 | break; |
| 13935 | case ALC880_MIC_EVENT: |
| 13936 | alc_mic_automute(codec); |
| 13937 | break; |
| 13938 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13939 | } |
| 13940 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13941 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13942 | unsigned int res) |
| 13943 | { |
| 13944 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13945 | alc269_lifebook_speaker_automute(codec); |
| 13946 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13947 | alc269_lifebook_mic_autoswitch(codec); |
| 13948 | } |
| 13949 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13950 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13951 | { |
| 13952 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13953 | spec->autocfg.hp_pins[0] = 0x15; |
| 13954 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13955 | spec->ext_mic.pin = 0x18; |
| 13956 | spec->ext_mic.mux_idx = 0; |
| 13957 | spec->int_mic.pin = 0x19; |
| 13958 | spec->int_mic.mux_idx = 1; |
| 13959 | spec->auto_mic = 1; |
| 13960 | } |
| 13961 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13962 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13963 | { |
| 13964 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13965 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13966 | } |
| 13967 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13968 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13969 | { |
| 13970 | alc269_lifebook_speaker_automute(codec); |
| 13971 | alc269_lifebook_mic_autoswitch(codec); |
| 13972 | } |
| 13973 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13974 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13976 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13977 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13978 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13979 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13980 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13981 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13982 | {} |
| 13983 | }; |
| 13984 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13985 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13986 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13987 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13988 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13989 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13990 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13991 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13992 | {} |
| 13993 | }; |
| 13994 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13995 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13996 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13997 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13998 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13999 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14000 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14001 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14002 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14003 | {} |
| 14004 | }; |
| 14005 | |
| 14006 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 14007 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14008 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14009 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 14010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 14011 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14012 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 14013 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14014 | {} |
| 14015 | }; |
| 14016 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14017 | /* toggle speaker-output according to the hp-jack state */ |
| 14018 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 14019 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14020 | struct alc_spec *spec = codec->spec; |
| 14021 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14022 | unsigned int present; |
| 14023 | unsigned char bits; |
| 14024 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 14025 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14026 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14027 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14028 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14029 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 14030 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14031 | } |
| 14032 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14033 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14034 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14035 | unsigned int res) |
| 14036 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14037 | switch (res >> 26) { |
| 14038 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14039 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14040 | break; |
| 14041 | case ALC880_MIC_EVENT: |
| 14042 | alc_mic_automute(codec); |
| 14043 | break; |
| 14044 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14045 | } |
| 14046 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14047 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 14048 | { |
| 14049 | struct alc_spec *spec = codec->spec; |
| 14050 | spec->autocfg.hp_pins[0] = 0x15; |
| 14051 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14052 | spec->ext_mic.pin = 0x18; |
| 14053 | spec->ext_mic.mux_idx = 0; |
| 14054 | spec->int_mic.pin = 0x19; |
| 14055 | spec->int_mic.mux_idx = 1; |
| 14056 | spec->auto_mic = 1; |
| 14057 | } |
| 14058 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14059 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14060 | { |
| 14061 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14062 | spec->autocfg.hp_pins[0] = 0x15; |
| 14063 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14064 | spec->ext_mic.pin = 0x18; |
| 14065 | spec->ext_mic.mux_idx = 0; |
| 14066 | spec->int_mic.pin = 0x12; |
| 14067 | spec->int_mic.mux_idx = 5; |
| 14068 | spec->auto_mic = 1; |
| 14069 | } |
| 14070 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14071 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14072 | { |
| 14073 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14074 | spec->autocfg.hp_pins[0] = 0x21; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 14075 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14076 | spec->ext_mic.pin = 0x18; |
| 14077 | spec->ext_mic.mux_idx = 0; |
| 14078 | spec->int_mic.pin = 0x19; |
| 14079 | spec->int_mic.mux_idx = 1; |
| 14080 | spec->auto_mic = 1; |
| 14081 | } |
| 14082 | |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14083 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 14084 | { |
| 14085 | struct alc_spec *spec = codec->spec; |
| 14086 | spec->autocfg.hp_pins[0] = 0x21; |
| 14087 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14088 | spec->ext_mic.pin = 0x18; |
| 14089 | spec->ext_mic.mux_idx = 0; |
| 14090 | spec->int_mic.pin = 0x12; |
| 14091 | spec->int_mic.mux_idx = 6; |
| 14092 | spec->auto_mic = 1; |
| 14093 | } |
| 14094 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14095 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14096 | { |
| 14097 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14098 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14099 | } |
| 14100 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14101 | /* |
| 14102 | * generic initialization of ADC, input mixers and output mixers |
| 14103 | */ |
| 14104 | static struct hda_verb alc269_init_verbs[] = { |
| 14105 | /* |
| 14106 | * Unmute ADC0 and set the default input to mic-in |
| 14107 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14108 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14109 | |
| 14110 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14111 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14112 | */ |
| 14113 | /* set vol=0 to output mixers */ |
| 14114 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14115 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14116 | |
| 14117 | /* set up input amps for analog loopback */ |
| 14118 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14119 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14121 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14123 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14125 | |
| 14126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14128 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14129 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14130 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14131 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14132 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14133 | |
| 14134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14135 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14136 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14137 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14138 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14139 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14140 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14141 | |
| 14142 | /* set EAPD */ |
| 14143 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14144 | { } |
| 14145 | }; |
| 14146 | |
| 14147 | static struct hda_verb alc269vb_init_verbs[] = { |
| 14148 | /* |
| 14149 | * Unmute ADC0 and set the default input to mic-in |
| 14150 | */ |
| 14151 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14152 | |
| 14153 | /* |
| 14154 | * Set up output mixers (0x02 - 0x03) |
| 14155 | */ |
| 14156 | /* set vol=0 to output mixers */ |
| 14157 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14158 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14159 | |
| 14160 | /* set up input amps for analog loopback */ |
| 14161 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14162 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14163 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14164 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14165 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14166 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14167 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14168 | |
| 14169 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14170 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14172 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14173 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14174 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14176 | |
| 14177 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14178 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14179 | |
| 14180 | /* FIXME: use Mux-type input source selection */ |
| 14181 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 14182 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 14183 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14184 | |
| 14185 | /* set EAPD */ |
| 14186 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14187 | { } |
| 14188 | }; |
| 14189 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 14190 | #define alc269_auto_create_multi_out_ctls \ |
| 14191 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14192 | #define alc269_auto_create_input_ctls \ |
| 14193 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14194 | |
| 14195 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14196 | #define alc269_loopbacks alc880_loopbacks |
| 14197 | #endif |
| 14198 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14199 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14200 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 14201 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 14202 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 14203 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 14204 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14205 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 14206 | .substreams = 1, |
| 14207 | .channels_min = 2, |
| 14208 | .channels_max = 8, |
| 14209 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14210 | /* NID is set in alc_build_pcms */ |
| 14211 | .ops = { |
| 14212 | .open = alc880_playback_pcm_open, |
| 14213 | .prepare = alc880_playback_pcm_prepare, |
| 14214 | .cleanup = alc880_playback_pcm_cleanup |
| 14215 | }, |
| 14216 | }; |
| 14217 | |
| 14218 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 14219 | .substreams = 1, |
| 14220 | .channels_min = 2, |
| 14221 | .channels_max = 2, |
| 14222 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 14223 | /* NID is set in alc_build_pcms */ |
| 14224 | }; |
| 14225 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14226 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14227 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 14228 | { |
| 14229 | switch (codec->subsystem_id) { |
| 14230 | case 0x103c1586: |
| 14231 | return 1; |
| 14232 | } |
| 14233 | return 0; |
| 14234 | } |
| 14235 | |
| 14236 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14237 | { |
| 14238 | /* update mute-LED according to the speaker mute state */ |
| 14239 | if (nid == 0x01 || nid == 0x14) { |
| 14240 | int pinval; |
| 14241 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14242 | HDA_AMP_MUTE) |
| 14243 | pinval = 0x24; |
| 14244 | else |
| 14245 | pinval = 0x20; |
| 14246 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a54 | 2010-03-30 18:03:44 +0200 | [diff] [blame] | 14247 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14248 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14249 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14250 | } |
| 14251 | return alc_check_power_status(codec, nid); |
| 14252 | } |
| 14253 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14254 | |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14255 | static int alc275_setup_dual_adc(struct hda_codec *codec) |
| 14256 | { |
| 14257 | struct alc_spec *spec = codec->spec; |
| 14258 | |
| 14259 | if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic) |
| 14260 | return 0; |
| 14261 | if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) || |
| 14262 | (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) { |
| 14263 | if (spec->ext_mic.pin <= 0x12) { |
| 14264 | spec->private_adc_nids[0] = 0x08; |
| 14265 | spec->private_adc_nids[1] = 0x11; |
| 14266 | spec->private_capsrc_nids[0] = 0x23; |
| 14267 | spec->private_capsrc_nids[1] = 0x22; |
| 14268 | } else { |
| 14269 | spec->private_adc_nids[0] = 0x11; |
| 14270 | spec->private_adc_nids[1] = 0x08; |
| 14271 | spec->private_capsrc_nids[0] = 0x22; |
| 14272 | spec->private_capsrc_nids[1] = 0x23; |
| 14273 | } |
| 14274 | spec->adc_nids = spec->private_adc_nids; |
| 14275 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 14276 | spec->num_adc_nids = 2; |
| 14277 | spec->dual_adc_switch = 1; |
| 14278 | snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n", |
| 14279 | spec->adc_nids[0], spec->adc_nids[1]); |
| 14280 | return 1; |
| 14281 | } |
| 14282 | return 0; |
| 14283 | } |
| 14284 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14285 | /* |
| 14286 | * BIOS auto configuration |
| 14287 | */ |
| 14288 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14289 | { |
| 14290 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14291 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14292 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14293 | |
| 14294 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14295 | alc269_ignore); |
| 14296 | if (err < 0) |
| 14297 | return err; |
| 14298 | |
| 14299 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14300 | if (err < 0) |
| 14301 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14302 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14303 | if (err < 0) |
| 14304 | return err; |
| 14305 | |
| 14306 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14307 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14308 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14309 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14310 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14311 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14312 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14313 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14314 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14315 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14316 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14317 | } else { |
| 14318 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14319 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14320 | } |
| 14321 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14322 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14323 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14324 | |
| 14325 | if (!alc275_setup_dual_adc(codec)) |
| 14326 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14327 | sizeof(alc269_adc_candidates)); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14328 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14329 | /* set default input source */ |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14330 | if (!spec->dual_adc_switch) |
| 14331 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14332 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14333 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14334 | |
| 14335 | err = alc_auto_add_mic_boost(codec); |
| 14336 | if (err < 0) |
| 14337 | return err; |
| 14338 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14339 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14340 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14341 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14342 | return 1; |
| 14343 | } |
| 14344 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14345 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14346 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14347 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14348 | |
| 14349 | |
| 14350 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14351 | static void alc269_auto_init(struct hda_codec *codec) |
| 14352 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14353 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14354 | alc269_auto_init_multi_out(codec); |
| 14355 | alc269_auto_init_hp_out(codec); |
| 14356 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14357 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14358 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14359 | } |
| 14360 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14361 | enum { |
| 14362 | ALC269_FIXUP_SONY_VAIO, |
| 14363 | }; |
| 14364 | |
Tobias Klauser | fbc2566 | 2010-05-20 10:40:55 +0200 | [diff] [blame] | 14365 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14366 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, |
| 14367 | {} |
| 14368 | }; |
| 14369 | |
| 14370 | static const struct alc_fixup alc269_fixups[] = { |
| 14371 | [ALC269_FIXUP_SONY_VAIO] = { |
| 14372 | .verbs = alc269_sony_vaio_fixup_verbs |
| 14373 | }, |
| 14374 | }; |
| 14375 | |
| 14376 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
| 14377 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 14378 | {} |
| 14379 | }; |
| 14380 | |
| 14381 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14382 | /* |
| 14383 | * configuration and preset |
| 14384 | */ |
| 14385 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14386 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14387 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14388 | [ALC269_AMIC] = "laptop-amic", |
| 14389 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14390 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14391 | [ALC269_LIFEBOOK] = "lifebook", |
| 14392 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14393 | }; |
| 14394 | |
| 14395 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14396 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14397 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14398 | ALC269_AMIC), |
| 14399 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14400 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14401 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14402 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14403 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14404 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14405 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14406 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14407 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14408 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14409 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14410 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14411 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14412 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14413 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14414 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14415 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14416 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14417 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14418 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14419 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14420 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14421 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14422 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14423 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14424 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14425 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14426 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14427 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14428 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14429 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14430 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14431 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14432 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14433 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14434 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14435 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14436 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14437 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14438 | ALC269_DMIC), |
| 14439 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14440 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14441 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14442 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14443 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14444 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14445 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14446 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14447 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14448 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14449 | {} |
| 14450 | }; |
| 14451 | |
| 14452 | static struct alc_config_preset alc269_presets[] = { |
| 14453 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14454 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14455 | .init_verbs = { alc269_init_verbs }, |
| 14456 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14457 | .dac_nids = alc269_dac_nids, |
| 14458 | .hp_nid = 0x03, |
| 14459 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14460 | .channel_mode = alc269_modes, |
| 14461 | .input_mux = &alc269_capture_source, |
| 14462 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14463 | [ALC269_QUANTA_FL1] = { |
| 14464 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14465 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14466 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14467 | .dac_nids = alc269_dac_nids, |
| 14468 | .hp_nid = 0x03, |
| 14469 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14470 | .channel_mode = alc269_modes, |
| 14471 | .input_mux = &alc269_capture_source, |
| 14472 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14473 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14474 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14475 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14476 | [ALC269_AMIC] = { |
| 14477 | .mixers = { alc269_laptop_mixer }, |
| 14478 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14479 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14480 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14481 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14482 | .dac_nids = alc269_dac_nids, |
| 14483 | .hp_nid = 0x03, |
| 14484 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14485 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14486 | .unsol_event = alc269_laptop_unsol_event, |
| 14487 | .setup = alc269_laptop_amic_setup, |
| 14488 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14489 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14490 | [ALC269_DMIC] = { |
| 14491 | .mixers = { alc269_laptop_mixer }, |
| 14492 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14493 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14494 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14495 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14496 | .dac_nids = alc269_dac_nids, |
| 14497 | .hp_nid = 0x03, |
| 14498 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14499 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14500 | .unsol_event = alc269_laptop_unsol_event, |
| 14501 | .setup = alc269_laptop_dmic_setup, |
| 14502 | .init_hook = alc269_laptop_inithook, |
| 14503 | }, |
| 14504 | [ALC269VB_AMIC] = { |
| 14505 | .mixers = { alc269vb_laptop_mixer }, |
| 14506 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14507 | .init_verbs = { alc269vb_init_verbs, |
| 14508 | alc269vb_laptop_amic_init_verbs }, |
| 14509 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14510 | .dac_nids = alc269_dac_nids, |
| 14511 | .hp_nid = 0x03, |
| 14512 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14513 | .channel_mode = alc269_modes, |
| 14514 | .unsol_event = alc269_laptop_unsol_event, |
Kailang Yang | 226b1ec | 2010-04-09 11:01:20 +0200 | [diff] [blame] | 14515 | .setup = alc269vb_laptop_amic_setup, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14516 | .init_hook = alc269_laptop_inithook, |
| 14517 | }, |
| 14518 | [ALC269VB_DMIC] = { |
| 14519 | .mixers = { alc269vb_laptop_mixer }, |
| 14520 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14521 | .init_verbs = { alc269vb_init_verbs, |
| 14522 | alc269vb_laptop_dmic_init_verbs }, |
| 14523 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14524 | .dac_nids = alc269_dac_nids, |
| 14525 | .hp_nid = 0x03, |
| 14526 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14527 | .channel_mode = alc269_modes, |
| 14528 | .unsol_event = alc269_laptop_unsol_event, |
| 14529 | .setup = alc269vb_laptop_dmic_setup, |
| 14530 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14531 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14532 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14533 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14534 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14535 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14536 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14537 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14538 | .dac_nids = alc269_dac_nids, |
| 14539 | .hp_nid = 0x03, |
| 14540 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14541 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14542 | .unsol_event = alc269_laptop_unsol_event, |
| 14543 | .setup = alc269_laptop_dmic_setup, |
| 14544 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14545 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14546 | [ALC269_LIFEBOOK] = { |
| 14547 | .mixers = { alc269_lifebook_mixer }, |
| 14548 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14549 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14550 | .dac_nids = alc269_dac_nids, |
| 14551 | .hp_nid = 0x03, |
| 14552 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14553 | .channel_mode = alc269_modes, |
| 14554 | .input_mux = &alc269_capture_source, |
| 14555 | .unsol_event = alc269_lifebook_unsol_event, |
| 14556 | .init_hook = alc269_lifebook_init_hook, |
| 14557 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14558 | }; |
| 14559 | |
| 14560 | static int patch_alc269(struct hda_codec *codec) |
| 14561 | { |
| 14562 | struct alc_spec *spec; |
| 14563 | int board_config; |
| 14564 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14565 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14566 | |
| 14567 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14568 | if (spec == NULL) |
| 14569 | return -ENOMEM; |
| 14570 | |
| 14571 | codec->spec = spec; |
| 14572 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14573 | alc_auto_parse_customize_define(codec); |
| 14574 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14575 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14576 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14577 | spec->cdefine.platform_type == 1) |
| 14578 | alc_codec_rename(codec, "ALC271X"); |
| 14579 | else |
| 14580 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14581 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14582 | } else |
| 14583 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14584 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14585 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14586 | alc269_models, |
| 14587 | alc269_cfg_tbl); |
| 14588 | |
| 14589 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14590 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14591 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14592 | board_config = ALC269_AUTO; |
| 14593 | } |
| 14594 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14595 | if (board_config == ALC269_AUTO) |
| 14596 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); |
| 14597 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14598 | if (board_config == ALC269_AUTO) { |
| 14599 | /* automatic parse from the BIOS config */ |
| 14600 | err = alc269_parse_auto_config(codec); |
| 14601 | if (err < 0) { |
| 14602 | alc_free(codec); |
| 14603 | return err; |
| 14604 | } else if (!err) { |
| 14605 | printk(KERN_INFO |
| 14606 | "hda_codec: Cannot set up configuration " |
| 14607 | "from BIOS. Using base mode...\n"); |
| 14608 | board_config = ALC269_BASIC; |
| 14609 | } |
| 14610 | } |
| 14611 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14612 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 14613 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14614 | if (err < 0) { |
| 14615 | alc_free(codec); |
| 14616 | return err; |
| 14617 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14618 | } |
| 14619 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14620 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14621 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14622 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14623 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14624 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14625 | * fix the sample rate of analog I/O to 44.1kHz |
| 14626 | */ |
| 14627 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14628 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 840b64c | 2010-07-13 22:49:01 +0200 | [diff] [blame] | 14629 | } else if (spec->dual_adc_switch) { |
| 14630 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14631 | /* switch ADC dynamically */ |
| 14632 | spec->stream_analog_capture = &dualmic_pcm_analog_capture; |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14633 | } else { |
| 14634 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14635 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14636 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14637 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14638 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14639 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14640 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14641 | if (!is_alc269vb) { |
| 14642 | spec->adc_nids = alc269_adc_nids; |
| 14643 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14644 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14645 | } else { |
| 14646 | spec->adc_nids = alc269vb_adc_nids; |
| 14647 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14648 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14649 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14650 | } |
| 14651 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14652 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14653 | set_capture_mixer(codec); |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 14654 | if (has_cdefine_beep(codec)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14655 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14656 | |
Takashi Iwai | ff818c2 | 2010-04-12 08:59:25 +0200 | [diff] [blame] | 14657 | if (board_config == ALC269_AUTO) |
| 14658 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); |
| 14659 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14660 | spec->vmaster_nid = 0x02; |
| 14661 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14662 | codec->patch_ops = alc_patch_ops; |
| 14663 | if (board_config == ALC269_AUTO) |
| 14664 | spec->init_hook = alc269_auto_init; |
| 14665 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14666 | if (!spec->loopback.amplist) |
| 14667 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14668 | if (alc269_mic2_for_mute_led(codec)) |
| 14669 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14670 | #endif |
| 14671 | |
| 14672 | return 0; |
| 14673 | } |
| 14674 | |
| 14675 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14676 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14677 | */ |
| 14678 | |
| 14679 | /* |
| 14680 | * set the path ways for 2 channel output |
| 14681 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14682 | */ |
| 14683 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14684 | /* set pin widget 1Ah (line in) for input */ |
| 14685 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14686 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14687 | * the vref |
| 14688 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14689 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14690 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14691 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14692 | #if 0 |
| 14693 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14694 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14695 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14696 | { } /* end */ |
| 14697 | }; |
| 14698 | /* |
| 14699 | * 6ch mode |
| 14700 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14701 | */ |
| 14702 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14703 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14704 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14705 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14706 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14707 | |
| 14708 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14709 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14710 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14711 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14712 | #if 0 |
| 14713 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14714 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14715 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14716 | { } /* end */ |
| 14717 | }; |
| 14718 | |
| 14719 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14720 | { 2, alc861_threestack_ch2_init }, |
| 14721 | { 6, alc861_threestack_ch6_init }, |
| 14722 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14723 | /* Set mic1 as input and unmute the mixer */ |
| 14724 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14725 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14726 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14727 | { } /* end */ |
| 14728 | }; |
| 14729 | /* Set mic1 as output and mute mixer */ |
| 14730 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14731 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14732 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14733 | { } /* end */ |
| 14734 | }; |
| 14735 | |
| 14736 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14737 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14738 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14739 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14740 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14741 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14742 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14743 | /* set pin widget 1Ah (line in) for input */ |
| 14744 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14745 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14746 | * the vref |
| 14747 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14748 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14749 | |
| 14750 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14751 | #if 0 |
| 14752 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14753 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14754 | #endif |
| 14755 | { } /* end */ |
| 14756 | }; |
| 14757 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14758 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14759 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14760 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14761 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14762 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14763 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14764 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14765 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14766 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14767 | |
| 14768 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14769 | #if 0 |
| 14770 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14771 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14772 | #endif |
| 14773 | { } /* end */ |
| 14774 | }; |
| 14775 | |
| 14776 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14777 | { 2, alc861_asus_ch2_init }, |
| 14778 | { 6, alc861_asus_ch6_init }, |
| 14779 | }; |
| 14780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14781 | /* patch-ALC861 */ |
| 14782 | |
| 14783 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14784 | /* output mixer control */ |
| 14785 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14786 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14787 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14788 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14789 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14790 | |
| 14791 | /*Input mixer control */ |
| 14792 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14793 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14794 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14795 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14796 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14797 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14798 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14801 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14802 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14803 | { } /* end */ |
| 14804 | }; |
| 14805 | |
| 14806 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14807 | /* output mixer control */ |
| 14808 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14809 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14810 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14811 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14812 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14813 | |
| 14814 | /* Input mixer control */ |
| 14815 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14816 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14817 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14818 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14819 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14820 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14821 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14822 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14823 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14826 | { |
| 14827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14828 | .name = "Channel Mode", |
| 14829 | .info = alc_ch_mode_info, |
| 14830 | .get = alc_ch_mode_get, |
| 14831 | .put = alc_ch_mode_put, |
| 14832 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14833 | }, |
| 14834 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14835 | }; |
| 14836 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14837 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14838 | /* output mixer control */ |
| 14839 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14842 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14843 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14844 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14845 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14846 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14847 | /* output mixer control */ |
| 14848 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14849 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14850 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14851 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14852 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14853 | |
| 14854 | /* Input mixer control */ |
| 14855 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14856 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14858 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14860 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14864 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14865 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14866 | { |
| 14867 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14868 | .name = "Channel Mode", |
| 14869 | .info = alc_ch_mode_info, |
| 14870 | .get = alc_ch_mode_get, |
| 14871 | .put = alc_ch_mode_put, |
| 14872 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14873 | }, |
| 14874 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14875 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14876 | |
| 14877 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14878 | /* output mixer control */ |
| 14879 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14880 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14881 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14882 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14883 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14884 | |
| 14885 | /* Input mixer control */ |
| 14886 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14887 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14888 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14889 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14890 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14891 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14892 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14893 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14894 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14895 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14896 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14897 | { |
| 14898 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14899 | .name = "Channel Mode", |
| 14900 | .info = alc_ch_mode_info, |
| 14901 | .get = alc_ch_mode_get, |
| 14902 | .put = alc_ch_mode_put, |
| 14903 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14904 | }, |
| 14905 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14906 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14907 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14908 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14909 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14910 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14911 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14912 | { } |
| 14913 | }; |
| 14914 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14915 | /* |
| 14916 | * generic initialization of ADC, input mixers and output mixers |
| 14917 | */ |
| 14918 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14919 | /* |
| 14920 | * Unmute ADC0 and set the default input to mic-in |
| 14921 | */ |
| 14922 | /* port-A for surround (rear panel) */ |
| 14923 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14924 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14925 | /* port-B for mic-in (rear panel) with vref */ |
| 14926 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14927 | /* port-C for line-in (rear panel) */ |
| 14928 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14929 | /* port-D for Front */ |
| 14930 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14931 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14932 | /* port-E for HP out (front panel) */ |
| 14933 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14934 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14935 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14936 | /* port-F for mic-in (front panel) with vref */ |
| 14937 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14938 | /* port-G for CLFE (rear panel) */ |
| 14939 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14940 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14941 | /* port-H for side (rear panel) */ |
| 14942 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14943 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14944 | /* CD-in */ |
| 14945 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14946 | /* route front mic to ADC1*/ |
| 14947 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14948 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14949 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14950 | /* Unmute DAC0~3 & spdif out*/ |
| 14951 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14952 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14953 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14954 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14956 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14957 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14958 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14959 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14960 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14961 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14963 | /* Unmute Stereo Mixer 15 */ |
| 14964 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14965 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14967 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14968 | |
| 14969 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14970 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14971 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14972 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14973 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14974 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14975 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14977 | /* hp used DAC 3 (Front) */ |
| 14978 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14980 | |
| 14981 | { } |
| 14982 | }; |
| 14983 | |
| 14984 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14985 | /* |
| 14986 | * Unmute ADC0 and set the default input to mic-in |
| 14987 | */ |
| 14988 | /* port-A for surround (rear panel) */ |
| 14989 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14990 | /* port-B for mic-in (rear panel) with vref */ |
| 14991 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14992 | /* port-C for line-in (rear panel) */ |
| 14993 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14994 | /* port-D for Front */ |
| 14995 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14996 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14997 | /* port-E for HP out (front panel) */ |
| 14998 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14999 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15000 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15001 | /* port-F for mic-in (front panel) with vref */ |
| 15002 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15003 | /* port-G for CLFE (rear panel) */ |
| 15004 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15005 | /* port-H for side (rear panel) */ |
| 15006 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15007 | /* CD-in */ |
| 15008 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15009 | /* route front mic to ADC1*/ |
| 15010 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15011 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15012 | /* Unmute DAC0~3 & spdif out*/ |
| 15013 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15014 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15015 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15016 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15017 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15018 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15019 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15020 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15021 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15022 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15023 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15024 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15025 | /* Unmute Stereo Mixer 15 */ |
| 15026 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15027 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15028 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15029 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15030 | |
| 15031 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15032 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15033 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15034 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15035 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15036 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15037 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15038 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15039 | /* hp used DAC 3 (Front) */ |
| 15040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15041 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15042 | { } |
| 15043 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15044 | |
| 15045 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 15046 | /* |
| 15047 | * Unmute ADC0 and set the default input to mic-in |
| 15048 | */ |
| 15049 | /* port-A for surround (rear panel) */ |
| 15050 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15051 | /* port-B for mic-in (rear panel) with vref */ |
| 15052 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15053 | /* port-C for line-in (rear panel) */ |
| 15054 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15055 | /* port-D for Front */ |
| 15056 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15057 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15058 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15059 | /* this has to be set to VREF80 */ |
| 15060 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15061 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15062 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15063 | /* port-F for mic-in (front panel) with vref */ |
| 15064 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15065 | /* port-G for CLFE (rear panel) */ |
| 15066 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15067 | /* port-H for side (rear panel) */ |
| 15068 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15069 | /* CD-in */ |
| 15070 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15071 | /* route front mic to ADC1*/ |
| 15072 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15074 | /* Unmute DAC0~3 & spdif out*/ |
| 15075 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15076 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15077 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15078 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15080 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15081 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15082 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15083 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15084 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15085 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15086 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15087 | /* Unmute Stereo Mixer 15 */ |
| 15088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15092 | |
| 15093 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15094 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15095 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15096 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15097 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15098 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15099 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15100 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15101 | /* hp used DAC 3 (Front) */ |
| 15102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15103 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15104 | { } |
| 15105 | }; |
| 15106 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15107 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 15108 | /* |
| 15109 | * Unmute ADC0 and set the default input to mic-in |
| 15110 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15111 | /* port-A for surround (rear panel) |
| 15112 | * according to codec#0 this is the HP jack |
| 15113 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15114 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 15115 | /* route front PCM to HP */ |
| 15116 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15117 | /* port-B for mic-in (rear panel) with vref */ |
| 15118 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15119 | /* port-C for line-in (rear panel) */ |
| 15120 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15121 | /* port-D for Front */ |
| 15122 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15123 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 15124 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15125 | /* this has to be set to VREF80 */ |
| 15126 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15127 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 15128 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15129 | /* port-F for mic-in (front panel) with vref */ |
| 15130 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 15131 | /* port-G for CLFE (rear panel) */ |
| 15132 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15133 | /* port-H for side (rear panel) */ |
| 15134 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 15135 | /* CD-in */ |
| 15136 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 15137 | /* route front mic to ADC1*/ |
| 15138 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15139 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15140 | /* Unmute DAC0~3 & spdif out*/ |
| 15141 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15142 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15143 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15144 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15145 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15146 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15147 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15148 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15149 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15150 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15151 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15152 | /* Unmute Stereo Mixer 15 */ |
| 15153 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15154 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15155 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15156 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15157 | |
| 15158 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15159 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15160 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15161 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15162 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15163 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15164 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15165 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15166 | /* hp used DAC 3 (Front) */ |
| 15167 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15168 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15169 | { } |
| 15170 | }; |
| 15171 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15172 | /* additional init verbs for ASUS laptops */ |
| 15173 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 15174 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 15175 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 15176 | { } |
| 15177 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15179 | /* |
| 15180 | * generic initialization of ADC, input mixers and output mixers |
| 15181 | */ |
| 15182 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 15183 | /* |
| 15184 | * Unmute ADC0 and set the default input to mic-in |
| 15185 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15186 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15187 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15188 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15189 | /* Unmute DAC0~3 & spdif out*/ |
| 15190 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15191 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15192 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15193 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15194 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15195 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15196 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 15197 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15198 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15199 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15200 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15202 | /* Unmute Stereo Mixer 15 */ |
| 15203 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15204 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 15206 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 15207 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15208 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15209 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15210 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15211 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15212 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15213 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15215 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15216 | |
| 15217 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15218 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15219 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15220 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15221 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15222 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15223 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15224 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15225 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15226 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15227 | |
| 15228 | { } |
| 15229 | }; |
| 15230 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15231 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 15232 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15233 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15234 | { } |
| 15235 | }; |
| 15236 | |
| 15237 | /* toggle speaker-output according to the hp-jack state */ |
| 15238 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 15239 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15240 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15241 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15242 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 15243 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 15244 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 15245 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15246 | } |
| 15247 | |
| 15248 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 15249 | unsigned int res) |
| 15250 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15251 | if ((res >> 26) == ALC880_HP_EVENT) |
| 15252 | alc861_toshiba_automute(codec); |
| 15253 | } |
| 15254 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15255 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15256 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 15257 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 15258 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 15259 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 15260 | |
| 15261 | |
| 15262 | #define ALC861_DIGOUT_NID 0x07 |
| 15263 | |
| 15264 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 15265 | { 8, NULL } |
| 15266 | }; |
| 15267 | |
| 15268 | static hda_nid_t alc861_dac_nids[4] = { |
| 15269 | /* front, surround, clfe, side */ |
| 15270 | 0x03, 0x06, 0x05, 0x04 |
| 15271 | }; |
| 15272 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15273 | static hda_nid_t alc660_dac_nids[3] = { |
| 15274 | /* front, clfe, surround */ |
| 15275 | 0x03, 0x05, 0x06 |
| 15276 | }; |
| 15277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15278 | static hda_nid_t alc861_adc_nids[1] = { |
| 15279 | /* ADC0-2 */ |
| 15280 | 0x08, |
| 15281 | }; |
| 15282 | |
| 15283 | static struct hda_input_mux alc861_capture_source = { |
| 15284 | .num_items = 5, |
| 15285 | .items = { |
| 15286 | { "Mic", 0x0 }, |
| 15287 | { "Front Mic", 0x3 }, |
| 15288 | { "Line", 0x1 }, |
| 15289 | { "CD", 0x4 }, |
| 15290 | { "Mixer", 0x5 }, |
| 15291 | }, |
| 15292 | }; |
| 15293 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15294 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 15295 | { |
| 15296 | struct alc_spec *spec = codec->spec; |
| 15297 | hda_nid_t mix, srcs[5]; |
| 15298 | int i, j, num; |
| 15299 | |
| 15300 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15301 | return 0; |
| 15302 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15303 | if (num < 0) |
| 15304 | return 0; |
| 15305 | for (i = 0; i < num; i++) { |
| 15306 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15307 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15308 | if (type != AC_WID_AUD_OUT) |
| 15309 | continue; |
| 15310 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15311 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15312 | break; |
| 15313 | if (j >= spec->multiout.num_dacs) |
| 15314 | return srcs[i]; |
| 15315 | } |
| 15316 | return 0; |
| 15317 | } |
| 15318 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15319 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15320 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15321 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15322 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15323 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15324 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15325 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15326 | |
| 15327 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15328 | for (i = 0; i < cfg->line_outs; i++) { |
| 15329 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15330 | dac = alc861_look_for_dac(codec, nid); |
| 15331 | if (!dac) |
| 15332 | continue; |
| 15333 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15334 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15335 | return 0; |
| 15336 | } |
| 15337 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15338 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15339 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15340 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15341 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15342 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15343 | } |
| 15344 | |
| 15345 | /* add playback controls from the parsed DAC table */ |
| 15346 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15347 | const struct auto_pin_cfg *cfg) |
| 15348 | { |
| 15349 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15350 | static const char *chname[4] = { |
| 15351 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15352 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15353 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15354 | int i, err; |
| 15355 | |
| 15356 | if (cfg->line_outs == 1) { |
| 15357 | const char *pfx = NULL; |
| 15358 | if (!cfg->hp_outs) |
| 15359 | pfx = "Master"; |
| 15360 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15361 | pfx = "Speaker"; |
| 15362 | if (pfx) { |
| 15363 | nid = spec->multiout.dac_nids[0]; |
| 15364 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15365 | } |
| 15366 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15367 | |
| 15368 | for (i = 0; i < cfg->line_outs; i++) { |
| 15369 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15370 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15371 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15372 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15373 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15374 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15375 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15376 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15377 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15378 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15379 | return err; |
| 15380 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15381 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15382 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15383 | return err; |
| 15384 | } |
| 15385 | } |
| 15386 | return 0; |
| 15387 | } |
| 15388 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15389 | 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] | 15390 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15391 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15392 | int err; |
| 15393 | hda_nid_t nid; |
| 15394 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15395 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15396 | return 0; |
| 15397 | |
| 15398 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15399 | nid = alc861_look_for_dac(codec, pin); |
| 15400 | if (nid) { |
| 15401 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15402 | if (err < 0) |
| 15403 | return err; |
| 15404 | spec->multiout.hp_nid = nid; |
| 15405 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15406 | } |
| 15407 | return 0; |
| 15408 | } |
| 15409 | |
| 15410 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15411 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15412 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15413 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15414 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15415 | } |
| 15416 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15417 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15418 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15419 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15420 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15421 | hda_nid_t mix, srcs[5]; |
| 15422 | int i, num; |
| 15423 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15424 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15425 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15426 | 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] | 15427 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15428 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15429 | return; |
| 15430 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15431 | if (num < 0) |
| 15432 | return; |
| 15433 | for (i = 0; i < num; i++) { |
| 15434 | unsigned int mute; |
| 15435 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15436 | mute = AMP_IN_UNMUTE(i); |
| 15437 | else |
| 15438 | mute = AMP_IN_MUTE(i); |
| 15439 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15440 | mute); |
| 15441 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15442 | } |
| 15443 | |
| 15444 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15445 | { |
| 15446 | struct alc_spec *spec = codec->spec; |
| 15447 | int i; |
| 15448 | |
| 15449 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15450 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15451 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15452 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15453 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15454 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15455 | } |
| 15456 | } |
| 15457 | |
| 15458 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15459 | { |
| 15460 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15461 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15462 | if (spec->autocfg.hp_outs) |
| 15463 | alc861_auto_set_output_and_unmute(codec, |
| 15464 | spec->autocfg.hp_pins[0], |
| 15465 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15466 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15467 | if (spec->autocfg.speaker_outs) |
| 15468 | alc861_auto_set_output_and_unmute(codec, |
| 15469 | spec->autocfg.speaker_pins[0], |
| 15470 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15471 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15472 | } |
| 15473 | |
| 15474 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15475 | { |
| 15476 | struct alc_spec *spec = codec->spec; |
| 15477 | int i; |
| 15478 | |
| 15479 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15480 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15481 | if (nid >= 0x0c && nid <= 0x11) |
| 15482 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15483 | } |
| 15484 | } |
| 15485 | |
| 15486 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15487 | /* return 1 if successful, 0 if the proper config is not found, |
| 15488 | * or a negative error code |
| 15489 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15490 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15491 | { |
| 15492 | struct alc_spec *spec = codec->spec; |
| 15493 | int err; |
| 15494 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15495 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15496 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15497 | alc861_ignore); |
| 15498 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15499 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15500 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15501 | return 0; /* can't find valid BIOS pin config */ |
| 15502 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15503 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15504 | if (err < 0) |
| 15505 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15506 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15507 | if (err < 0) |
| 15508 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15509 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15510 | if (err < 0) |
| 15511 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15512 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15513 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15514 | return err; |
| 15515 | |
| 15516 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15517 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15518 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15519 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15520 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15521 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15522 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15523 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15524 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15525 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15526 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15527 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15528 | |
| 15529 | spec->adc_nids = alc861_adc_nids; |
| 15530 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15531 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15532 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15533 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15534 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15535 | return 1; |
| 15536 | } |
| 15537 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15538 | /* additional initialization for auto-configuration model */ |
| 15539 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15540 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15541 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15542 | alc861_auto_init_multi_out(codec); |
| 15543 | alc861_auto_init_hp_out(codec); |
| 15544 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15545 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15546 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15547 | } |
| 15548 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15549 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15550 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15551 | { 0x15, HDA_INPUT, 0 }, |
| 15552 | { 0x15, HDA_INPUT, 1 }, |
| 15553 | { 0x15, HDA_INPUT, 2 }, |
| 15554 | { 0x15, HDA_INPUT, 3 }, |
| 15555 | { } /* end */ |
| 15556 | }; |
| 15557 | #endif |
| 15558 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15559 | |
| 15560 | /* |
| 15561 | * configuration and preset |
| 15562 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15563 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15564 | [ALC861_3ST] = "3stack", |
| 15565 | [ALC660_3ST] = "3stack-660", |
| 15566 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15567 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15568 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15569 | [ALC861_TOSHIBA] = "toshiba", |
| 15570 | [ALC861_ASUS] = "asus", |
| 15571 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15572 | [ALC861_AUTO] = "auto", |
| 15573 | }; |
| 15574 | |
| 15575 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15576 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15577 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15578 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15579 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15580 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15581 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15582 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15583 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15584 | * Any other models that need this preset? |
| 15585 | */ |
| 15586 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15587 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15588 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15589 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15590 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15591 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15592 | /* FIXME: the below seems conflict */ |
| 15593 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15594 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15595 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15596 | {} |
| 15597 | }; |
| 15598 | |
| 15599 | static struct alc_config_preset alc861_presets[] = { |
| 15600 | [ALC861_3ST] = { |
| 15601 | .mixers = { alc861_3ST_mixer }, |
| 15602 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15603 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15604 | .dac_nids = alc861_dac_nids, |
| 15605 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15606 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15607 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15608 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15609 | .adc_nids = alc861_adc_nids, |
| 15610 | .input_mux = &alc861_capture_source, |
| 15611 | }, |
| 15612 | [ALC861_3ST_DIG] = { |
| 15613 | .mixers = { alc861_base_mixer }, |
| 15614 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15615 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15616 | .dac_nids = alc861_dac_nids, |
| 15617 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15618 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15619 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15620 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15621 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15622 | .adc_nids = alc861_adc_nids, |
| 15623 | .input_mux = &alc861_capture_source, |
| 15624 | }, |
| 15625 | [ALC861_6ST_DIG] = { |
| 15626 | .mixers = { alc861_base_mixer }, |
| 15627 | .init_verbs = { alc861_base_init_verbs }, |
| 15628 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15629 | .dac_nids = alc861_dac_nids, |
| 15630 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15631 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15632 | .channel_mode = alc861_8ch_modes, |
| 15633 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15634 | .adc_nids = alc861_adc_nids, |
| 15635 | .input_mux = &alc861_capture_source, |
| 15636 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15637 | [ALC660_3ST] = { |
| 15638 | .mixers = { alc861_3ST_mixer }, |
| 15639 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15640 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15641 | .dac_nids = alc660_dac_nids, |
| 15642 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15643 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15644 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15645 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15646 | .adc_nids = alc861_adc_nids, |
| 15647 | .input_mux = &alc861_capture_source, |
| 15648 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15649 | [ALC861_UNIWILL_M31] = { |
| 15650 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15651 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15652 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15653 | .dac_nids = alc861_dac_nids, |
| 15654 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15655 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15656 | .channel_mode = alc861_uniwill_m31_modes, |
| 15657 | .need_dac_fix = 1, |
| 15658 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15659 | .adc_nids = alc861_adc_nids, |
| 15660 | .input_mux = &alc861_capture_source, |
| 15661 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15662 | [ALC861_TOSHIBA] = { |
| 15663 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15664 | .init_verbs = { alc861_base_init_verbs, |
| 15665 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15666 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15667 | .dac_nids = alc861_dac_nids, |
| 15668 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15669 | .channel_mode = alc883_3ST_2ch_modes, |
| 15670 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15671 | .adc_nids = alc861_adc_nids, |
| 15672 | .input_mux = &alc861_capture_source, |
| 15673 | .unsol_event = alc861_toshiba_unsol_event, |
| 15674 | .init_hook = alc861_toshiba_automute, |
| 15675 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15676 | [ALC861_ASUS] = { |
| 15677 | .mixers = { alc861_asus_mixer }, |
| 15678 | .init_verbs = { alc861_asus_init_verbs }, |
| 15679 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15680 | .dac_nids = alc861_dac_nids, |
| 15681 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15682 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15683 | .channel_mode = alc861_asus_modes, |
| 15684 | .need_dac_fix = 1, |
| 15685 | .hp_nid = 0x06, |
| 15686 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15687 | .adc_nids = alc861_adc_nids, |
| 15688 | .input_mux = &alc861_capture_source, |
| 15689 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15690 | [ALC861_ASUS_LAPTOP] = { |
| 15691 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15692 | .init_verbs = { alc861_asus_init_verbs, |
| 15693 | alc861_asus_laptop_init_verbs }, |
| 15694 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15695 | .dac_nids = alc861_dac_nids, |
| 15696 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15697 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15698 | .channel_mode = alc883_3ST_2ch_modes, |
| 15699 | .need_dac_fix = 1, |
| 15700 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15701 | .adc_nids = alc861_adc_nids, |
| 15702 | .input_mux = &alc861_capture_source, |
| 15703 | }, |
| 15704 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15705 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15706 | /* Pin config fixes */ |
| 15707 | enum { |
| 15708 | PINFIX_FSC_AMILO_PI1505, |
| 15709 | }; |
| 15710 | |
| 15711 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15712 | { 0x0b, 0x0221101f }, /* HP */ |
| 15713 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15714 | { } |
| 15715 | }; |
| 15716 | |
| 15717 | static const struct alc_fixup alc861_fixups[] = { |
| 15718 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15719 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15720 | }, |
| 15721 | }; |
| 15722 | |
| 15723 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15724 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15725 | {} |
| 15726 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15727 | |
| 15728 | static int patch_alc861(struct hda_codec *codec) |
| 15729 | { |
| 15730 | struct alc_spec *spec; |
| 15731 | int board_config; |
| 15732 | int err; |
| 15733 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15734 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15735 | if (spec == NULL) |
| 15736 | return -ENOMEM; |
| 15737 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15738 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15739 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15740 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15741 | alc861_models, |
| 15742 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15743 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15744 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15745 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15746 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15747 | board_config = ALC861_AUTO; |
| 15748 | } |
| 15749 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15750 | if (board_config == ALC861_AUTO) |
| 15751 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15752 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15753 | if (board_config == ALC861_AUTO) { |
| 15754 | /* automatic parse from the BIOS config */ |
| 15755 | err = alc861_parse_auto_config(codec); |
| 15756 | if (err < 0) { |
| 15757 | alc_free(codec); |
| 15758 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15759 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15760 | printk(KERN_INFO |
| 15761 | "hda_codec: Cannot set up configuration " |
| 15762 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15763 | board_config = ALC861_3ST_DIG; |
| 15764 | } |
| 15765 | } |
| 15766 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15767 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15768 | if (err < 0) { |
| 15769 | alc_free(codec); |
| 15770 | return err; |
| 15771 | } |
| 15772 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15773 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15774 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15775 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15776 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15777 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15779 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15780 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15781 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15782 | if (!spec->cap_mixer) |
| 15783 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15784 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15785 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15786 | spec->vmaster_nid = 0x03; |
| 15787 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 15788 | if (board_config == ALC861_AUTO) |
| 15789 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); |
| 15790 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15791 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15792 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15793 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15794 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15795 | spec->power_hook = alc_power_eapd; |
| 15796 | #endif |
| 15797 | } |
| 15798 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15799 | if (!spec->loopback.amplist) |
| 15800 | spec->loopback.amplist = alc861_loopbacks; |
| 15801 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15802 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15803 | return 0; |
| 15804 | } |
| 15805 | |
| 15806 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15807 | * ALC861-VD support |
| 15808 | * |
| 15809 | * Based on ALC882 |
| 15810 | * |
| 15811 | * In addition, an independent DAC |
| 15812 | */ |
| 15813 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15814 | |
| 15815 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15816 | /* front, surr, clfe, side surr */ |
| 15817 | 0x02, 0x03, 0x04, 0x05 |
| 15818 | }; |
| 15819 | |
| 15820 | /* dac_nids for ALC660vd are in a different order - according to |
| 15821 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15822 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15823 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15824 | * - and it is the same as in 861vd. |
| 15825 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15826 | */ |
| 15827 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15828 | /* front, rear, clfe, rear_surr */ |
| 15829 | 0x02, 0x04, 0x03 |
| 15830 | }; |
| 15831 | |
| 15832 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15833 | /* ADC0 */ |
| 15834 | 0x09, |
| 15835 | }; |
| 15836 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15837 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15838 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15839 | /* input MUX */ |
| 15840 | /* FIXME: should be a matrix-type input source selection */ |
| 15841 | static struct hda_input_mux alc861vd_capture_source = { |
| 15842 | .num_items = 4, |
| 15843 | .items = { |
| 15844 | { "Mic", 0x0 }, |
| 15845 | { "Front Mic", 0x1 }, |
| 15846 | { "Line", 0x2 }, |
| 15847 | { "CD", 0x4 }, |
| 15848 | }, |
| 15849 | }; |
| 15850 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15851 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15852 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15853 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15854 | { "Ext Mic", 0x0 }, |
| 15855 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15856 | }, |
| 15857 | }; |
| 15858 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15859 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15860 | .num_items = 2, |
| 15861 | .items = { |
| 15862 | { "Front Mic", 0x0 }, |
| 15863 | { "ATAPI Mic", 0x1 }, |
| 15864 | }, |
| 15865 | }; |
| 15866 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15867 | /* |
| 15868 | * 2ch mode |
| 15869 | */ |
| 15870 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15871 | { 2, NULL } |
| 15872 | }; |
| 15873 | |
| 15874 | /* |
| 15875 | * 6ch mode |
| 15876 | */ |
| 15877 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15878 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15879 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15880 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15881 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15882 | { } /* end */ |
| 15883 | }; |
| 15884 | |
| 15885 | /* |
| 15886 | * 8ch mode |
| 15887 | */ |
| 15888 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15889 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15890 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15891 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15892 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15893 | { } /* end */ |
| 15894 | }; |
| 15895 | |
| 15896 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15897 | { 6, alc861vd_6stack_ch6_init }, |
| 15898 | { 8, alc861vd_6stack_ch8_init }, |
| 15899 | }; |
| 15900 | |
| 15901 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15902 | { |
| 15903 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15904 | .name = "Channel Mode", |
| 15905 | .info = alc_ch_mode_info, |
| 15906 | .get = alc_ch_mode_get, |
| 15907 | .put = alc_ch_mode_put, |
| 15908 | }, |
| 15909 | { } /* end */ |
| 15910 | }; |
| 15911 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15912 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15913 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15914 | */ |
| 15915 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15917 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15918 | |
| 15919 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15920 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15921 | |
| 15922 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15923 | HDA_OUTPUT), |
| 15924 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15925 | HDA_OUTPUT), |
| 15926 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15927 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15928 | |
| 15929 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15930 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15931 | |
| 15932 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15933 | |
| 15934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15937 | |
| 15938 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15939 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15940 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15941 | |
| 15942 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15943 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15944 | |
| 15945 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15946 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15947 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15948 | { } /* end */ |
| 15949 | }; |
| 15950 | |
| 15951 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15952 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15953 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15954 | |
| 15955 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15956 | |
| 15957 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15958 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15959 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15960 | |
| 15961 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15964 | |
| 15965 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15966 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15967 | |
| 15968 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15969 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15970 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15971 | { } /* end */ |
| 15972 | }; |
| 15973 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15974 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15975 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15976 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15977 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15978 | |
| 15979 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15980 | |
| 15981 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15982 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15984 | |
| 15985 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15986 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15987 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15988 | |
| 15989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15990 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15991 | |
| 15992 | { } /* end */ |
| 15993 | }; |
| 15994 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15995 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15996 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15997 | */ |
| 15998 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15999 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16000 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16001 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16002 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16003 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16004 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16005 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16006 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16007 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16008 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16009 | { } /* end */ |
| 16010 | }; |
| 16011 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16012 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 16013 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 16014 | */ |
| 16015 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 16016 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16017 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16018 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16019 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 16020 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16021 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16022 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16023 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16024 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16025 | { } /* end */ |
| 16026 | }; |
| 16027 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16028 | /* |
| 16029 | * generic initialization of ADC, input mixers and output mixers |
| 16030 | */ |
| 16031 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 16032 | /* |
| 16033 | * Unmute ADC0 and set the default input to mic-in |
| 16034 | */ |
| 16035 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16036 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16037 | |
| 16038 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 16039 | * the analog-loopback mixer widget |
| 16040 | */ |
| 16041 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16047 | |
| 16048 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16049 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16053 | |
| 16054 | /* |
| 16055 | * Set up output mixers (0x02 - 0x05) |
| 16056 | */ |
| 16057 | /* set vol=0 to output mixers */ |
| 16058 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16059 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16060 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16061 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16062 | |
| 16063 | /* set up input amps for analog loopback */ |
| 16064 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 16065 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16067 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16068 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16069 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16070 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16071 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16072 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16073 | |
| 16074 | { } |
| 16075 | }; |
| 16076 | |
| 16077 | /* |
| 16078 | * 3-stack pin configuration: |
| 16079 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 16080 | */ |
| 16081 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 16082 | /* |
| 16083 | * Set pin mode and muting |
| 16084 | */ |
| 16085 | /* set front pin widgets 0x14 for output */ |
| 16086 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16087 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16088 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16089 | |
| 16090 | /* Mic (rear) pin: input vref at 80% */ |
| 16091 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16092 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16093 | /* Front Mic pin: input vref at 80% */ |
| 16094 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16095 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16096 | /* Line In pin: input */ |
| 16097 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16098 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16099 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16100 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16101 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16102 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16103 | /* CD pin widget for input */ |
| 16104 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16105 | |
| 16106 | { } |
| 16107 | }; |
| 16108 | |
| 16109 | /* |
| 16110 | * 6-stack pin configuration: |
| 16111 | */ |
| 16112 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 16113 | /* |
| 16114 | * Set pin mode and muting |
| 16115 | */ |
| 16116 | /* set front pin widgets 0x14 for output */ |
| 16117 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16118 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16119 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16120 | |
| 16121 | /* Rear Pin: output 1 (0x0d) */ |
| 16122 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16123 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16124 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16125 | /* CLFE Pin: output 2 (0x0e) */ |
| 16126 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16127 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16128 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 16129 | /* Side Pin: output 3 (0x0f) */ |
| 16130 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16131 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16132 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 16133 | |
| 16134 | /* Mic (rear) pin: input vref at 80% */ |
| 16135 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16137 | /* Front Mic pin: input vref at 80% */ |
| 16138 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16139 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16140 | /* Line In pin: input */ |
| 16141 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16142 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16143 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16144 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16146 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16147 | /* CD pin widget for input */ |
| 16148 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16149 | |
| 16150 | { } |
| 16151 | }; |
| 16152 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16153 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 16154 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16155 | { } |
| 16156 | }; |
| 16157 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16158 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 16159 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16160 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16161 | { } |
| 16162 | }; |
| 16163 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16164 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 16165 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16166 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16167 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 16168 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16169 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16170 | {} |
| 16171 | }; |
| 16172 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16173 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 16174 | { |
| 16175 | unsigned int present; |
| 16176 | unsigned char bits; |
| 16177 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16178 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16179 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16180 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16181 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 16182 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16183 | } |
| 16184 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16185 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16186 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16187 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16188 | spec->autocfg.hp_pins[0] = 0x1b; |
| 16189 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16190 | } |
| 16191 | |
| 16192 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 16193 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16194 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16195 | alc861vd_lenovo_mic_automute(codec); |
| 16196 | } |
| 16197 | |
| 16198 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 16199 | unsigned int res) |
| 16200 | { |
| 16201 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16202 | case ALC880_MIC_EVENT: |
| 16203 | alc861vd_lenovo_mic_automute(codec); |
| 16204 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16205 | default: |
| 16206 | alc_automute_amp_unsol_event(codec, res); |
| 16207 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16208 | } |
| 16209 | } |
| 16210 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16211 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 16212 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16213 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16214 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16215 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16216 | |
| 16217 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16218 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16219 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16220 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16221 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16222 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16223 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16224 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16225 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16226 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16227 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16228 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16230 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16231 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16232 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16233 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16234 | |
| 16235 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16236 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16237 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 16238 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16239 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16240 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16242 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16243 | |
| 16244 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16245 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 16248 | |
| 16249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16251 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16252 | |
| 16253 | { } /* end */ |
| 16254 | }; |
| 16255 | |
| 16256 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16257 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16258 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16259 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16260 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16261 | spec->autocfg.hp_pins[0] = 0x15; |
| 16262 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16263 | } |
| 16264 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16265 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16266 | #define alc861vd_loopbacks alc880_loopbacks |
| 16267 | #endif |
| 16268 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16269 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16270 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 16271 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 16272 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 16273 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 16274 | |
| 16275 | /* |
| 16276 | * configuration and preset |
| 16277 | */ |
| 16278 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 16279 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16280 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16281 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16282 | [ALC861VD_3ST] = "3stack", |
| 16283 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 16284 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16285 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16286 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 16287 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16288 | [ALC861VD_AUTO] = "auto", |
| 16289 | }; |
| 16290 | |
| 16291 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16292 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 16293 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 16294 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16295 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16296 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16297 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16298 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 16299 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 16300 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 16301 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16302 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16303 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16304 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16305 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16306 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16307 | {} |
| 16308 | }; |
| 16309 | |
| 16310 | static struct alc_config_preset alc861vd_presets[] = { |
| 16311 | [ALC660VD_3ST] = { |
| 16312 | .mixers = { alc861vd_3st_mixer }, |
| 16313 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16314 | alc861vd_3stack_init_verbs }, |
| 16315 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16316 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16317 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16318 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16319 | .input_mux = &alc861vd_capture_source, |
| 16320 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16321 | [ALC660VD_3ST_DIG] = { |
| 16322 | .mixers = { alc861vd_3st_mixer }, |
| 16323 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16324 | alc861vd_3stack_init_verbs }, |
| 16325 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16326 | .dac_nids = alc660vd_dac_nids, |
| 16327 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16328 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16329 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16330 | .input_mux = &alc861vd_capture_source, |
| 16331 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16332 | [ALC861VD_3ST] = { |
| 16333 | .mixers = { alc861vd_3st_mixer }, |
| 16334 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16335 | alc861vd_3stack_init_verbs }, |
| 16336 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16337 | .dac_nids = alc861vd_dac_nids, |
| 16338 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16339 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16340 | .input_mux = &alc861vd_capture_source, |
| 16341 | }, |
| 16342 | [ALC861VD_3ST_DIG] = { |
| 16343 | .mixers = { alc861vd_3st_mixer }, |
| 16344 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16345 | alc861vd_3stack_init_verbs }, |
| 16346 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16347 | .dac_nids = alc861vd_dac_nids, |
| 16348 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16349 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16350 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16351 | .input_mux = &alc861vd_capture_source, |
| 16352 | }, |
| 16353 | [ALC861VD_6ST_DIG] = { |
| 16354 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16355 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16356 | alc861vd_6stack_init_verbs }, |
| 16357 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16358 | .dac_nids = alc861vd_dac_nids, |
| 16359 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16360 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16361 | .channel_mode = alc861vd_6stack_modes, |
| 16362 | .input_mux = &alc861vd_capture_source, |
| 16363 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16364 | [ALC861VD_LENOVO] = { |
| 16365 | .mixers = { alc861vd_lenovo_mixer }, |
| 16366 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16367 | alc861vd_3stack_init_verbs, |
| 16368 | alc861vd_eapd_verbs, |
| 16369 | alc861vd_lenovo_unsol_verbs }, |
| 16370 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16371 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16372 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16373 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16374 | .input_mux = &alc861vd_capture_source, |
| 16375 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16376 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16377 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16378 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16379 | [ALC861VD_DALLAS] = { |
| 16380 | .mixers = { alc861vd_dallas_mixer }, |
| 16381 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16382 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16383 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16384 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16385 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16386 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16387 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16388 | .setup = alc861vd_dallas_setup, |
| 16389 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16390 | }, |
| 16391 | [ALC861VD_HP] = { |
| 16392 | .mixers = { alc861vd_hp_mixer }, |
| 16393 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16394 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16395 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16396 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16397 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16398 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16399 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16400 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16401 | .setup = alc861vd_dallas_setup, |
| 16402 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16403 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16404 | [ALC660VD_ASUS_V1S] = { |
| 16405 | .mixers = { alc861vd_lenovo_mixer }, |
| 16406 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16407 | alc861vd_3stack_init_verbs, |
| 16408 | alc861vd_eapd_verbs, |
| 16409 | alc861vd_lenovo_unsol_verbs }, |
| 16410 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16411 | .dac_nids = alc660vd_dac_nids, |
| 16412 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16413 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16414 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16415 | .input_mux = &alc861vd_capture_source, |
| 16416 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16417 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16418 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16419 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16420 | }; |
| 16421 | |
| 16422 | /* |
| 16423 | * BIOS auto configuration |
| 16424 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16425 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16426 | const struct auto_pin_cfg *cfg) |
| 16427 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16428 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16429 | } |
| 16430 | |
| 16431 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16432 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16433 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16434 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16435 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16436 | } |
| 16437 | |
| 16438 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16439 | { |
| 16440 | struct alc_spec *spec = codec->spec; |
| 16441 | int i; |
| 16442 | |
| 16443 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16444 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16445 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16446 | if (nid) |
| 16447 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16448 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16449 | } |
| 16450 | } |
| 16451 | |
| 16452 | |
| 16453 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16454 | { |
| 16455 | struct alc_spec *spec = codec->spec; |
| 16456 | hda_nid_t pin; |
| 16457 | |
| 16458 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16459 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16460 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16461 | pin = spec->autocfg.speaker_pins[0]; |
| 16462 | if (pin) |
| 16463 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16464 | } |
| 16465 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16466 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16467 | |
| 16468 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16469 | { |
| 16470 | struct alc_spec *spec = codec->spec; |
| 16471 | int i; |
| 16472 | |
| 16473 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16474 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16475 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16476 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16477 | if (nid != ALC861VD_PIN_CD_NID && |
| 16478 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16479 | snd_hda_codec_write(codec, nid, 0, |
| 16480 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16481 | AMP_OUT_MUTE); |
| 16482 | } |
| 16483 | } |
| 16484 | } |
| 16485 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16486 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16487 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16488 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16489 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16490 | |
| 16491 | /* add playback controls from the parsed DAC table */ |
| 16492 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16493 | * different NIDs for mute/unmute switch and volume control */ |
| 16494 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16495 | const struct auto_pin_cfg *cfg) |
| 16496 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16497 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16498 | hda_nid_t nid_v, nid_s; |
| 16499 | int i, err; |
| 16500 | |
| 16501 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16502 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16503 | continue; |
| 16504 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16505 | alc880_dac_to_idx( |
| 16506 | spec->multiout.dac_nids[i])); |
| 16507 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16508 | alc880_dac_to_idx( |
| 16509 | spec->multiout.dac_nids[i])); |
| 16510 | |
| 16511 | if (i == 2) { |
| 16512 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16513 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16514 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16515 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16516 | HDA_OUTPUT)); |
| 16517 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16518 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16519 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16520 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16521 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16522 | HDA_OUTPUT)); |
| 16523 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16524 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16525 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16526 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16527 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16528 | HDA_INPUT)); |
| 16529 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16530 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16531 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16532 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16533 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16534 | HDA_INPUT)); |
| 16535 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16536 | return err; |
| 16537 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16538 | const char *pfx; |
| 16539 | if (cfg->line_outs == 1 && |
| 16540 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16541 | if (!cfg->hp_pins) |
| 16542 | pfx = "Speaker"; |
| 16543 | else |
| 16544 | pfx = "PCM"; |
| 16545 | } else |
| 16546 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16547 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16548 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16549 | HDA_OUTPUT)); |
| 16550 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16551 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16552 | if (cfg->line_outs == 1 && |
| 16553 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16554 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16555 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16556 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16557 | HDA_INPUT)); |
| 16558 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16559 | return err; |
| 16560 | } |
| 16561 | } |
| 16562 | return 0; |
| 16563 | } |
| 16564 | |
| 16565 | /* add playback controls for speaker and HP outputs */ |
| 16566 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16567 | * different NIDs for mute/unmute switch and volume control */ |
| 16568 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16569 | hda_nid_t pin, const char *pfx) |
| 16570 | { |
| 16571 | hda_nid_t nid_v, nid_s; |
| 16572 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16573 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16574 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16575 | return 0; |
| 16576 | |
| 16577 | if (alc880_is_fixed_pin(pin)) { |
| 16578 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16579 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16580 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16581 | spec->multiout.hp_nid = nid_v; |
| 16582 | else |
| 16583 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16584 | /* control HP volume/switch on the output mixer amp */ |
| 16585 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16586 | alc880_fixed_pin_idx(pin)); |
| 16587 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16588 | alc880_fixed_pin_idx(pin)); |
| 16589 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16590 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16591 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16592 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16593 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16594 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16595 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16596 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16597 | return err; |
| 16598 | } else if (alc880_is_multi_pin(pin)) { |
| 16599 | /* set manual connection */ |
| 16600 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16601 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16602 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16603 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16604 | return err; |
| 16605 | } |
| 16606 | return 0; |
| 16607 | } |
| 16608 | |
| 16609 | /* parse the BIOS configuration and set up the alc_spec |
| 16610 | * return 1 if successful, 0 if the proper config is not found, |
| 16611 | * or a negative error code |
| 16612 | * Based on ALC880 version - had to change it to override |
| 16613 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16614 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16615 | { |
| 16616 | struct alc_spec *spec = codec->spec; |
| 16617 | int err; |
| 16618 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16619 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16620 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16621 | alc861vd_ignore); |
| 16622 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16623 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16624 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16625 | return 0; /* can't find valid BIOS pin config */ |
| 16626 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16627 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16628 | if (err < 0) |
| 16629 | return err; |
| 16630 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16631 | if (err < 0) |
| 16632 | return err; |
| 16633 | err = alc861vd_auto_create_extra_out(spec, |
| 16634 | spec->autocfg.speaker_pins[0], |
| 16635 | "Speaker"); |
| 16636 | if (err < 0) |
| 16637 | return err; |
| 16638 | err = alc861vd_auto_create_extra_out(spec, |
| 16639 | spec->autocfg.hp_pins[0], |
| 16640 | "Headphone"); |
| 16641 | if (err < 0) |
| 16642 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16643 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16644 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16645 | return err; |
| 16646 | |
| 16647 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16648 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16649 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16650 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16651 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16652 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16653 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16654 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16655 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16656 | |
| 16657 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16658 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16659 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16660 | err = alc_auto_add_mic_boost(codec); |
| 16661 | if (err < 0) |
| 16662 | return err; |
| 16663 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16664 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16665 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16666 | return 1; |
| 16667 | } |
| 16668 | |
| 16669 | /* additional initialization for auto-configuration model */ |
| 16670 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16671 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16672 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16673 | alc861vd_auto_init_multi_out(codec); |
| 16674 | alc861vd_auto_init_hp_out(codec); |
| 16675 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16676 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16677 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16678 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16679 | } |
| 16680 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16681 | enum { |
| 16682 | ALC660VD_FIX_ASUS_GPIO1 |
| 16683 | }; |
| 16684 | |
| 16685 | /* reset GPIO1 */ |
| 16686 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16687 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16688 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16689 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16690 | { } |
| 16691 | }; |
| 16692 | |
| 16693 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16694 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16695 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16696 | }, |
| 16697 | }; |
| 16698 | |
| 16699 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16700 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16701 | {} |
| 16702 | }; |
| 16703 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16704 | static int patch_alc861vd(struct hda_codec *codec) |
| 16705 | { |
| 16706 | struct alc_spec *spec; |
| 16707 | int err, board_config; |
| 16708 | |
| 16709 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16710 | if (spec == NULL) |
| 16711 | return -ENOMEM; |
| 16712 | |
| 16713 | codec->spec = spec; |
| 16714 | |
| 16715 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16716 | alc861vd_models, |
| 16717 | alc861vd_cfg_tbl); |
| 16718 | |
| 16719 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16720 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16721 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16722 | board_config = ALC861VD_AUTO; |
| 16723 | } |
| 16724 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16725 | if (board_config == ALC861VD_AUTO) |
| 16726 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16727 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16728 | if (board_config == ALC861VD_AUTO) { |
| 16729 | /* automatic parse from the BIOS config */ |
| 16730 | err = alc861vd_parse_auto_config(codec); |
| 16731 | if (err < 0) { |
| 16732 | alc_free(codec); |
| 16733 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16734 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16735 | printk(KERN_INFO |
| 16736 | "hda_codec: Cannot set up configuration " |
| 16737 | "from BIOS. Using base mode...\n"); |
| 16738 | board_config = ALC861VD_3ST; |
| 16739 | } |
| 16740 | } |
| 16741 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16742 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16743 | if (err < 0) { |
| 16744 | alc_free(codec); |
| 16745 | return err; |
| 16746 | } |
| 16747 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16748 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16749 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16750 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16751 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16752 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16753 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16754 | } |
| 16755 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16756 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16757 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16758 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16759 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16760 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16761 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16762 | if (!spec->adc_nids) { |
| 16763 | spec->adc_nids = alc861vd_adc_nids; |
| 16764 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16765 | } |
| 16766 | if (!spec->capsrc_nids) |
| 16767 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16768 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16769 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16770 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16771 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16772 | spec->vmaster_nid = 0x02; |
| 16773 | |
Takashi Iwai | 7fa90e8 | 2010-04-12 08:49:00 +0200 | [diff] [blame] | 16774 | if (board_config == ALC861VD_AUTO) |
| 16775 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); |
| 16776 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16777 | codec->patch_ops = alc_patch_ops; |
| 16778 | |
| 16779 | if (board_config == ALC861VD_AUTO) |
| 16780 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16781 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16782 | if (!spec->loopback.amplist) |
| 16783 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16784 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16785 | |
| 16786 | return 0; |
| 16787 | } |
| 16788 | |
| 16789 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16790 | * ALC662 support |
| 16791 | * |
| 16792 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16793 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16794 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16795 | * 6-channel independent captures. |
| 16796 | * |
| 16797 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16798 | * driver yet). |
| 16799 | */ |
| 16800 | #define ALC662_DIGOUT_NID 0x06 |
| 16801 | #define ALC662_DIGIN_NID 0x0a |
| 16802 | |
| 16803 | static hda_nid_t alc662_dac_nids[4] = { |
| 16804 | /* front, rear, clfe, rear_surr */ |
| 16805 | 0x02, 0x03, 0x04 |
| 16806 | }; |
| 16807 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16808 | static hda_nid_t alc272_dac_nids[2] = { |
| 16809 | 0x02, 0x03 |
| 16810 | }; |
| 16811 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16812 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16813 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16814 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16815 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16816 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16817 | static hda_nid_t alc272_adc_nids[1] = { |
| 16818 | /* ADC1-2 */ |
| 16819 | 0x08, |
| 16820 | }; |
| 16821 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16822 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16823 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16824 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16825 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16826 | /* input MUX */ |
| 16827 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16828 | static struct hda_input_mux alc662_capture_source = { |
| 16829 | .num_items = 4, |
| 16830 | .items = { |
| 16831 | { "Mic", 0x0 }, |
| 16832 | { "Front Mic", 0x1 }, |
| 16833 | { "Line", 0x2 }, |
| 16834 | { "CD", 0x4 }, |
| 16835 | }, |
| 16836 | }; |
| 16837 | |
| 16838 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16839 | .num_items = 2, |
| 16840 | .items = { |
| 16841 | { "Mic", 0x1 }, |
| 16842 | { "Line", 0x2 }, |
| 16843 | }, |
| 16844 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16845 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16846 | static struct hda_input_mux alc663_capture_source = { |
| 16847 | .num_items = 3, |
| 16848 | .items = { |
| 16849 | { "Mic", 0x0 }, |
| 16850 | { "Front Mic", 0x1 }, |
| 16851 | { "Line", 0x2 }, |
| 16852 | }, |
| 16853 | }; |
| 16854 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16855 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16856 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16857 | .num_items = 16, |
| 16858 | .items = { |
| 16859 | { "Autoselect Mic", 0x0 }, |
| 16860 | { "Internal Mic", 0x1 }, |
| 16861 | { "In-0x02", 0x2 }, |
| 16862 | { "In-0x03", 0x3 }, |
| 16863 | { "In-0x04", 0x4 }, |
| 16864 | { "In-0x05", 0x5 }, |
| 16865 | { "In-0x06", 0x6 }, |
| 16866 | { "In-0x07", 0x7 }, |
| 16867 | { "In-0x08", 0x8 }, |
| 16868 | { "In-0x09", 0x9 }, |
| 16869 | { "In-0x0a", 0x0a }, |
| 16870 | { "In-0x0b", 0x0b }, |
| 16871 | { "In-0x0c", 0x0c }, |
| 16872 | { "In-0x0d", 0x0d }, |
| 16873 | { "In-0x0e", 0x0e }, |
| 16874 | { "In-0x0f", 0x0f }, |
| 16875 | }, |
| 16876 | }; |
| 16877 | #endif |
| 16878 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16879 | /* |
| 16880 | * 2ch mode |
| 16881 | */ |
| 16882 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16883 | { 2, NULL } |
| 16884 | }; |
| 16885 | |
| 16886 | /* |
| 16887 | * 2ch mode |
| 16888 | */ |
| 16889 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16890 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16891 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16892 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16893 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16894 | { } /* end */ |
| 16895 | }; |
| 16896 | |
| 16897 | /* |
| 16898 | * 6ch mode |
| 16899 | */ |
| 16900 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16901 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16902 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16903 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16904 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16905 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16906 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16907 | { } /* end */ |
| 16908 | }; |
| 16909 | |
| 16910 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16911 | { 2, alc662_3ST_ch2_init }, |
| 16912 | { 6, alc662_3ST_ch6_init }, |
| 16913 | }; |
| 16914 | |
| 16915 | /* |
| 16916 | * 2ch mode |
| 16917 | */ |
| 16918 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16919 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16920 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16921 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16922 | { } /* end */ |
| 16923 | }; |
| 16924 | |
| 16925 | /* |
| 16926 | * 6ch mode |
| 16927 | */ |
| 16928 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16929 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16930 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16931 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16932 | { } /* end */ |
| 16933 | }; |
| 16934 | |
| 16935 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16936 | { 2, alc662_sixstack_ch6_init }, |
| 16937 | { 6, alc662_sixstack_ch8_init }, |
| 16938 | }; |
| 16939 | |
| 16940 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16941 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16942 | */ |
| 16943 | |
| 16944 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16945 | /* output mixer control */ |
| 16946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16947 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16948 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16949 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16950 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16951 | 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] | 16952 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16953 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16955 | |
| 16956 | /*Input mixer control */ |
| 16957 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16958 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16959 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16960 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16962 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16963 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16964 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16965 | { } /* end */ |
| 16966 | }; |
| 16967 | |
| 16968 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16969 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16970 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16980 | { } /* end */ |
| 16981 | }; |
| 16982 | |
| 16983 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16985 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16986 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16987 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16988 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16989 | 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] | 16990 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16991 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16992 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16993 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16994 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16999 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17001 | { } /* end */ |
| 17002 | }; |
| 17003 | |
| 17004 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 17005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17006 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 17007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17008 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17011 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17014 | { } /* end */ |
| 17015 | }; |
| 17016 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17017 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17018 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17019 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17020 | |
| 17021 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 17022 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17023 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17024 | |
| 17025 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17026 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17027 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17028 | { } /* end */ |
| 17029 | }; |
| 17030 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17031 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17032 | ALC262_HIPPO_MASTER_SWITCH, |
| 17033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17034 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17035 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 17036 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17037 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 17038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17040 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17041 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17042 | { } /* end */ |
| 17043 | }; |
| 17044 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17045 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 17046 | .ops = &snd_hda_bind_vol, |
| 17047 | .values = { |
| 17048 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17049 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 17050 | 0 |
| 17051 | }, |
| 17052 | }; |
| 17053 | |
| 17054 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 17055 | .ops = &snd_hda_bind_sw, |
| 17056 | .values = { |
| 17057 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17058 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17059 | 0 |
| 17060 | }, |
| 17061 | }; |
| 17062 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17063 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17064 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17065 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 17066 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17068 | { } /* end */ |
| 17069 | }; |
| 17070 | |
| 17071 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 17072 | .ops = &snd_hda_bind_sw, |
| 17073 | .values = { |
| 17074 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17075 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17076 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17077 | 0 |
| 17078 | }, |
| 17079 | }; |
| 17080 | |
| 17081 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 17082 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17083 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 17084 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17086 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17087 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17088 | |
| 17089 | { } /* end */ |
| 17090 | }; |
| 17091 | |
| 17092 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 17093 | .ops = &snd_hda_bind_sw, |
| 17094 | .values = { |
| 17095 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17096 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17097 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17098 | 0 |
| 17099 | }, |
| 17100 | }; |
| 17101 | |
| 17102 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 17103 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17104 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 17105 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17106 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17107 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17108 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17109 | { } /* end */ |
| 17110 | }; |
| 17111 | |
| 17112 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17113 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17114 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17115 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17116 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17117 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17118 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17119 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17120 | { } /* end */ |
| 17121 | }; |
| 17122 | |
| 17123 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 17124 | .ops = &snd_hda_bind_vol, |
| 17125 | .values = { |
| 17126 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 17127 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 17128 | 0 |
| 17129 | }, |
| 17130 | }; |
| 17131 | |
| 17132 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 17133 | .ops = &snd_hda_bind_sw, |
| 17134 | .values = { |
| 17135 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17136 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 17137 | 0 |
| 17138 | }, |
| 17139 | }; |
| 17140 | |
| 17141 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 17142 | HDA_BIND_VOL("Master Playback Volume", |
| 17143 | &alc663_asus_two_bind_master_vol), |
| 17144 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17145 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17146 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17148 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17149 | { } /* end */ |
| 17150 | }; |
| 17151 | |
| 17152 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 17153 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 17154 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 17155 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17156 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17157 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17158 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17159 | { } /* end */ |
| 17160 | }; |
| 17161 | |
| 17162 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 17163 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17164 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17165 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17166 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17167 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17168 | |
| 17169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17171 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17172 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17173 | { } /* end */ |
| 17174 | }; |
| 17175 | |
| 17176 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 17177 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17178 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17179 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17180 | |
| 17181 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17182 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17183 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17184 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17185 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 17186 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 17187 | { } /* end */ |
| 17188 | }; |
| 17189 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17190 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 17191 | .ops = &snd_hda_bind_sw, |
| 17192 | .values = { |
| 17193 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17194 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 17195 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17196 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 17197 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 17198 | 0 |
| 17199 | }, |
| 17200 | }; |
| 17201 | |
| 17202 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 17203 | .ops = &snd_hda_bind_sw, |
| 17204 | .values = { |
| 17205 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 17206 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 17207 | 0 |
| 17208 | }, |
| 17209 | }; |
| 17210 | |
| 17211 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 17212 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17213 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17214 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17215 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 17216 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17217 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17218 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17219 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17220 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17221 | { } /* end */ |
| 17222 | }; |
| 17223 | |
| 17224 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 17225 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 17226 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 17227 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 17228 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 17229 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17232 | { } /* end */ |
| 17233 | }; |
| 17234 | |
| 17235 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17236 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 17237 | { |
| 17238 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 17239 | .name = "Channel Mode", |
| 17240 | .info = alc_ch_mode_info, |
| 17241 | .get = alc_ch_mode_get, |
| 17242 | .put = alc_ch_mode_put, |
| 17243 | }, |
| 17244 | { } /* end */ |
| 17245 | }; |
| 17246 | |
| 17247 | static struct hda_verb alc662_init_verbs[] = { |
| 17248 | /* ADC: mute amp left and right */ |
| 17249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17250 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17251 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17252 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17253 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17254 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17255 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17256 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17257 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17258 | |
| 17259 | /* Front Pin: output 0 (0x0c) */ |
| 17260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17262 | |
| 17263 | /* Rear Pin: output 1 (0x0d) */ |
| 17264 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17265 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17266 | |
| 17267 | /* CLFE Pin: output 2 (0x0e) */ |
| 17268 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17269 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17270 | |
| 17271 | /* Mic (rear) pin: input vref at 80% */ |
| 17272 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17273 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17274 | /* Front Mic pin: input vref at 80% */ |
| 17275 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 17276 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17277 | /* Line In pin: input */ |
| 17278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17279 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17280 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 17281 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17282 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17283 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 17284 | /* CD pin widget for input */ |
| 17285 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17286 | |
| 17287 | /* FIXME: use matrix-type input source selection */ |
| 17288 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 17289 | /* Input mixer */ |
| 17290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17291 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17292 | |
| 17293 | /* always trun on EAPD */ |
| 17294 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17295 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 17296 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17297 | { } |
| 17298 | }; |
| 17299 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17300 | static struct hda_verb alc663_init_verbs[] = { |
| 17301 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17302 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17303 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17304 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17305 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17306 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17307 | { } |
| 17308 | }; |
| 17309 | |
| 17310 | static struct hda_verb alc272_init_verbs[] = { |
| 17311 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17312 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17313 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17314 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17315 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17316 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17318 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17319 | { } |
| 17320 | }; |
| 17321 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17322 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17323 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17324 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17325 | {} |
| 17326 | }; |
| 17327 | |
| 17328 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17329 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17330 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17331 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17332 | }; |
| 17333 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17334 | /* Set Unsolicited Event*/ |
| 17335 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17336 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17337 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17338 | {} |
| 17339 | }; |
| 17340 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17341 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17342 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17343 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17344 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17345 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17346 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17347 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17348 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17349 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17350 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17351 | {} |
| 17352 | }; |
| 17353 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17354 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17355 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17356 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17357 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17358 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17359 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17360 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17361 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17362 | {} |
| 17363 | }; |
| 17364 | |
| 17365 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17367 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17368 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17369 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17372 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17373 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17374 | {} |
| 17375 | }; |
| 17376 | |
| 17377 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17378 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17379 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17380 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17381 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17382 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17383 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17384 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17385 | {} |
| 17386 | }; |
| 17387 | |
| 17388 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17389 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17390 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17391 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17392 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17393 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17394 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17395 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17398 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17399 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17400 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17401 | {} |
| 17402 | }; |
| 17403 | |
| 17404 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17405 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17406 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17407 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17408 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17409 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17410 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17411 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17412 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17413 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17414 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17415 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17416 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17417 | {} |
| 17418 | }; |
| 17419 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17420 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17421 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17422 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17423 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17424 | |
| 17425 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17426 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17427 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17428 | |
| 17429 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17430 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17431 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17432 | {} |
| 17433 | }; |
| 17434 | |
| 17435 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17436 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17437 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17438 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17439 | |
| 17440 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17441 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17442 | {} |
| 17443 | }; |
| 17444 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17445 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17446 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17447 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17448 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17449 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17450 | {} |
| 17451 | }; |
| 17452 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17453 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17454 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17455 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17457 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17458 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17459 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17460 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17462 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17463 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17464 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17465 | {} |
| 17466 | }; |
| 17467 | |
| 17468 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17469 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17470 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17472 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17473 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17474 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17475 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17477 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17478 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17479 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17480 | {} |
| 17481 | }; |
| 17482 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17483 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17484 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17485 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17486 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17487 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17489 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17490 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17491 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17492 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17493 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17496 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17497 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17498 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17499 | {} |
| 17500 | }; |
| 17501 | |
| 17502 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17503 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17505 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17506 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17507 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17508 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17509 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17510 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17511 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17512 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17513 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17514 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17515 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17516 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17517 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17518 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17519 | {} |
| 17520 | }; |
| 17521 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17522 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17523 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17524 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17525 | { } /* end */ |
| 17526 | }; |
| 17527 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17528 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17529 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17530 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17531 | { } /* end */ |
| 17532 | }; |
| 17533 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17534 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17535 | { |
| 17536 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17537 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17538 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17539 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17540 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17541 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17542 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17543 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17544 | } |
| 17545 | |
| 17546 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17547 | { |
| 17548 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17549 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17550 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17551 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17552 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17553 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17554 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17555 | HDA_AMP_MUTE, bits); |
| 17556 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17557 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17558 | } |
| 17559 | |
| 17560 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17561 | unsigned int res) |
| 17562 | { |
| 17563 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17564 | alc662_lenovo_101e_all_automute(codec); |
| 17565 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17566 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17567 | } |
| 17568 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17569 | /* unsolicited event for HP jack sensing */ |
| 17570 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17571 | unsigned int res) |
| 17572 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17573 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17574 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17575 | else |
| 17576 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17577 | } |
| 17578 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17579 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17580 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17581 | struct alc_spec *spec = codec->spec; |
| 17582 | |
| 17583 | alc262_hippo1_setup(codec); |
| 17584 | spec->ext_mic.pin = 0x18; |
| 17585 | spec->ext_mic.mux_idx = 0; |
| 17586 | spec->int_mic.pin = 0x19; |
| 17587 | spec->int_mic.mux_idx = 1; |
| 17588 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17589 | } |
| 17590 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17591 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17592 | { |
| 17593 | alc262_hippo_automute(codec); |
| 17594 | alc_mic_automute(codec); |
| 17595 | } |
| 17596 | |
| 17597 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17598 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17599 | struct alc_spec *spec = codec->spec; |
| 17600 | |
| 17601 | spec->autocfg.hp_pins[0] = 0x14; |
| 17602 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17603 | } |
| 17604 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17605 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17606 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17607 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17608 | { |
| 17609 | unsigned int present; |
| 17610 | unsigned char bits; |
| 17611 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17612 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17613 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17614 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17615 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17616 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17617 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17618 | } |
| 17619 | |
| 17620 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17621 | { |
| 17622 | unsigned int present; |
| 17623 | unsigned char bits; |
| 17624 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17625 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17626 | bits = present ? HDA_AMP_MUTE : 0; |
| 17627 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17628 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17629 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17630 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17631 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17632 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17633 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17634 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17635 | } |
| 17636 | |
| 17637 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17638 | { |
| 17639 | unsigned int present; |
| 17640 | unsigned char bits; |
| 17641 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17642 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17643 | bits = present ? HDA_AMP_MUTE : 0; |
| 17644 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17645 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17646 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17647 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17648 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17649 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17650 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17651 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17652 | } |
| 17653 | |
| 17654 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17655 | { |
| 17656 | unsigned int present; |
| 17657 | unsigned char bits; |
| 17658 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17659 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17660 | bits = present ? 0 : PIN_OUT; |
| 17661 | snd_hda_codec_write(codec, 0x14, 0, |
| 17662 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17663 | } |
| 17664 | |
| 17665 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17666 | { |
| 17667 | unsigned int present1, present2; |
| 17668 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17669 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17670 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17671 | |
| 17672 | if (present1 || present2) { |
| 17673 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17674 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17675 | } else { |
| 17676 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17677 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17678 | } |
| 17679 | } |
| 17680 | |
| 17681 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17682 | { |
| 17683 | unsigned int present1, present2; |
| 17684 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17685 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17686 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17687 | |
| 17688 | if (present1 || present2) { |
| 17689 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17690 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17691 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17692 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17693 | } else { |
| 17694 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17695 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17696 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17697 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17698 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17699 | } |
| 17700 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17701 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17702 | { |
| 17703 | unsigned int present1, present2; |
| 17704 | |
| 17705 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17706 | AC_VERB_GET_PIN_SENSE, 0) |
| 17707 | & AC_PINSENSE_PRESENCE; |
| 17708 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17709 | AC_VERB_GET_PIN_SENSE, 0) |
| 17710 | & AC_PINSENSE_PRESENCE; |
| 17711 | |
| 17712 | if (present1 || present2) { |
| 17713 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17714 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17715 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17716 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17717 | } else { |
| 17718 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17719 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17720 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17721 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17722 | } |
| 17723 | } |
| 17724 | |
| 17725 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17726 | { |
| 17727 | unsigned int present1, present2; |
| 17728 | |
| 17729 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17730 | AC_VERB_GET_PIN_SENSE, 0) |
| 17731 | & AC_PINSENSE_PRESENCE; |
| 17732 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17733 | AC_VERB_GET_PIN_SENSE, 0) |
| 17734 | & AC_PINSENSE_PRESENCE; |
| 17735 | |
| 17736 | if (present1 || present2) { |
| 17737 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17738 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17739 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17740 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17741 | } else { |
| 17742 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17743 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17744 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17745 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17746 | } |
| 17747 | } |
| 17748 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17749 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17750 | unsigned int res) |
| 17751 | { |
| 17752 | switch (res >> 26) { |
| 17753 | case ALC880_HP_EVENT: |
| 17754 | alc663_m51va_speaker_automute(codec); |
| 17755 | break; |
| 17756 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17757 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17758 | break; |
| 17759 | } |
| 17760 | } |
| 17761 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17762 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17763 | { |
| 17764 | struct alc_spec *spec = codec->spec; |
| 17765 | spec->ext_mic.pin = 0x18; |
| 17766 | spec->ext_mic.mux_idx = 0; |
| 17767 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17768 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17769 | spec->auto_mic = 1; |
| 17770 | } |
| 17771 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17772 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17773 | { |
| 17774 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17775 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17776 | } |
| 17777 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17778 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17779 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17780 | |
| 17781 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17782 | { |
| 17783 | struct alc_spec *spec = codec->spec; |
| 17784 | spec->ext_mic.pin = 0x18; |
| 17785 | spec->ext_mic.mux_idx = 0; |
| 17786 | spec->int_mic.pin = 0x19; |
| 17787 | spec->int_mic.mux_idx = 1; |
| 17788 | spec->auto_mic = 1; |
| 17789 | } |
| 17790 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17791 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17792 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17793 | /* ***************** Mode2 ******************************/ |
| 17794 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17795 | unsigned int res) |
| 17796 | { |
| 17797 | switch (res >> 26) { |
| 17798 | case ALC880_HP_EVENT: |
| 17799 | alc662_f5z_speaker_automute(codec); |
| 17800 | break; |
| 17801 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17802 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17803 | break; |
| 17804 | } |
| 17805 | } |
| 17806 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17807 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17808 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17809 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17810 | { |
| 17811 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17812 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17813 | } |
| 17814 | /* ***************** Mode3 ******************************/ |
| 17815 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17816 | unsigned int res) |
| 17817 | { |
| 17818 | switch (res >> 26) { |
| 17819 | case ALC880_HP_EVENT: |
| 17820 | alc663_two_hp_m1_speaker_automute(codec); |
| 17821 | break; |
| 17822 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17823 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17824 | break; |
| 17825 | } |
| 17826 | } |
| 17827 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17828 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17829 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17830 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17831 | { |
| 17832 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17833 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17834 | } |
| 17835 | /* ***************** Mode4 ******************************/ |
| 17836 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17837 | unsigned int res) |
| 17838 | { |
| 17839 | switch (res >> 26) { |
| 17840 | case ALC880_HP_EVENT: |
| 17841 | alc663_21jd_two_speaker_automute(codec); |
| 17842 | break; |
| 17843 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17844 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17845 | break; |
| 17846 | } |
| 17847 | } |
| 17848 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17849 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17850 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17851 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17852 | { |
| 17853 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17854 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17855 | } |
| 17856 | /* ***************** Mode5 ******************************/ |
| 17857 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17858 | unsigned int res) |
| 17859 | { |
| 17860 | switch (res >> 26) { |
| 17861 | case ALC880_HP_EVENT: |
| 17862 | alc663_15jd_two_speaker_automute(codec); |
| 17863 | break; |
| 17864 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17865 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17866 | break; |
| 17867 | } |
| 17868 | } |
| 17869 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17870 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17871 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17872 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17873 | { |
| 17874 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17875 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17876 | } |
| 17877 | /* ***************** Mode6 ******************************/ |
| 17878 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17879 | unsigned int res) |
| 17880 | { |
| 17881 | switch (res >> 26) { |
| 17882 | case ALC880_HP_EVENT: |
| 17883 | alc663_two_hp_m2_speaker_automute(codec); |
| 17884 | break; |
| 17885 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17886 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17887 | break; |
| 17888 | } |
| 17889 | } |
| 17890 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17891 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17892 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17893 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17894 | { |
| 17895 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17896 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17897 | } |
| 17898 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17899 | /* ***************** Mode7 ******************************/ |
| 17900 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17901 | unsigned int res) |
| 17902 | { |
| 17903 | switch (res >> 26) { |
| 17904 | case ALC880_HP_EVENT: |
| 17905 | alc663_two_hp_m7_speaker_automute(codec); |
| 17906 | break; |
| 17907 | case ALC880_MIC_EVENT: |
| 17908 | alc_mic_automute(codec); |
| 17909 | break; |
| 17910 | } |
| 17911 | } |
| 17912 | |
| 17913 | #define alc663_mode7_setup alc663_mode1_setup |
| 17914 | |
| 17915 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17916 | { |
| 17917 | alc663_two_hp_m7_speaker_automute(codec); |
| 17918 | alc_mic_automute(codec); |
| 17919 | } |
| 17920 | |
| 17921 | /* ***************** Mode8 ******************************/ |
| 17922 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17923 | unsigned int res) |
| 17924 | { |
| 17925 | switch (res >> 26) { |
| 17926 | case ALC880_HP_EVENT: |
| 17927 | alc663_two_hp_m8_speaker_automute(codec); |
| 17928 | break; |
| 17929 | case ALC880_MIC_EVENT: |
| 17930 | alc_mic_automute(codec); |
| 17931 | break; |
| 17932 | } |
| 17933 | } |
| 17934 | |
| 17935 | #define alc663_mode8_setup alc663_m51va_setup |
| 17936 | |
| 17937 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17938 | { |
| 17939 | alc663_two_hp_m8_speaker_automute(codec); |
| 17940 | alc_mic_automute(codec); |
| 17941 | } |
| 17942 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17943 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17944 | { |
| 17945 | unsigned int present; |
| 17946 | unsigned char bits; |
| 17947 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17948 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17949 | bits = present ? HDA_AMP_MUTE : 0; |
| 17950 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17951 | HDA_AMP_MUTE, bits); |
| 17952 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17953 | HDA_AMP_MUTE, bits); |
| 17954 | } |
| 17955 | |
| 17956 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17957 | { |
| 17958 | unsigned int present; |
| 17959 | unsigned char bits; |
| 17960 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17961 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17962 | bits = present ? HDA_AMP_MUTE : 0; |
| 17963 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17964 | HDA_AMP_MUTE, bits); |
| 17965 | } |
| 17966 | |
| 17967 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17968 | unsigned int res) |
| 17969 | { |
| 17970 | switch (res >> 26) { |
| 17971 | case ALC880_HP_EVENT: |
| 17972 | alc663_g71v_hp_automute(codec); |
| 17973 | break; |
| 17974 | case ALC880_FRONT_EVENT: |
| 17975 | alc663_g71v_front_automute(codec); |
| 17976 | break; |
| 17977 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17978 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17979 | break; |
| 17980 | } |
| 17981 | } |
| 17982 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17983 | #define alc663_g71v_setup alc663_m51va_setup |
| 17984 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17985 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17986 | { |
| 17987 | alc663_g71v_front_automute(codec); |
| 17988 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17989 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17990 | } |
| 17991 | |
| 17992 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17993 | unsigned int res) |
| 17994 | { |
| 17995 | switch (res >> 26) { |
| 17996 | case ALC880_HP_EVENT: |
| 17997 | alc663_m51va_speaker_automute(codec); |
| 17998 | break; |
| 17999 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18000 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18001 | break; |
| 18002 | } |
| 18003 | } |
| 18004 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18005 | #define alc663_g50v_setup alc663_m51va_setup |
| 18006 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18007 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 18008 | { |
| 18009 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18010 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18011 | } |
| 18012 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18013 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 18014 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18015 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18016 | |
| 18017 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 18018 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18019 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18020 | |
| 18021 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 18022 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18023 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18024 | { } /* end */ |
| 18025 | }; |
| 18026 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18027 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 18028 | /* Master Playback automatically created from Speaker and Headphone */ |
| 18029 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 18030 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18031 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 18032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 18033 | |
| 18034 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 18035 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 18036 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 18037 | |
| 18038 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 18039 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 18040 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 18041 | { } /* end */ |
| 18042 | }; |
| 18043 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18044 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18045 | #define alc662_loopbacks alc880_loopbacks |
| 18046 | #endif |
| 18047 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18048 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 18049 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18050 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 18051 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 18052 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 18053 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 18054 | |
| 18055 | /* |
| 18056 | * configuration and preset |
| 18057 | */ |
| 18058 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 18059 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 18060 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 18061 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 18062 | [ALC662_5ST_DIG] = "6stack-dig", |
| 18063 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 18064 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18065 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18066 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18067 | [ALC663_ASUS_M51VA] = "m51va", |
| 18068 | [ALC663_ASUS_G71V] = "g71v", |
| 18069 | [ALC663_ASUS_H13] = "h13", |
| 18070 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18071 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 18072 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 18073 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 18074 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 18075 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 18076 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18077 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 18078 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 18079 | [ALC272_DELL] = "dell", |
| 18080 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18081 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18082 | [ALC662_AUTO] = "auto", |
| 18083 | }; |
| 18084 | |
| 18085 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18086 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18087 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 18088 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18089 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 18090 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18091 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18092 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 18093 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18094 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 18095 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18096 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 18097 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18098 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18099 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 18100 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 18101 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 18102 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 18103 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18104 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18105 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 18106 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18107 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 18108 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 18109 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 18110 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18111 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18112 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 18113 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 18114 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18115 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 18116 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 18117 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 18118 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18119 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18120 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 18121 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18122 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18123 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 18124 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 18125 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18126 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18127 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18128 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 18129 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18130 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 18131 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 18132 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18133 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18134 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 18135 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18136 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18137 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 18138 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18139 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 18140 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 18141 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18142 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18143 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 18144 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 18145 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18146 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18147 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18148 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 18149 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 18150 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 18151 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18152 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 18153 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 18154 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18155 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18156 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 18157 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18158 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 18159 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 18160 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 18161 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 18162 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18163 | {} |
| 18164 | }; |
| 18165 | |
| 18166 | static struct alc_config_preset alc662_presets[] = { |
| 18167 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18168 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18169 | .init_verbs = { alc662_init_verbs }, |
| 18170 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18171 | .dac_nids = alc662_dac_nids, |
| 18172 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18173 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18174 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18175 | .channel_mode = alc662_3ST_2ch_modes, |
| 18176 | .input_mux = &alc662_capture_source, |
| 18177 | }, |
| 18178 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18179 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18180 | .init_verbs = { alc662_init_verbs }, |
| 18181 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18182 | .dac_nids = alc662_dac_nids, |
| 18183 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18184 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18185 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18186 | .channel_mode = alc662_3ST_6ch_modes, |
| 18187 | .need_dac_fix = 1, |
| 18188 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18189 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18190 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18191 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18192 | .init_verbs = { alc662_init_verbs }, |
| 18193 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18194 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18195 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18196 | .channel_mode = alc662_3ST_6ch_modes, |
| 18197 | .need_dac_fix = 1, |
| 18198 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18199 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18200 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18201 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18202 | .init_verbs = { alc662_init_verbs }, |
| 18203 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18204 | .dac_nids = alc662_dac_nids, |
| 18205 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18206 | .dig_in_nid = ALC662_DIGIN_NID, |
| 18207 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 18208 | .channel_mode = alc662_5stack_modes, |
| 18209 | .input_mux = &alc662_capture_source, |
| 18210 | }, |
| 18211 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18212 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18213 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 18214 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18215 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18216 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18217 | .channel_mode = alc662_3ST_2ch_modes, |
| 18218 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 18219 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 18220 | .init_hook = alc662_lenovo_101e_all_automute, |
| 18221 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18222 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18223 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18224 | .init_verbs = { alc662_init_verbs, |
| 18225 | alc662_eeepc_sue_init_verbs }, |
| 18226 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18227 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18228 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18229 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18230 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18231 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 18232 | .init_hook = alc662_eeepc_inithook, |
| 18233 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18234 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18235 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18236 | alc662_chmode_mixer }, |
| 18237 | .init_verbs = { alc662_init_verbs, |
| 18238 | alc662_eeepc_ep20_sue_init_verbs }, |
| 18239 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18240 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18241 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18242 | .channel_mode = alc662_3ST_6ch_modes, |
| 18243 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 18244 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18245 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 18246 | .init_hook = alc662_eeepc_ep20_inithook, |
| 18247 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18248 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18249 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18250 | .init_verbs = { alc662_init_verbs, |
| 18251 | alc662_ecs_init_verbs }, |
| 18252 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18253 | .dac_nids = alc662_dac_nids, |
| 18254 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18255 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18256 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18257 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18258 | .init_hook = alc662_eeepc_inithook, |
| 18259 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18260 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18261 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18262 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18263 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18264 | .dac_nids = alc662_dac_nids, |
| 18265 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18266 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18267 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18268 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18269 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18270 | .init_hook = alc663_m51va_inithook, |
| 18271 | }, |
| 18272 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18273 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18274 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 18275 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18276 | .dac_nids = alc662_dac_nids, |
| 18277 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18278 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18279 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18280 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18281 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18282 | .init_hook = alc663_g71v_inithook, |
| 18283 | }, |
| 18284 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18285 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18286 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 18287 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18288 | .dac_nids = alc662_dac_nids, |
| 18289 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18290 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18291 | .unsol_event = alc663_m51va_unsol_event, |
| 18292 | .init_hook = alc663_m51va_inithook, |
| 18293 | }, |
| 18294 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18295 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18296 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 18297 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18298 | .dac_nids = alc662_dac_nids, |
| 18299 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18300 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 18301 | .channel_mode = alc662_3ST_6ch_modes, |
| 18302 | .input_mux = &alc663_capture_source, |
| 18303 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18304 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18305 | .init_hook = alc663_g50v_inithook, |
| 18306 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18307 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18308 | .mixers = { alc663_m51va_mixer }, |
| 18309 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18310 | .init_verbs = { alc662_init_verbs, |
| 18311 | alc663_21jd_amic_init_verbs }, |
| 18312 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18313 | .hp_nid = 0x03, |
| 18314 | .dac_nids = alc662_dac_nids, |
| 18315 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18316 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18317 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18318 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18319 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18320 | .init_hook = alc663_mode1_inithook, |
| 18321 | }, |
| 18322 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18323 | .mixers = { alc662_1bjd_mixer }, |
| 18324 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18325 | .init_verbs = { alc662_init_verbs, |
| 18326 | alc662_1bjd_amic_init_verbs }, |
| 18327 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18328 | .dac_nids = alc662_dac_nids, |
| 18329 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18330 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18331 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18332 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18333 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18334 | .init_hook = alc662_mode2_inithook, |
| 18335 | }, |
| 18336 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18337 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18338 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18339 | .init_verbs = { alc662_init_verbs, |
| 18340 | alc663_two_hp_amic_m1_init_verbs }, |
| 18341 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18342 | .hp_nid = 0x03, |
| 18343 | .dac_nids = alc662_dac_nids, |
| 18344 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18345 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18346 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18347 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18348 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18349 | .init_hook = alc663_mode3_inithook, |
| 18350 | }, |
| 18351 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18352 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18353 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18354 | .init_verbs = { alc662_init_verbs, |
| 18355 | alc663_21jd_amic_init_verbs}, |
| 18356 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18357 | .hp_nid = 0x03, |
| 18358 | .dac_nids = alc662_dac_nids, |
| 18359 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18360 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18361 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18362 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18363 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18364 | .init_hook = alc663_mode4_inithook, |
| 18365 | }, |
| 18366 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18367 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18368 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18369 | .init_verbs = { alc662_init_verbs, |
| 18370 | alc663_15jd_amic_init_verbs }, |
| 18371 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18372 | .hp_nid = 0x03, |
| 18373 | .dac_nids = alc662_dac_nids, |
| 18374 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18375 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18376 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18377 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18378 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18379 | .init_hook = alc663_mode5_inithook, |
| 18380 | }, |
| 18381 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18382 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18383 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18384 | .init_verbs = { alc662_init_verbs, |
| 18385 | alc663_two_hp_amic_m2_init_verbs }, |
| 18386 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18387 | .hp_nid = 0x03, |
| 18388 | .dac_nids = alc662_dac_nids, |
| 18389 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18390 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18391 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18392 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18393 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18394 | .init_hook = alc663_mode6_inithook, |
| 18395 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18396 | [ALC663_ASUS_MODE7] = { |
| 18397 | .mixers = { alc663_mode7_mixer }, |
| 18398 | .cap_mixer = alc662_auto_capture_mixer, |
| 18399 | .init_verbs = { alc662_init_verbs, |
| 18400 | alc663_mode7_init_verbs }, |
| 18401 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18402 | .hp_nid = 0x03, |
| 18403 | .dac_nids = alc662_dac_nids, |
| 18404 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18405 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18406 | .channel_mode = alc662_3ST_2ch_modes, |
| 18407 | .unsol_event = alc663_mode7_unsol_event, |
| 18408 | .setup = alc663_mode7_setup, |
| 18409 | .init_hook = alc663_mode7_inithook, |
| 18410 | }, |
| 18411 | [ALC663_ASUS_MODE8] = { |
| 18412 | .mixers = { alc663_mode8_mixer }, |
| 18413 | .cap_mixer = alc662_auto_capture_mixer, |
| 18414 | .init_verbs = { alc662_init_verbs, |
| 18415 | alc663_mode8_init_verbs }, |
| 18416 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18417 | .hp_nid = 0x03, |
| 18418 | .dac_nids = alc662_dac_nids, |
| 18419 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18420 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18421 | .channel_mode = alc662_3ST_2ch_modes, |
| 18422 | .unsol_event = alc663_mode8_unsol_event, |
| 18423 | .setup = alc663_mode8_setup, |
| 18424 | .init_hook = alc663_mode8_inithook, |
| 18425 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18426 | [ALC272_DELL] = { |
| 18427 | .mixers = { alc663_m51va_mixer }, |
| 18428 | .cap_mixer = alc272_auto_capture_mixer, |
| 18429 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18430 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18431 | .dac_nids = alc662_dac_nids, |
| 18432 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18433 | .adc_nids = alc272_adc_nids, |
| 18434 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18435 | .capsrc_nids = alc272_capsrc_nids, |
| 18436 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18437 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18438 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18439 | .init_hook = alc663_m51va_inithook, |
| 18440 | }, |
| 18441 | [ALC272_DELL_ZM1] = { |
| 18442 | .mixers = { alc663_m51va_mixer }, |
| 18443 | .cap_mixer = alc662_auto_capture_mixer, |
| 18444 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18445 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18446 | .dac_nids = alc662_dac_nids, |
| 18447 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18448 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18449 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18450 | .capsrc_nids = alc662_capsrc_nids, |
| 18451 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18452 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18453 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18454 | .init_hook = alc663_m51va_inithook, |
| 18455 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18456 | [ALC272_SAMSUNG_NC10] = { |
| 18457 | .mixers = { alc272_nc10_mixer }, |
| 18458 | .init_verbs = { alc662_init_verbs, |
| 18459 | alc663_21jd_amic_init_verbs }, |
| 18460 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18461 | .dac_nids = alc272_dac_nids, |
| 18462 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18463 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18464 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18465 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18466 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18467 | .init_hook = alc663_mode4_inithook, |
| 18468 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18469 | }; |
| 18470 | |
| 18471 | |
| 18472 | /* |
| 18473 | * BIOS auto configuration |
| 18474 | */ |
| 18475 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18476 | /* convert from MIX nid to DAC */ |
| 18477 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18478 | { |
| 18479 | if (nid == 0x0f) |
| 18480 | return 0x02; |
| 18481 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18482 | return nid - 0x0c + 0x02; |
| 18483 | else |
| 18484 | return 0; |
| 18485 | } |
| 18486 | |
| 18487 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18488 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18489 | hda_nid_t dac) |
| 18490 | { |
| 18491 | hda_nid_t mix[4]; |
| 18492 | int i, num; |
| 18493 | |
| 18494 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18495 | for (i = 0; i < num; i++) { |
| 18496 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18497 | return mix[i]; |
| 18498 | } |
| 18499 | return 0; |
| 18500 | } |
| 18501 | |
| 18502 | /* look for an empty DAC slot */ |
| 18503 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18504 | { |
| 18505 | struct alc_spec *spec = codec->spec; |
| 18506 | hda_nid_t srcs[5]; |
| 18507 | int i, j, num; |
| 18508 | |
| 18509 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18510 | if (num < 0) |
| 18511 | return 0; |
| 18512 | for (i = 0; i < num; i++) { |
| 18513 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18514 | if (!nid) |
| 18515 | continue; |
| 18516 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18517 | if (spec->multiout.dac_nids[j] == nid) |
| 18518 | break; |
| 18519 | if (j >= spec->multiout.num_dacs) |
| 18520 | return nid; |
| 18521 | } |
| 18522 | return 0; |
| 18523 | } |
| 18524 | |
| 18525 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18526 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18527 | const struct auto_pin_cfg *cfg) |
| 18528 | { |
| 18529 | struct alc_spec *spec = codec->spec; |
| 18530 | int i; |
| 18531 | hda_nid_t dac; |
| 18532 | |
| 18533 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18534 | for (i = 0; i < cfg->line_outs; i++) { |
| 18535 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18536 | if (!dac) |
| 18537 | continue; |
| 18538 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18539 | } |
| 18540 | return 0; |
| 18541 | } |
| 18542 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18543 | 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] | 18544 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18545 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18546 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18547 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18548 | } |
| 18549 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18550 | 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] | 18551 | hda_nid_t nid, unsigned int chs) |
| 18552 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18553 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18554 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18555 | } |
| 18556 | |
| 18557 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18558 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18559 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18560 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18561 | |
| 18562 | /* add playback controls from the parsed DAC table */ |
| 18563 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18564 | const struct auto_pin_cfg *cfg) |
| 18565 | { |
| 18566 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18567 | static const char *chname[4] = { |
| 18568 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18569 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18570 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18571 | int i, err; |
| 18572 | |
| 18573 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18574 | nid = spec->multiout.dac_nids[i]; |
| 18575 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18576 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18577 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18578 | if (!mix) |
| 18579 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18580 | if (i == 2) { |
| 18581 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18582 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18583 | if (err < 0) |
| 18584 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18585 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18586 | if (err < 0) |
| 18587 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18588 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18589 | if (err < 0) |
| 18590 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18591 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18592 | if (err < 0) |
| 18593 | return err; |
| 18594 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18595 | const char *pfx; |
| 18596 | if (cfg->line_outs == 1 && |
| 18597 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18598 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18599 | pfx = "Speaker"; |
| 18600 | else |
| 18601 | pfx = "PCM"; |
| 18602 | } else |
| 18603 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18604 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18605 | if (err < 0) |
| 18606 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18607 | if (cfg->line_outs == 1 && |
| 18608 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18609 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18610 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18611 | if (err < 0) |
| 18612 | return err; |
| 18613 | } |
| 18614 | } |
| 18615 | return 0; |
| 18616 | } |
| 18617 | |
| 18618 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18619 | /* return DAC nid if any new DAC is assigned */ |
| 18620 | 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] | 18621 | const char *pfx) |
| 18622 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18623 | struct alc_spec *spec = codec->spec; |
| 18624 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18625 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18626 | |
| 18627 | if (!pin) |
| 18628 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18629 | nid = alc662_look_for_dac(codec, pin); |
| 18630 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18631 | /* the corresponding DAC is already occupied */ |
| 18632 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18633 | return 0; /* no way */ |
| 18634 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18635 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18636 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18637 | } |
| 18638 | |
| 18639 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18640 | if (!mix) |
| 18641 | return 0; |
| 18642 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18643 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18644 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18645 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18646 | if (err < 0) |
| 18647 | return err; |
| 18648 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18649 | } |
| 18650 | |
| 18651 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18652 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18653 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18654 | |
| 18655 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18656 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18657 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18658 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18659 | int i, num; |
Takashi Iwai | ce503f3 | 2010-07-30 10:37:29 +0200 | [diff] [blame^] | 18660 | hda_nid_t srcs[HDA_MAX_CONNECTIONS]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18661 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18662 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18663 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18664 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18665 | if (num <= 1) |
| 18666 | return; |
| 18667 | for (i = 0; i < num; i++) { |
| 18668 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18669 | continue; |
| 18670 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18671 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18672 | } |
| 18673 | } |
| 18674 | |
| 18675 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18676 | { |
| 18677 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18678 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18679 | int i; |
| 18680 | |
| 18681 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18682 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18683 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18684 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18685 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18686 | } |
| 18687 | } |
| 18688 | |
| 18689 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18690 | { |
| 18691 | struct alc_spec *spec = codec->spec; |
| 18692 | hda_nid_t pin; |
| 18693 | |
| 18694 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18695 | if (pin) |
| 18696 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18697 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18698 | pin = spec->autocfg.speaker_pins[0]; |
| 18699 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18700 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18701 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18702 | } |
| 18703 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18704 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18705 | |
| 18706 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18707 | { |
| 18708 | struct alc_spec *spec = codec->spec; |
| 18709 | int i; |
| 18710 | |
| 18711 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18712 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18713 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18714 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18715 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18716 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18717 | snd_hda_codec_write(codec, nid, 0, |
| 18718 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18719 | AMP_OUT_MUTE); |
| 18720 | } |
| 18721 | } |
| 18722 | } |
| 18723 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18724 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18725 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18726 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18727 | { |
| 18728 | struct alc_spec *spec = codec->spec; |
| 18729 | int err; |
| 18730 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18731 | |
| 18732 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18733 | alc662_ignore); |
| 18734 | if (err < 0) |
| 18735 | return err; |
| 18736 | if (!spec->autocfg.line_outs) |
| 18737 | return 0; /* can't find valid BIOS pin config */ |
| 18738 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18739 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18740 | if (err < 0) |
| 18741 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18742 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18743 | if (err < 0) |
| 18744 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18745 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18746 | spec->autocfg.speaker_pins[0], |
| 18747 | "Speaker"); |
| 18748 | if (err < 0) |
| 18749 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18750 | if (err) |
| 18751 | spec->multiout.extra_out_nid[0] = err; |
| 18752 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18753 | "Headphone"); |
| 18754 | if (err < 0) |
| 18755 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18756 | if (err) |
| 18757 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18758 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18759 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18760 | return err; |
| 18761 | |
| 18762 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18763 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18764 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18765 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18766 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18767 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18768 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18769 | |
| 18770 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18771 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18772 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18773 | add_verb(spec, alc662_init_verbs); |
| 18774 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18775 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18776 | add_verb(spec, alc663_init_verbs); |
| 18777 | |
| 18778 | if (codec->vendor_id == 0x10ec0272) |
| 18779 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18780 | |
| 18781 | err = alc_auto_add_mic_boost(codec); |
| 18782 | if (err < 0) |
| 18783 | return err; |
| 18784 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18785 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18786 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18787 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18788 | else |
| 18789 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18790 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18791 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18792 | } |
| 18793 | |
| 18794 | /* additional initialization for auto-configuration model */ |
| 18795 | static void alc662_auto_init(struct hda_codec *codec) |
| 18796 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18797 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18798 | alc662_auto_init_multi_out(codec); |
| 18799 | alc662_auto_init_hp_out(codec); |
| 18800 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18801 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18802 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18803 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18804 | } |
| 18805 | |
| 18806 | static int patch_alc662(struct hda_codec *codec) |
| 18807 | { |
| 18808 | struct alc_spec *spec; |
| 18809 | int err, board_config; |
| 18810 | |
| 18811 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18812 | if (!spec) |
| 18813 | return -ENOMEM; |
| 18814 | |
| 18815 | codec->spec = spec; |
| 18816 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18817 | alc_auto_parse_customize_define(codec); |
| 18818 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18819 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18820 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18821 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18822 | alc_codec_rename(codec, "ALC661"); |
| 18823 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18824 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18825 | spec->cdefine.platform_type == 1) |
| 18826 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18827 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18828 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18829 | alc662_models, |
| 18830 | alc662_cfg_tbl); |
| 18831 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18832 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18833 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18834 | board_config = ALC662_AUTO; |
| 18835 | } |
| 18836 | |
| 18837 | if (board_config == ALC662_AUTO) { |
| 18838 | /* automatic parse from the BIOS config */ |
| 18839 | err = alc662_parse_auto_config(codec); |
| 18840 | if (err < 0) { |
| 18841 | alc_free(codec); |
| 18842 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18843 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18844 | printk(KERN_INFO |
| 18845 | "hda_codec: Cannot set up configuration " |
| 18846 | "from BIOS. Using base mode...\n"); |
| 18847 | board_config = ALC662_3ST_2ch_DIG; |
| 18848 | } |
| 18849 | } |
| 18850 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18851 | if (has_cdefine_beep(codec)) { |
Takashi Iwai | 8af2591 | 2010-07-28 17:37:16 +0200 | [diff] [blame] | 18852 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18853 | if (err < 0) { |
| 18854 | alc_free(codec); |
| 18855 | return err; |
| 18856 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18857 | } |
| 18858 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18859 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18860 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18861 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18862 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18863 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18864 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18865 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18866 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18867 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18868 | if (!spec->adc_nids) { |
| 18869 | spec->adc_nids = alc662_adc_nids; |
| 18870 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18871 | } |
| 18872 | if (!spec->capsrc_nids) |
| 18873 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18874 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18875 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18876 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18877 | |
Takashi Iwai | dc1eae2 | 2010-07-29 15:30:02 +0200 | [diff] [blame] | 18878 | if (has_cdefine_beep(codec)) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18879 | switch (codec->vendor_id) { |
| 18880 | case 0x10ec0662: |
| 18881 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18882 | break; |
| 18883 | case 0x10ec0272: |
| 18884 | case 0x10ec0663: |
| 18885 | case 0x10ec0665: |
| 18886 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18887 | break; |
| 18888 | case 0x10ec0273: |
| 18889 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18890 | break; |
| 18891 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18892 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18893 | spec->vmaster_nid = 0x02; |
| 18894 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18895 | codec->patch_ops = alc_patch_ops; |
| 18896 | if (board_config == ALC662_AUTO) |
| 18897 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18898 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18899 | if (!spec->loopback.amplist) |
| 18900 | spec->loopback.amplist = alc662_loopbacks; |
| 18901 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18902 | |
| 18903 | return 0; |
| 18904 | } |
| 18905 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18906 | static int patch_alc888(struct hda_codec *codec) |
| 18907 | { |
| 18908 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18909 | kfree(codec->chip_name); |
| 18910 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18911 | if (!codec->chip_name) { |
| 18912 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18913 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18914 | } |
| 18915 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18916 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18917 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18918 | } |
| 18919 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18920 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 18921 | * ALC680 support |
| 18922 | */ |
| 18923 | #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID |
| 18924 | #define alc680_modes alc260_modes |
| 18925 | |
| 18926 | static hda_nid_t alc680_dac_nids[3] = { |
| 18927 | /* Lout1, Lout2, hp */ |
| 18928 | 0x02, 0x03, 0x04 |
| 18929 | }; |
| 18930 | |
| 18931 | static hda_nid_t alc680_adc_nids[3] = { |
| 18932 | /* ADC0-2 */ |
| 18933 | /* DMIC, MIC, Line-in*/ |
| 18934 | 0x07, 0x08, 0x09 |
| 18935 | }; |
| 18936 | |
| 18937 | static struct snd_kcontrol_new alc680_base_mixer[] = { |
| 18938 | /* output mixer control */ |
| 18939 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 18940 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 18941 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), |
| 18942 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 18943 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 18944 | { } |
| 18945 | }; |
| 18946 | |
| 18947 | static struct snd_kcontrol_new alc680_capture_mixer[] = { |
| 18948 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 18949 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 18950 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 18951 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 18952 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 18953 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 18954 | { } /* end */ |
| 18955 | }; |
| 18956 | |
| 18957 | /* |
| 18958 | * generic initialization of ADC, input mixers and output mixers |
| 18959 | */ |
| 18960 | static struct hda_verb alc680_init_verbs[] = { |
| 18961 | /* Unmute DAC0-1 and set vol = 0 */ |
| 18962 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18963 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18964 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 18965 | |
| 18966 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 18967 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 18968 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 18969 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 18970 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 18971 | |
| 18972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18974 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 18977 | { } |
| 18978 | }; |
| 18979 | |
| 18980 | /* create input playback/capture controls for the given pin */ |
| 18981 | static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 18982 | const char *ctlname, int idx) |
| 18983 | { |
| 18984 | hda_nid_t dac; |
| 18985 | int err; |
| 18986 | |
| 18987 | switch (nid) { |
| 18988 | case 0x14: |
| 18989 | dac = 0x02; |
| 18990 | break; |
| 18991 | case 0x15: |
| 18992 | dac = 0x03; |
| 18993 | break; |
| 18994 | case 0x16: |
| 18995 | dac = 0x04; |
| 18996 | break; |
| 18997 | default: |
| 18998 | return 0; |
| 18999 | } |
| 19000 | if (spec->multiout.dac_nids[0] != dac && |
| 19001 | spec->multiout.dac_nids[1] != dac) { |
| 19002 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
| 19003 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
| 19004 | HDA_OUTPUT)); |
| 19005 | if (err < 0) |
| 19006 | return err; |
| 19007 | |
| 19008 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
| 19009 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 19010 | |
| 19011 | if (err < 0) |
| 19012 | return err; |
| 19013 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 19014 | } |
| 19015 | |
| 19016 | return 0; |
| 19017 | } |
| 19018 | |
| 19019 | /* add playback controls from the parsed DAC table */ |
| 19020 | static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 19021 | const struct auto_pin_cfg *cfg) |
| 19022 | { |
| 19023 | hda_nid_t nid; |
| 19024 | int err; |
| 19025 | |
| 19026 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 19027 | |
| 19028 | nid = cfg->line_out_pins[0]; |
| 19029 | if (nid) { |
| 19030 | const char *name; |
| 19031 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 19032 | name = "Speaker"; |
| 19033 | else |
| 19034 | name = "Front"; |
| 19035 | err = alc680_new_analog_output(spec, nid, name, 0); |
| 19036 | if (err < 0) |
| 19037 | return err; |
| 19038 | } |
| 19039 | |
| 19040 | nid = cfg->speaker_pins[0]; |
| 19041 | if (nid) { |
| 19042 | err = alc680_new_analog_output(spec, nid, "Speaker", 0); |
| 19043 | if (err < 0) |
| 19044 | return err; |
| 19045 | } |
| 19046 | nid = cfg->hp_pins[0]; |
| 19047 | if (nid) { |
| 19048 | err = alc680_new_analog_output(spec, nid, "Headphone", 0); |
| 19049 | if (err < 0) |
| 19050 | return err; |
| 19051 | } |
| 19052 | |
| 19053 | return 0; |
| 19054 | } |
| 19055 | |
| 19056 | static void alc680_auto_set_output_and_unmute(struct hda_codec *codec, |
| 19057 | hda_nid_t nid, int pin_type) |
| 19058 | { |
| 19059 | alc_set_pin_output(codec, nid, pin_type); |
| 19060 | } |
| 19061 | |
| 19062 | static void alc680_auto_init_multi_out(struct hda_codec *codec) |
| 19063 | { |
| 19064 | struct alc_spec *spec = codec->spec; |
| 19065 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 19066 | if (nid) { |
| 19067 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 19068 | alc680_auto_set_output_and_unmute(codec, nid, pin_type); |
| 19069 | } |
| 19070 | } |
| 19071 | |
| 19072 | static void alc680_auto_init_hp_out(struct hda_codec *codec) |
| 19073 | { |
| 19074 | struct alc_spec *spec = codec->spec; |
| 19075 | hda_nid_t pin; |
| 19076 | |
| 19077 | pin = spec->autocfg.hp_pins[0]; |
| 19078 | if (pin) |
| 19079 | alc680_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 19080 | pin = spec->autocfg.speaker_pins[0]; |
| 19081 | if (pin) |
| 19082 | alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 19083 | } |
| 19084 | |
| 19085 | /* pcm configuration: identical with ALC880 */ |
| 19086 | #define alc680_pcm_analog_playback alc880_pcm_analog_playback |
| 19087 | #define alc680_pcm_analog_capture alc880_pcm_analog_capture |
| 19088 | #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
| 19089 | #define alc680_pcm_digital_playback alc880_pcm_digital_playback |
| 19090 | |
| 19091 | static struct hda_input_mux alc680_capture_source = { |
| 19092 | .num_items = 1, |
| 19093 | .items = { |
| 19094 | { "Mic", 0x0 }, |
| 19095 | }, |
| 19096 | }; |
| 19097 | |
| 19098 | /* |
| 19099 | * BIOS auto configuration |
| 19100 | */ |
| 19101 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 19102 | { |
| 19103 | struct alc_spec *spec = codec->spec; |
| 19104 | int err; |
| 19105 | static hda_nid_t alc680_ignore[] = { 0 }; |
| 19106 | |
| 19107 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 19108 | alc680_ignore); |
| 19109 | if (err < 0) |
| 19110 | return err; |
| 19111 | if (!spec->autocfg.line_outs) { |
| 19112 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 19113 | spec->multiout.max_channels = 2; |
| 19114 | spec->no_analog = 1; |
| 19115 | goto dig_only; |
| 19116 | } |
| 19117 | return 0; /* can't find valid BIOS pin config */ |
| 19118 | } |
| 19119 | err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 19120 | if (err < 0) |
| 19121 | return err; |
| 19122 | |
| 19123 | spec->multiout.max_channels = 2; |
| 19124 | |
| 19125 | dig_only: |
| 19126 | /* digital only support output */ |
| 19127 | if (spec->autocfg.dig_outs) { |
| 19128 | spec->multiout.dig_out_nid = ALC680_DIGOUT_NID; |
| 19129 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 19130 | } |
| 19131 | if (spec->kctls.list) |
| 19132 | add_mixer(spec, spec->kctls.list); |
| 19133 | |
| 19134 | add_verb(spec, alc680_init_verbs); |
| 19135 | spec->num_mux_defs = 1; |
| 19136 | spec->input_mux = &alc680_capture_source; |
| 19137 | |
| 19138 | err = alc_auto_add_mic_boost(codec); |
| 19139 | if (err < 0) |
| 19140 | return err; |
| 19141 | |
| 19142 | return 1; |
| 19143 | } |
| 19144 | |
| 19145 | #define alc680_auto_init_analog_input alc882_auto_init_analog_input |
| 19146 | |
| 19147 | /* init callback for auto-configuration model -- overriding the default init */ |
| 19148 | static void alc680_auto_init(struct hda_codec *codec) |
| 19149 | { |
| 19150 | struct alc_spec *spec = codec->spec; |
| 19151 | alc680_auto_init_multi_out(codec); |
| 19152 | alc680_auto_init_hp_out(codec); |
| 19153 | alc680_auto_init_analog_input(codec); |
| 19154 | if (spec->unsol_event) |
| 19155 | alc_inithook(codec); |
| 19156 | } |
| 19157 | |
| 19158 | /* |
| 19159 | * configuration and preset |
| 19160 | */ |
| 19161 | static const char *alc680_models[ALC680_MODEL_LAST] = { |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 19162 | [ALC680_BASE] = "base", |
| 19163 | [ALC680_AUTO] = "auto", |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19164 | }; |
| 19165 | |
| 19166 | static struct snd_pci_quirk alc680_cfg_tbl[] = { |
| 19167 | SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE), |
| 19168 | {} |
| 19169 | }; |
| 19170 | |
| 19171 | static struct alc_config_preset alc680_presets[] = { |
| 19172 | [ALC680_BASE] = { |
| 19173 | .mixers = { alc680_base_mixer }, |
| 19174 | .cap_mixer = alc680_capture_mixer, |
| 19175 | .init_verbs = { alc680_init_verbs }, |
| 19176 | .num_dacs = ARRAY_SIZE(alc680_dac_nids), |
| 19177 | .dac_nids = alc680_dac_nids, |
| 19178 | .num_adc_nids = ARRAY_SIZE(alc680_adc_nids), |
| 19179 | .adc_nids = alc680_adc_nids, |
| 19180 | .hp_nid = 0x04, |
| 19181 | .dig_out_nid = ALC680_DIGOUT_NID, |
| 19182 | .num_channel_mode = ARRAY_SIZE(alc680_modes), |
| 19183 | .channel_mode = alc680_modes, |
| 19184 | .input_mux = &alc680_capture_source, |
| 19185 | }, |
| 19186 | }; |
| 19187 | |
| 19188 | static int patch_alc680(struct hda_codec *codec) |
| 19189 | { |
| 19190 | struct alc_spec *spec; |
| 19191 | int board_config; |
| 19192 | int err; |
| 19193 | |
| 19194 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 19195 | if (spec == NULL) |
| 19196 | return -ENOMEM; |
| 19197 | |
| 19198 | codec->spec = spec; |
| 19199 | |
| 19200 | board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST, |
| 19201 | alc680_models, |
| 19202 | alc680_cfg_tbl); |
| 19203 | |
| 19204 | if (board_config < 0 || board_config >= ALC680_MODEL_LAST) { |
| 19205 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 19206 | codec->chip_name); |
| 19207 | board_config = ALC680_AUTO; |
| 19208 | } |
| 19209 | |
| 19210 | if (board_config == ALC680_AUTO) { |
| 19211 | /* automatic parse from the BIOS config */ |
| 19212 | err = alc680_parse_auto_config(codec); |
| 19213 | if (err < 0) { |
| 19214 | alc_free(codec); |
| 19215 | return err; |
| 19216 | } else if (!err) { |
| 19217 | printk(KERN_INFO |
| 19218 | "hda_codec: Cannot set up configuration " |
| 19219 | "from BIOS. Using base mode...\n"); |
| 19220 | board_config = ALC680_BASE; |
| 19221 | } |
| 19222 | } |
| 19223 | |
| 19224 | if (board_config != ALC680_AUTO) |
| 19225 | setup_preset(codec, &alc680_presets[board_config]); |
| 19226 | |
| 19227 | spec->stream_analog_playback = &alc680_pcm_analog_playback; |
| 19228 | spec->stream_analog_capture = &alc680_pcm_analog_capture; |
| 19229 | spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture; |
| 19230 | spec->stream_digital_playback = &alc680_pcm_digital_playback; |
| 19231 | |
| 19232 | if (!spec->adc_nids) { |
| 19233 | spec->adc_nids = alc680_adc_nids; |
| 19234 | spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids); |
| 19235 | } |
| 19236 | |
| 19237 | if (!spec->cap_mixer) |
| 19238 | set_capture_mixer(codec); |
| 19239 | |
| 19240 | spec->vmaster_nid = 0x02; |
| 19241 | |
| 19242 | codec->patch_ops = alc_patch_ops; |
| 19243 | if (board_config == ALC680_AUTO) |
| 19244 | spec->init_hook = alc680_auto_init; |
| 19245 | |
| 19246 | return 0; |
| 19247 | } |
| 19248 | |
| 19249 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19250 | * patch entries |
| 19251 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19252 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19253 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19254 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19255 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 19256 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 19257 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19258 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 19259 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 19260 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19261 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19262 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19263 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 19264 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 19265 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19266 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19267 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 19268 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 19269 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 19270 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 19271 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 19272 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 19273 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 19274 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19275 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19276 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 19277 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19278 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 19279 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19280 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 19281 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19282 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 19283 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19284 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19285 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 19286 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 19287 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19288 | {} /* terminator */ |
| 19289 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 19290 | |
| 19291 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 19292 | |
| 19293 | MODULE_LICENSE("GPL"); |
| 19294 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 19295 | |
| 19296 | static struct hda_codec_preset_list realtek_list = { |
| 19297 | .preset = snd_hda_preset_realtek, |
| 19298 | .owner = THIS_MODULE, |
| 19299 | }; |
| 19300 | |
| 19301 | static int __init patch_realtek_init(void) |
| 19302 | { |
| 19303 | return snd_hda_add_codec_preset(&realtek_list); |
| 19304 | } |
| 19305 | |
| 19306 | static void __exit patch_realtek_exit(void) |
| 19307 | { |
| 19308 | snd_hda_delete_codec_preset(&realtek_list); |
| 19309 | } |
| 19310 | |
| 19311 | module_init(patch_realtek_init) |
| 19312 | module_exit(patch_realtek_exit) |