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, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 212 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 213 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 214 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 215 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 216 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 217 | ALC883_3ST_2ch_DIG, |
| 218 | ALC883_3ST_6ch_DIG, |
| 219 | ALC883_3ST_6ch, |
| 220 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 221 | ALC883_TARGA_DIG, |
| 222 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 223 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 224 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 225 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 226 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 230 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 231 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 232 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 233 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 234 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 235 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 236 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 237 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 238 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 239 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 240 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 241 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 242 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 243 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 244 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 245 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 246 | ALC889A_INTEL, |
| 247 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 248 | ALC888_ASUS_M90V, |
| 249 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 250 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 251 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 252 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 253 | ALC882_AUTO, |
| 254 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 255 | }; |
| 256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 257 | /* for GPIO Poll */ |
| 258 | #define GPIO_MASK 0x03 |
| 259 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 260 | /* extra amp-initialization sequence types */ |
| 261 | enum { |
| 262 | ALC_INIT_NONE, |
| 263 | ALC_INIT_DEFAULT, |
| 264 | ALC_INIT_GPIO1, |
| 265 | ALC_INIT_GPIO2, |
| 266 | ALC_INIT_GPIO3, |
| 267 | }; |
| 268 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 269 | struct alc_mic_route { |
| 270 | hda_nid_t pin; |
| 271 | unsigned char mux_idx; |
| 272 | unsigned char amix_idx; |
| 273 | }; |
| 274 | |
| 275 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 276 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | struct alc_spec { |
| 278 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 279 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 281 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 282 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 284 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 285 | * don't forget NULL |
| 286 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 287 | */ |
| 288 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 290 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | struct hda_pcm_stream *stream_analog_playback; |
| 292 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 293 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 294 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 296 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | struct hda_pcm_stream *stream_digital_playback; |
| 298 | struct hda_pcm_stream *stream_digital_capture; |
| 299 | |
| 300 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 301 | struct hda_multi_out multiout; /* playback set-up |
| 302 | * max_channels, dacs must be set |
| 303 | * dig_out_nid and hp_nid are optional |
| 304 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 305 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 306 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 307 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | /* capture */ |
| 310 | unsigned int num_adc_nids; |
| 311 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 312 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 313 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
| 315 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 316 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | const struct hda_input_mux *input_mux; |
| 318 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 319 | struct alc_mic_route ext_mic; |
| 320 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | |
| 322 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 323 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 325 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 326 | int const_channel_count; |
| 327 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | |
| 329 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 330 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 331 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 332 | /* dynamic controls, init_verbs and input_mux */ |
| 333 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 334 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 335 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 336 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 337 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 338 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 339 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 340 | /* hooks */ |
| 341 | void (*init_hook)(struct hda_codec *codec); |
| 342 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 343 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 344 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 345 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 346 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 347 | /* for pin sensing */ |
| 348 | unsigned int sense_updated: 1; |
| 349 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 350 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 351 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 352 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 353 | /* other flags */ |
| 354 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 355 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 356 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 357 | /* for virtual master */ |
| 358 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 359 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 360 | struct hda_loopback_check loopback; |
| 361 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 362 | |
| 363 | /* for PLL fix */ |
| 364 | hda_nid_t pll_nid; |
| 365 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | /* |
| 369 | * configuration template - to be copied to the spec instance |
| 370 | */ |
| 371 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 372 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 373 | * with spec |
| 374 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 375 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 376 | const struct hda_verb *init_verbs[5]; |
| 377 | unsigned int num_dacs; |
| 378 | hda_nid_t *dac_nids; |
| 379 | hda_nid_t dig_out_nid; /* optional */ |
| 380 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 381 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 382 | unsigned int num_adc_nids; |
| 383 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 384 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 385 | hda_nid_t dig_in_nid; |
| 386 | unsigned int num_channel_mode; |
| 387 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 388 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 389 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 390 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 391 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 392 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 393 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 394 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 395 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 396 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 397 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 398 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | }; |
| 400 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | |
| 402 | /* |
| 403 | * input MUX handling |
| 404 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 405 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 406 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | { |
| 408 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 409 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 410 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 411 | if (mux_idx >= spec->num_mux_defs) |
| 412 | mux_idx = 0; |
| 413 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | } |
| 415 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 416 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 417 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | { |
| 419 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 420 | struct alc_spec *spec = codec->spec; |
| 421 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 422 | |
| 423 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 424 | return 0; |
| 425 | } |
| 426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 427 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | { |
| 430 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 431 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 432 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 434 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 435 | hda_nid_t nid = spec->capsrc_nids ? |
| 436 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 437 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 439 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 440 | imux = &spec->input_mux[mux_idx]; |
| 441 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 442 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 443 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 444 | /* Matrix-mixer style (e.g. ALC882) */ |
| 445 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 446 | unsigned int i, idx; |
| 447 | |
| 448 | idx = ucontrol->value.enumerated.item[0]; |
| 449 | if (idx >= imux->num_items) |
| 450 | idx = imux->num_items - 1; |
| 451 | if (*cur_val == idx) |
| 452 | return 0; |
| 453 | for (i = 0; i < imux->num_items; i++) { |
| 454 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 455 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 456 | imux->items[i].index, |
| 457 | HDA_AMP_MUTE, v); |
| 458 | } |
| 459 | *cur_val = idx; |
| 460 | return 1; |
| 461 | } else { |
| 462 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 463 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 464 | &spec->cur_mux[adc_idx]); |
| 465 | } |
| 466 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | /* |
| 469 | * channel mode setting |
| 470 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 472 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | { |
| 474 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 475 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 476 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 477 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 481 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | { |
| 483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 484 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 485 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 486 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 487 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | } |
| 489 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 490 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 491 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | { |
| 493 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 494 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 495 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 496 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 497 | &spec->ext_channel_count); |
| 498 | if (err >= 0 && !spec->const_channel_count) { |
| 499 | spec->multiout.max_channels = spec->ext_channel_count; |
| 500 | if (spec->need_dac_fix) |
| 501 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 502 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 503 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | } |
| 505 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 507 | * 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] | 508 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | * being part of a format specifier. Maximum allowed length of a value is |
| 510 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 511 | * |
| 512 | * Note: some retasking pin complexes seem to ignore requests for input |
| 513 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 514 | * are requested. Therefore order this list so that this behaviour will not |
| 515 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 516 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 517 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 518 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 520 | "Mic 50pc bias", "Mic 80pc bias", |
| 521 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | }; |
| 523 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 524 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | }; |
| 526 | /* 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] | 527 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 528 | * addition, "input" pins may or may not process the mic bias option |
| 529 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 530 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 531 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 532 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 533 | #define ALC_PIN_DIR_IN 0x00 |
| 534 | #define ALC_PIN_DIR_OUT 0x01 |
| 535 | #define ALC_PIN_DIR_INOUT 0x02 |
| 536 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 537 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 539 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | * For each direction the minimum and maximum values are given. |
| 541 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 542 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 544 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 545 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 546 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 547 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 548 | }; |
| 549 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 550 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 551 | #define alc_pin_mode_n_items(_dir) \ |
| 552 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 553 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 555 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 556 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 557 | unsigned int item_num = uinfo->value.enumerated.item; |
| 558 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 559 | |
| 560 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 561 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 562 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 563 | |
| 564 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 565 | item_num = alc_pin_mode_min(dir); |
| 566 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 567 | return 0; |
| 568 | } |
| 569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 570 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 571 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 572 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 573 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 574 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 575 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 576 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 577 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 578 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 579 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 580 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 581 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | /* Find enumerated value for current pinctl setting */ |
| 583 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 584 | 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] | 585 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 586 | *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] | 587 | return 0; |
| 588 | } |
| 589 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 590 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 591 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 592 | { |
| 593 | signed int change; |
| 594 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 595 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 596 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 597 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 598 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 599 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 600 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 601 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 602 | 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] | 603 | val = alc_pin_mode_min(dir); |
| 604 | |
| 605 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 606 | if (change) { |
| 607 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 608 | snd_hda_codec_write_cache(codec, nid, 0, |
| 609 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 610 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 611 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 612 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 613 | * for the requested pin mode. Enum values of 2 or less are |
| 614 | * input modes. |
| 615 | * |
| 616 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 617 | * reduces noise slightly (particularly on input) so we'll |
| 618 | * do it. However, having both input and output buffers |
| 619 | * enabled simultaneously doesn't seem to be problematic if |
| 620 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 621 | */ |
| 622 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 623 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 624 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 625 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 626 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 627 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 628 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 629 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 630 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 631 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 632 | } |
| 633 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 634 | return change; |
| 635 | } |
| 636 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 637 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 638 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 639 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 640 | .info = alc_pin_mode_info, \ |
| 641 | .get = alc_pin_mode_get, \ |
| 642 | .put = alc_pin_mode_put, \ |
| 643 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 644 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 645 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 646 | * together using a mask with more than one bit set. This control is |
| 647 | * currently used only by the ALC260 test model. At this stage they are not |
| 648 | * needed for any "production" models. |
| 649 | */ |
| 650 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 651 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 652 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 653 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 655 | { |
| 656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 657 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 658 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 659 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 660 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 661 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 662 | |
| 663 | *valp = (val & mask) != 0; |
| 664 | return 0; |
| 665 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 666 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 667 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 668 | { |
| 669 | signed int change; |
| 670 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 671 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 672 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 673 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 674 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 675 | AC_VERB_GET_GPIO_DATA, |
| 676 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 677 | |
| 678 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 680 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 681 | gpio_data &= ~mask; |
| 682 | else |
| 683 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 684 | snd_hda_codec_write_cache(codec, nid, 0, |
| 685 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 686 | |
| 687 | return change; |
| 688 | } |
| 689 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 690 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 691 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 692 | .info = alc_gpio_data_info, \ |
| 693 | .get = alc_gpio_data_get, \ |
| 694 | .put = alc_gpio_data_put, \ |
| 695 | .private_value = nid | (mask<<16) } |
| 696 | #endif /* CONFIG_SND_DEBUG */ |
| 697 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 698 | /* A switch control to allow the enabling of the digital IO pins on the |
| 699 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 700 | * to provide something in the test model allowing digital outputs to be |
| 701 | * identified if present. If models are found which can utilise these |
| 702 | * outputs a more complete mixer control can be devised for those models if |
| 703 | * necessary. |
| 704 | */ |
| 705 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 706 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 707 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 709 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 710 | { |
| 711 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 712 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 713 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 714 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 715 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 716 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 717 | |
| 718 | *valp = (val & mask) != 0; |
| 719 | return 0; |
| 720 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 721 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 722 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 723 | { |
| 724 | signed int change; |
| 725 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 726 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 727 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 728 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 729 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 730 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 731 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 732 | |
| 733 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 734 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 735 | if (val==0) |
| 736 | ctrl_data &= ~mask; |
| 737 | else |
| 738 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 739 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 740 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 741 | |
| 742 | return change; |
| 743 | } |
| 744 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 745 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 746 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 747 | .info = alc_spdif_ctrl_info, \ |
| 748 | .get = alc_spdif_ctrl_get, \ |
| 749 | .put = alc_spdif_ctrl_put, \ |
| 750 | .private_value = nid | (mask<<16) } |
| 751 | #endif /* CONFIG_SND_DEBUG */ |
| 752 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 753 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 754 | * Again, this is only used in the ALC26x test models to help identify when |
| 755 | * the EAPD line must be asserted for features to work. |
| 756 | */ |
| 757 | #ifdef CONFIG_SND_DEBUG |
| 758 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 759 | |
| 760 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 761 | struct snd_ctl_elem_value *ucontrol) |
| 762 | { |
| 763 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 764 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 765 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 766 | long *valp = ucontrol->value.integer.value; |
| 767 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 768 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 769 | |
| 770 | *valp = (val & mask) != 0; |
| 771 | return 0; |
| 772 | } |
| 773 | |
| 774 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 775 | struct snd_ctl_elem_value *ucontrol) |
| 776 | { |
| 777 | int change; |
| 778 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 779 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 780 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 781 | long val = *ucontrol->value.integer.value; |
| 782 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 783 | AC_VERB_GET_EAPD_BTLENABLE, |
| 784 | 0x00); |
| 785 | |
| 786 | /* Set/unset the masked control bit(s) as needed */ |
| 787 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 788 | if (!val) |
| 789 | ctrl_data &= ~mask; |
| 790 | else |
| 791 | ctrl_data |= mask; |
| 792 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 793 | ctrl_data); |
| 794 | |
| 795 | return change; |
| 796 | } |
| 797 | |
| 798 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 799 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 800 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 801 | .info = alc_eapd_ctrl_info, \ |
| 802 | .get = alc_eapd_ctrl_get, \ |
| 803 | .put = alc_eapd_ctrl_put, \ |
| 804 | .private_value = nid | (mask<<16) } |
| 805 | #endif /* CONFIG_SND_DEBUG */ |
| 806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 807 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 808 | * set up the input pin config (depending on the given auto-pin type) |
| 809 | */ |
| 810 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 811 | int auto_pin_type) |
| 812 | { |
| 813 | unsigned int val = PIN_IN; |
| 814 | |
| 815 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 816 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 817 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 818 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 819 | if (pincap & AC_PINCAP_VREF_80) |
| 820 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 821 | else if (pincap & AC_PINCAP_VREF_50) |
| 822 | val = PIN_VREF50; |
| 823 | else if (pincap & AC_PINCAP_VREF_100) |
| 824 | val = PIN_VREF100; |
| 825 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 826 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 827 | } |
| 828 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 829 | } |
| 830 | |
| 831 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 832 | */ |
| 833 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 834 | { |
| 835 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 836 | return; |
| 837 | spec->mixers[spec->num_mixers++] = mix; |
| 838 | } |
| 839 | |
| 840 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 841 | { |
| 842 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 843 | return; |
| 844 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 845 | } |
| 846 | |
| 847 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 848 | * set up from the preset table |
| 849 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 850 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 851 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 852 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 853 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 854 | int i; |
| 855 | |
| 856 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 857 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 858 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 859 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 860 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 861 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 862 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 863 | spec->channel_mode = preset->channel_mode; |
| 864 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 865 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 866 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 867 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 868 | if (preset->const_channel_count) |
| 869 | spec->multiout.max_channels = preset->const_channel_count; |
| 870 | else |
| 871 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 872 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 873 | |
| 874 | spec->multiout.num_dacs = preset->num_dacs; |
| 875 | spec->multiout.dac_nids = preset->dac_nids; |
| 876 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 877 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 878 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 879 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 880 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 881 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 882 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 883 | spec->input_mux = preset->input_mux; |
| 884 | |
| 885 | spec->num_adc_nids = preset->num_adc_nids; |
| 886 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 887 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 888 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 889 | |
| 890 | spec->unsol_event = preset->unsol_event; |
| 891 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 892 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 893 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 894 | spec->loopback.amplist = preset->loopbacks; |
| 895 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 896 | |
| 897 | if (preset->setup) |
| 898 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 899 | } |
| 900 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 901 | /* Enable GPIO mask and set output */ |
| 902 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 903 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 904 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 905 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 906 | { } |
| 907 | }; |
| 908 | |
| 909 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 910 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 911 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 912 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 913 | { } |
| 914 | }; |
| 915 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 916 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 917 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 919 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 920 | { } |
| 921 | }; |
| 922 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 923 | /* |
| 924 | * Fix hardware PLL issue |
| 925 | * On some codecs, the analog PLL gating control must be off while |
| 926 | * the default value is 1. |
| 927 | */ |
| 928 | static void alc_fix_pll(struct hda_codec *codec) |
| 929 | { |
| 930 | struct alc_spec *spec = codec->spec; |
| 931 | unsigned int val; |
| 932 | |
| 933 | if (!spec->pll_nid) |
| 934 | return; |
| 935 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 936 | spec->pll_coef_idx); |
| 937 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 938 | AC_VERB_GET_PROC_COEF, 0); |
| 939 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 940 | spec->pll_coef_idx); |
| 941 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 942 | val & ~(1 << spec->pll_coef_bit)); |
| 943 | } |
| 944 | |
| 945 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 946 | unsigned int coef_idx, unsigned int coef_bit) |
| 947 | { |
| 948 | struct alc_spec *spec = codec->spec; |
| 949 | spec->pll_nid = nid; |
| 950 | spec->pll_coef_idx = coef_idx; |
| 951 | spec->pll_coef_bit = coef_bit; |
| 952 | alc_fix_pll(codec); |
| 953 | } |
| 954 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 955 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 956 | { |
| 957 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 958 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 959 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 960 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 961 | if (!nid) |
| 962 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 963 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 964 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 965 | nid = spec->autocfg.speaker_pins[i]; |
| 966 | if (!nid) |
| 967 | break; |
| 968 | snd_hda_codec_write(codec, nid, 0, |
| 969 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 970 | spec->jack_present ? 0 : PIN_OUT); |
| 971 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 972 | } |
| 973 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 974 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 975 | hda_nid_t nid) |
| 976 | { |
| 977 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 978 | int i, nums; |
| 979 | |
| 980 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 981 | for (i = 0; i < nums; i++) |
| 982 | if (conn[i] == nid) |
| 983 | return i; |
| 984 | return -1; |
| 985 | } |
| 986 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 987 | static void alc_mic_automute(struct hda_codec *codec) |
| 988 | { |
| 989 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 990 | struct alc_mic_route *dead, *alive; |
| 991 | unsigned int present, type; |
| 992 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 993 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 994 | if (!spec->auto_mic) |
| 995 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 996 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 997 | return; |
| 998 | if (snd_BUG_ON(!spec->adc_nids)) |
| 999 | return; |
| 1000 | |
| 1001 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1002 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1003 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1004 | if (present) { |
| 1005 | alive = &spec->ext_mic; |
| 1006 | dead = &spec->int_mic; |
| 1007 | } else { |
| 1008 | alive = &spec->int_mic; |
| 1009 | dead = &spec->ext_mic; |
| 1010 | } |
| 1011 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1012 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1013 | if (type == AC_WID_AUD_MIX) { |
| 1014 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1015 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1016 | alive->mux_idx, |
| 1017 | HDA_AMP_MUTE, 0); |
| 1018 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1019 | dead->mux_idx, |
| 1020 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1021 | } else { |
| 1022 | /* MUX style (e.g. ALC880) */ |
| 1023 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1024 | AC_VERB_SET_CONNECT_SEL, |
| 1025 | alive->mux_idx); |
| 1026 | } |
| 1027 | |
| 1028 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1029 | } |
| 1030 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1031 | /* unsolicited event for HP jack sensing */ |
| 1032 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1033 | { |
| 1034 | if (codec->vendor_id == 0x10ec0880) |
| 1035 | res >>= 28; |
| 1036 | else |
| 1037 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1038 | switch (res) { |
| 1039 | case ALC880_HP_EVENT: |
| 1040 | alc_automute_pin(codec); |
| 1041 | break; |
| 1042 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1043 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1044 | break; |
| 1045 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | static void alc_inithook(struct hda_codec *codec) |
| 1049 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1050 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1051 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1052 | } |
| 1053 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1054 | /* additional initialization for ALC888 variants */ |
| 1055 | static void alc888_coef_init(struct hda_codec *codec) |
| 1056 | { |
| 1057 | unsigned int tmp; |
| 1058 | |
| 1059 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1060 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1061 | 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] | 1062 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1063 | /* alc888S-VC */ |
| 1064 | snd_hda_codec_read(codec, 0x20, 0, |
| 1065 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1066 | else |
| 1067 | /* alc888-VB */ |
| 1068 | snd_hda_codec_read(codec, 0x20, 0, |
| 1069 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1070 | } |
| 1071 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1072 | static void alc889_coef_init(struct hda_codec *codec) |
| 1073 | { |
| 1074 | unsigned int tmp; |
| 1075 | |
| 1076 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1077 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1078 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1079 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1080 | } |
| 1081 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1082 | /* turn on/off EAPD control (only if available) */ |
| 1083 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1084 | { |
| 1085 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1086 | return; |
| 1087 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1088 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1089 | on ? 2 : 0); |
| 1090 | } |
| 1091 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1092 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1093 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1094 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1095 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | switch (type) { |
| 1097 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1098 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1099 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1100 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1101 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1102 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1103 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1104 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1105 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1106 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1107 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1108 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1109 | set_eapd(codec, 0x0f, 1); |
| 1110 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1111 | break; |
| 1112 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1113 | case 0x10ec0267: |
| 1114 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1115 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1116 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1117 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1118 | case 0x10ec0660: |
| 1119 | case 0x10ec0662: |
| 1120 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1121 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1122 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1123 | set_eapd(codec, 0x14, 1); |
| 1124 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1125 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1126 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1127 | switch (codec->vendor_id) { |
| 1128 | case 0x10ec0260: |
| 1129 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1130 | AC_VERB_SET_COEF_INDEX, 7); |
| 1131 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1132 | AC_VERB_GET_PROC_COEF, 0); |
| 1133 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1134 | AC_VERB_SET_COEF_INDEX, 7); |
| 1135 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1136 | AC_VERB_SET_PROC_COEF, |
| 1137 | tmp | 0x2010); |
| 1138 | break; |
| 1139 | case 0x10ec0262: |
| 1140 | case 0x10ec0880: |
| 1141 | case 0x10ec0882: |
| 1142 | case 0x10ec0883: |
| 1143 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1144 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1145 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1146 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1147 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1148 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1149 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1150 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1151 | #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] | 1152 | case 0x10ec0267: |
| 1153 | case 0x10ec0268: |
| 1154 | snd_hda_codec_write(codec, 0x20, 0, |
| 1155 | AC_VERB_SET_COEF_INDEX, 7); |
| 1156 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1157 | AC_VERB_GET_PROC_COEF, 0); |
| 1158 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1159 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1160 | snd_hda_codec_write(codec, 0x20, 0, |
| 1161 | AC_VERB_SET_PROC_COEF, |
| 1162 | tmp | 0x3000); |
| 1163 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1164 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1165 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1166 | break; |
| 1167 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1168 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1169 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1170 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1171 | { |
| 1172 | struct alc_spec *spec = codec->spec; |
| 1173 | |
| 1174 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1175 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1176 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1177 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1178 | if (spec->autocfg.line_out_pins[0] && |
| 1179 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1181 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1182 | else |
| 1183 | return; |
| 1184 | } |
| 1185 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1186 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1187 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1188 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1189 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1190 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1191 | spec->unsol_event = alc_sku_unsol_event; |
| 1192 | } |
| 1193 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1194 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1195 | { |
| 1196 | struct alc_spec *spec = codec->spec; |
| 1197 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1198 | hda_nid_t fixed, ext; |
| 1199 | int i; |
| 1200 | |
| 1201 | /* there must be only two mic inputs exclusively */ |
| 1202 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1203 | if (cfg->input_pins[i]) |
| 1204 | return; |
| 1205 | |
| 1206 | fixed = ext = 0; |
| 1207 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1208 | hda_nid_t nid = cfg->input_pins[i]; |
| 1209 | unsigned int defcfg; |
| 1210 | if (!nid) |
| 1211 | return; |
| 1212 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1213 | switch (get_defcfg_connect(defcfg)) { |
| 1214 | case AC_JACK_PORT_FIXED: |
| 1215 | if (fixed) |
| 1216 | return; /* already occupied */ |
| 1217 | fixed = nid; |
| 1218 | break; |
| 1219 | case AC_JACK_PORT_COMPLEX: |
| 1220 | if (ext) |
| 1221 | return; /* already occupied */ |
| 1222 | ext = nid; |
| 1223 | break; |
| 1224 | default: |
| 1225 | return; /* invalid entry */ |
| 1226 | } |
| 1227 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1228 | if (!ext || !fixed) |
| 1229 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1230 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1231 | return; /* no unsol support */ |
| 1232 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1233 | ext, fixed); |
| 1234 | spec->ext_mic.pin = ext; |
| 1235 | spec->int_mic.pin = fixed; |
| 1236 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1237 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1238 | spec->auto_mic = 1; |
| 1239 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1240 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1241 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1242 | spec->unsol_event = alc_sku_unsol_event; |
| 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | /* check subsystem ID and set up device-specific initialization; |
| 1246 | * return 1 if initialized, 0 if invalid SSID |
| 1247 | */ |
| 1248 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1249 | * 31 ~ 16 : Manufacture ID |
| 1250 | * 15 ~ 8 : SKU ID |
| 1251 | * 7 ~ 0 : Assembly ID |
| 1252 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1253 | */ |
| 1254 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1255 | hda_nid_t porta, hda_nid_t porte, |
| 1256 | hda_nid_t portd) |
| 1257 | { |
| 1258 | unsigned int ass, tmp, i; |
| 1259 | unsigned nid; |
| 1260 | struct alc_spec *spec = codec->spec; |
| 1261 | |
| 1262 | ass = codec->subsystem_id & 0xffff; |
| 1263 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1264 | goto do_sku; |
| 1265 | |
| 1266 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1267 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1268 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1269 | * 29~21 : reserve |
| 1270 | * 20 : PCBEEP input |
| 1271 | * 19~16 : Check sum (15:1) |
| 1272 | * 15~1 : Custom |
| 1273 | * 0 : override |
| 1274 | */ |
| 1275 | nid = 0x1d; |
| 1276 | if (codec->vendor_id == 0x10ec0260) |
| 1277 | nid = 0x17; |
| 1278 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1279 | snd_printd("realtek: No valid SSID, " |
| 1280 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1281 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1282 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1283 | return 0; |
| 1284 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1285 | return 0; |
| 1286 | |
| 1287 | /* check sum */ |
| 1288 | tmp = 0; |
| 1289 | for (i = 1; i < 16; i++) { |
| 1290 | if ((ass >> i) & 1) |
| 1291 | tmp++; |
| 1292 | } |
| 1293 | if (((ass >> 16) & 0xf) != tmp) |
| 1294 | return 0; |
| 1295 | do_sku: |
| 1296 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1297 | ass & 0xffff, codec->vendor_id); |
| 1298 | /* |
| 1299 | * 0 : override |
| 1300 | * 1 : Swap Jack |
| 1301 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1302 | * 3~5 : External Amplifier control |
| 1303 | * 7~6 : Reserved |
| 1304 | */ |
| 1305 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1306 | switch (tmp) { |
| 1307 | case 1: |
| 1308 | spec->init_amp = ALC_INIT_GPIO1; |
| 1309 | break; |
| 1310 | case 3: |
| 1311 | spec->init_amp = ALC_INIT_GPIO2; |
| 1312 | break; |
| 1313 | case 7: |
| 1314 | spec->init_amp = ALC_INIT_GPIO3; |
| 1315 | break; |
| 1316 | case 5: |
| 1317 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1318 | break; |
| 1319 | } |
| 1320 | |
| 1321 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1322 | * when the external headphone out jack is plugged" |
| 1323 | */ |
| 1324 | if (!(ass & 0x8000)) |
| 1325 | return 1; |
| 1326 | /* |
| 1327 | * 10~8 : Jack location |
| 1328 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1329 | * 14~13: Resvered |
| 1330 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1331 | * when the external headphone out jack is plugged" |
| 1332 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1333 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1334 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1335 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1336 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1337 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1338 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1339 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1340 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1341 | nid = portd; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1342 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1343 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1344 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1345 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1346 | return 1; |
| 1347 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1348 | } |
| 1349 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1350 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1351 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1352 | return 1; |
| 1353 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1354 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1355 | static void alc_ssid_check(struct hda_codec *codec, |
| 1356 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1357 | { |
| 1358 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1359 | struct alc_spec *spec = codec->spec; |
| 1360 | snd_printd("realtek: " |
| 1361 | "Enable default setup for auto mode as fallback\n"); |
| 1362 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1363 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1364 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1365 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1366 | } |
| 1367 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1368 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1369 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1370 | */ |
| 1371 | |
| 1372 | struct alc_pincfg { |
| 1373 | hda_nid_t nid; |
| 1374 | u32 val; |
| 1375 | }; |
| 1376 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1377 | struct alc_fixup { |
| 1378 | const struct alc_pincfg *pins; |
| 1379 | const struct hda_verb *verbs; |
| 1380 | }; |
| 1381 | |
| 1382 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1383 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1384 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1385 | { |
| 1386 | const struct alc_pincfg *cfg; |
| 1387 | |
| 1388 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1389 | if (!quirk) |
| 1390 | return; |
| 1391 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1392 | fix += quirk->value; |
| 1393 | cfg = fix->pins; |
| 1394 | if (cfg) { |
| 1395 | for (; cfg->nid; cfg++) |
| 1396 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1397 | } |
| 1398 | if (fix->verbs) |
| 1399 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1400 | } |
| 1401 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1402 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1403 | unsigned int coef_idx) |
| 1404 | { |
| 1405 | unsigned int val; |
| 1406 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1407 | coef_idx); |
| 1408 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1409 | AC_VERB_GET_PROC_COEF, 0); |
| 1410 | return val; |
| 1411 | } |
| 1412 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1413 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1414 | * ALC888 |
| 1415 | */ |
| 1416 | |
| 1417 | /* |
| 1418 | * 2ch mode |
| 1419 | */ |
| 1420 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1421 | /* Mic-in jack as mic in */ |
| 1422 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1423 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1424 | /* Line-in jack as Line in */ |
| 1425 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1426 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1427 | /* Line-Out as Front */ |
| 1428 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1429 | { } /* end */ |
| 1430 | }; |
| 1431 | |
| 1432 | /* |
| 1433 | * 4ch mode |
| 1434 | */ |
| 1435 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1436 | /* Mic-in jack as mic in */ |
| 1437 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1438 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1439 | /* Line-in jack as Surround */ |
| 1440 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1441 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1442 | /* Line-Out as Front */ |
| 1443 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1444 | { } /* end */ |
| 1445 | }; |
| 1446 | |
| 1447 | /* |
| 1448 | * 6ch mode |
| 1449 | */ |
| 1450 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1451 | /* Mic-in jack as CLFE */ |
| 1452 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1453 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1454 | /* Line-in jack as Surround */ |
| 1455 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1456 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1457 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1458 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1459 | { } /* end */ |
| 1460 | }; |
| 1461 | |
| 1462 | /* |
| 1463 | * 8ch mode |
| 1464 | */ |
| 1465 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1466 | /* Mic-in jack as CLFE */ |
| 1467 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1468 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1469 | /* Line-in jack as Surround */ |
| 1470 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1471 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1472 | /* Line-Out as Side */ |
| 1473 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1474 | { } /* end */ |
| 1475 | }; |
| 1476 | |
| 1477 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1478 | { 2, alc888_4ST_ch2_intel_init }, |
| 1479 | { 4, alc888_4ST_ch4_intel_init }, |
| 1480 | { 6, alc888_4ST_ch6_intel_init }, |
| 1481 | { 8, alc888_4ST_ch8_intel_init }, |
| 1482 | }; |
| 1483 | |
| 1484 | /* |
| 1485 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1486 | */ |
| 1487 | |
| 1488 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1489 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1490 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1491 | /* Connect Internal HP to Front */ |
| 1492 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1493 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1494 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1495 | /* Connect Bass HP to Front */ |
| 1496 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1498 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1499 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1500 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1501 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1502 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1503 | /* Connect Mic jack to CLFE */ |
| 1504 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1505 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1506 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1507 | /* Connect Line-in jack to Surround */ |
| 1508 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1510 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1511 | /* Connect HP out jack to Front */ |
| 1512 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1513 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1514 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1515 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1516 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1517 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1518 | {} |
| 1519 | }; |
| 1520 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1521 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1522 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1523 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1524 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1525 | hda_nid_t nid; |
| 1526 | int i; |
| 1527 | |
| 1528 | spec->jack_present = 0; |
| 1529 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1530 | nid = spec->autocfg.hp_pins[i]; |
| 1531 | if (!nid) |
| 1532 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1533 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1534 | spec->jack_present = 1; |
| 1535 | break; |
| 1536 | } |
| 1537 | } |
| 1538 | |
| 1539 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1540 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1541 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1542 | nid = spec->autocfg.speaker_pins[i]; |
| 1543 | if (!nid) |
| 1544 | break; |
| 1545 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1546 | HDA_AMP_MUTE, mute); |
| 1547 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1548 | } |
| 1549 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1550 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1551 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1552 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1553 | if (codec->vendor_id == 0x10ec0880) |
| 1554 | res >>= 28; |
| 1555 | else |
| 1556 | res >>= 26; |
| 1557 | if (res == ALC880_HP_EVENT) |
| 1558 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1559 | } |
| 1560 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1561 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1562 | { |
| 1563 | struct alc_spec *spec = codec->spec; |
| 1564 | |
| 1565 | spec->autocfg.hp_pins[0] = 0x15; |
| 1566 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1567 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1568 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1569 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1570 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1571 | } |
| 1572 | |
| 1573 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1574 | { |
| 1575 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1576 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1577 | } |
| 1578 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1579 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1580 | { |
| 1581 | struct alc_spec *spec = codec->spec; |
| 1582 | |
| 1583 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1584 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1585 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1586 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1587 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1588 | |
| 1589 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1590 | * ALC888 Acer Aspire 4930G model |
| 1591 | */ |
| 1592 | |
| 1593 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1594 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1595 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1596 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1597 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1598 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1599 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1600 | /* Connect Internal HP to front */ |
| 1601 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1602 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1603 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1604 | /* Connect HP out to front */ |
| 1605 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1606 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1607 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1608 | { } |
| 1609 | }; |
| 1610 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1611 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1612 | * ALC888 Acer Aspire 6530G model |
| 1613 | */ |
| 1614 | |
| 1615 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1616 | /* Bias voltage on for external mic port */ |
| 1617 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1618 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1619 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1620 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1622 | /* Enable unsolicited event for HP jack */ |
| 1623 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1624 | /* Enable speaker output */ |
| 1625 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1626 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1627 | /* Enable headphone output */ |
| 1628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1629 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1630 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1631 | { } |
| 1632 | }; |
| 1633 | |
| 1634 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1635 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1636 | */ |
| 1637 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1638 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1639 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1640 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1641 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1642 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1643 | /* Enable unsolicited event for HP jack */ |
| 1644 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1645 | /* Connect Internal Front to Front */ |
| 1646 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1648 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1649 | /* Connect Internal Rear to Rear */ |
| 1650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1651 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1652 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1653 | /* Connect Internal CLFE to CLFE */ |
| 1654 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1655 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1656 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1657 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1658 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1659 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1660 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1661 | /* Enable all DACs */ |
| 1662 | /* DAC DISABLE/MUTE 1? */ |
| 1663 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1664 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1665 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1666 | /* DAC DISABLE/MUTE 2? */ |
| 1667 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1668 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1669 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1670 | /* DMIC fix |
| 1671 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1672 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1673 | * makes the signal become a difference/sum signal instead of standard |
| 1674 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1675 | * codec replicate the sum signal to both channels, turning it into a |
| 1676 | * normal mono mic. |
| 1677 | */ |
| 1678 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1679 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1680 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1681 | { } |
| 1682 | }; |
| 1683 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1684 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1685 | /* Front mic only available on one ADC */ |
| 1686 | { |
| 1687 | .num_items = 4, |
| 1688 | .items = { |
| 1689 | { "Mic", 0x0 }, |
| 1690 | { "Line", 0x2 }, |
| 1691 | { "CD", 0x4 }, |
| 1692 | { "Front Mic", 0xb }, |
| 1693 | }, |
| 1694 | }, |
| 1695 | { |
| 1696 | .num_items = 3, |
| 1697 | .items = { |
| 1698 | { "Mic", 0x0 }, |
| 1699 | { "Line", 0x2 }, |
| 1700 | { "CD", 0x4 }, |
| 1701 | }, |
| 1702 | } |
| 1703 | }; |
| 1704 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1705 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1706 | /* Interal mic only available on one ADC */ |
| 1707 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1708 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1709 | .items = { |
| 1710 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1711 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1712 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1713 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1714 | { "Int Mic", 0xb }, |
| 1715 | }, |
| 1716 | }, |
| 1717 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1718 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1719 | .items = { |
| 1720 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1721 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1722 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1723 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1724 | }, |
| 1725 | } |
| 1726 | }; |
| 1727 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1728 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1729 | /* Digital mic only available on first "ADC" */ |
| 1730 | { |
| 1731 | .num_items = 5, |
| 1732 | .items = { |
| 1733 | { "Mic", 0x0 }, |
| 1734 | { "Line", 0x2 }, |
| 1735 | { "CD", 0x4 }, |
| 1736 | { "Front Mic", 0xb }, |
| 1737 | { "Input Mix", 0xa }, |
| 1738 | }, |
| 1739 | }, |
| 1740 | { |
| 1741 | .num_items = 4, |
| 1742 | .items = { |
| 1743 | { "Mic", 0x0 }, |
| 1744 | { "Line", 0x2 }, |
| 1745 | { "CD", 0x4 }, |
| 1746 | { "Input Mix", 0xa }, |
| 1747 | }, |
| 1748 | }, |
| 1749 | { |
| 1750 | .num_items = 4, |
| 1751 | .items = { |
| 1752 | { "Mic", 0x0 }, |
| 1753 | { "Line", 0x2 }, |
| 1754 | { "CD", 0x4 }, |
| 1755 | { "Input Mix", 0xa }, |
| 1756 | }, |
| 1757 | } |
| 1758 | }; |
| 1759 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1760 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1762 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1763 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1764 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1765 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1766 | HDA_OUTPUT), |
| 1767 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1768 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1769 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1770 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1771 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1772 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1773 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1777 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1779 | { } /* end */ |
| 1780 | }; |
| 1781 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1782 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1783 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1784 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1785 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1786 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1787 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1788 | HDA_OUTPUT), |
| 1789 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1790 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1791 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1792 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1793 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1795 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1797 | { } /* end */ |
| 1798 | }; |
| 1799 | |
| 1800 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1801 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1802 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1803 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1804 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1805 | spec->autocfg.hp_pins[0] = 0x15; |
| 1806 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1807 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1808 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1809 | } |
| 1810 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1811 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1812 | { |
| 1813 | struct alc_spec *spec = codec->spec; |
| 1814 | |
| 1815 | spec->autocfg.hp_pins[0] = 0x15; |
| 1816 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1817 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1818 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1819 | } |
| 1820 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1821 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1822 | { |
| 1823 | struct alc_spec *spec = codec->spec; |
| 1824 | |
| 1825 | spec->autocfg.hp_pins[0] = 0x15; |
| 1826 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1827 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1828 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1829 | } |
| 1830 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1831 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | * ALC880 3-stack model |
| 1833 | * |
| 1834 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1835 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1836 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1837 | */ |
| 1838 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1839 | static hda_nid_t alc880_dac_nids[4] = { |
| 1840 | /* front, rear, clfe, rear_surr */ |
| 1841 | 0x02, 0x05, 0x04, 0x03 |
| 1842 | }; |
| 1843 | |
| 1844 | static hda_nid_t alc880_adc_nids[3] = { |
| 1845 | /* ADC0-2 */ |
| 1846 | 0x07, 0x08, 0x09, |
| 1847 | }; |
| 1848 | |
| 1849 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1850 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1851 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1852 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1853 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1854 | /* ADC1-2 */ |
| 1855 | 0x08, 0x09, |
| 1856 | }; |
| 1857 | |
| 1858 | #define ALC880_DIGOUT_NID 0x06 |
| 1859 | #define ALC880_DIGIN_NID 0x0a |
| 1860 | |
| 1861 | static struct hda_input_mux alc880_capture_source = { |
| 1862 | .num_items = 4, |
| 1863 | .items = { |
| 1864 | { "Mic", 0x0 }, |
| 1865 | { "Front Mic", 0x3 }, |
| 1866 | { "Line", 0x2 }, |
| 1867 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1868 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1869 | }; |
| 1870 | |
| 1871 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1872 | /* 2ch mode */ |
| 1873 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1874 | /* set line-in to input, mute it */ |
| 1875 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1876 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1877 | /* set mic-in to input vref 80%, mute it */ |
| 1878 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1879 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1880 | { } /* end */ |
| 1881 | }; |
| 1882 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1883 | /* 6ch mode */ |
| 1884 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1885 | /* set line-in to output, unmute it */ |
| 1886 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1887 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1888 | /* set mic-in to output, unmute it */ |
| 1889 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1890 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1891 | { } /* end */ |
| 1892 | }; |
| 1893 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1894 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1895 | { 2, alc880_threestack_ch2_init }, |
| 1896 | { 6, alc880_threestack_ch6_init }, |
| 1897 | }; |
| 1898 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1899 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1900 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1901 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1902 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1903 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1904 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1905 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 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), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1908 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1909 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1910 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1911 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1914 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1915 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1916 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1917 | { |
| 1918 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1919 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1920 | .info = alc_ch_mode_info, |
| 1921 | .get = alc_ch_mode_get, |
| 1922 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1923 | }, |
| 1924 | { } /* end */ |
| 1925 | }; |
| 1926 | |
| 1927 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1928 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1929 | struct snd_ctl_elem_info *uinfo) |
| 1930 | { |
| 1931 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1932 | struct alc_spec *spec = codec->spec; |
| 1933 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1934 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1935 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1936 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1937 | HDA_INPUT); |
| 1938 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1939 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1940 | return err; |
| 1941 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1942 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1943 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1944 | unsigned int size, unsigned int __user *tlv) |
| 1945 | { |
| 1946 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1947 | struct alc_spec *spec = codec->spec; |
| 1948 | int err; |
| 1949 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1950 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1951 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1952 | HDA_INPUT); |
| 1953 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1954 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1955 | return err; |
| 1956 | } |
| 1957 | |
| 1958 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1959 | struct snd_ctl_elem_value *ucontrol); |
| 1960 | |
| 1961 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1962 | struct snd_ctl_elem_value *ucontrol, |
| 1963 | getput_call_t func) |
| 1964 | { |
| 1965 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1966 | struct alc_spec *spec = codec->spec; |
| 1967 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1968 | int err; |
| 1969 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1970 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1971 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1972 | 3, 0, HDA_INPUT); |
| 1973 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1974 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1975 | return err; |
| 1976 | } |
| 1977 | |
| 1978 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1979 | struct snd_ctl_elem_value *ucontrol) |
| 1980 | { |
| 1981 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1982 | snd_hda_mixer_amp_volume_get); |
| 1983 | } |
| 1984 | |
| 1985 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1986 | struct snd_ctl_elem_value *ucontrol) |
| 1987 | { |
| 1988 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1989 | snd_hda_mixer_amp_volume_put); |
| 1990 | } |
| 1991 | |
| 1992 | /* capture mixer elements */ |
| 1993 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1994 | |
| 1995 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1996 | struct snd_ctl_elem_value *ucontrol) |
| 1997 | { |
| 1998 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1999 | snd_hda_mixer_amp_switch_get); |
| 2000 | } |
| 2001 | |
| 2002 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2003 | struct snd_ctl_elem_value *ucontrol) |
| 2004 | { |
| 2005 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2006 | snd_hda_mixer_amp_switch_put); |
| 2007 | } |
| 2008 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2009 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2010 | { \ |
| 2011 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2012 | .name = "Capture Switch", \ |
| 2013 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2014 | .count = num, \ |
| 2015 | .info = alc_cap_sw_info, \ |
| 2016 | .get = alc_cap_sw_get, \ |
| 2017 | .put = alc_cap_sw_put, \ |
| 2018 | }, \ |
| 2019 | { \ |
| 2020 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2021 | .name = "Capture Volume", \ |
| 2022 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2023 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2024 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2025 | .count = num, \ |
| 2026 | .info = alc_cap_vol_info, \ |
| 2027 | .get = alc_cap_vol_get, \ |
| 2028 | .put = alc_cap_vol_put, \ |
| 2029 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2033 | { \ |
| 2034 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2035 | /* .name = "Capture Source", */ \ |
| 2036 | .name = "Input Source", \ |
| 2037 | .count = num, \ |
| 2038 | .info = alc_mux_enum_info, \ |
| 2039 | .get = alc_mux_enum_get, \ |
| 2040 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2041 | } |
| 2042 | |
| 2043 | #define DEFINE_CAPMIX(num) \ |
| 2044 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2045 | _DEFINE_CAPMIX(num), \ |
| 2046 | _DEFINE_CAPSRC(num), \ |
| 2047 | { } /* end */ \ |
| 2048 | } |
| 2049 | |
| 2050 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2051 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2052 | _DEFINE_CAPMIX(num), \ |
| 2053 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | /* up to three ADCs */ |
| 2057 | DEFINE_CAPMIX(1); |
| 2058 | DEFINE_CAPMIX(2); |
| 2059 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2060 | DEFINE_CAPMIX_NOSRC(1); |
| 2061 | DEFINE_CAPMIX_NOSRC(2); |
| 2062 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2063 | |
| 2064 | /* |
| 2065 | * ALC880 5-stack model |
| 2066 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2067 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2068 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2069 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2070 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2071 | */ |
| 2072 | |
| 2073 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2074 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2075 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2076 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2077 | { } /* end */ |
| 2078 | }; |
| 2079 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2080 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2081 | /* 6ch mode */ |
| 2082 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2083 | /* set line-in to input, mute it */ |
| 2084 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2085 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2086 | { } /* end */ |
| 2087 | }; |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* 8ch mode */ |
| 2090 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2091 | /* set line-in to output, unmute it */ |
| 2092 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2093 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2094 | { } /* end */ |
| 2095 | }; |
| 2096 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2097 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2098 | { 6, alc880_fivestack_ch6_init }, |
| 2099 | { 8, alc880_fivestack_ch8_init }, |
| 2100 | }; |
| 2101 | |
| 2102 | |
| 2103 | /* |
| 2104 | * ALC880 6-stack model |
| 2105 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2106 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2107 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2108 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2109 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2110 | */ |
| 2111 | |
| 2112 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2113 | /* front, rear, clfe, rear_surr */ |
| 2114 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2115 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2116 | |
| 2117 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2118 | .num_items = 4, |
| 2119 | .items = { |
| 2120 | { "Mic", 0x0 }, |
| 2121 | { "Front Mic", 0x1 }, |
| 2122 | { "Line", 0x2 }, |
| 2123 | { "CD", 0x4 }, |
| 2124 | }, |
| 2125 | }; |
| 2126 | |
| 2127 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2128 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2129 | { 8, NULL }, |
| 2130 | }; |
| 2131 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2132 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2133 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2134 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2135 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2136 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2137 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2138 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2139 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2140 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2141 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2142 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2143 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2144 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2145 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2146 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2147 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2148 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2149 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2150 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2151 | { |
| 2152 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2153 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2154 | .info = alc_ch_mode_info, |
| 2155 | .get = alc_ch_mode_get, |
| 2156 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2157 | }, |
| 2158 | { } /* end */ |
| 2159 | }; |
| 2160 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2161 | |
| 2162 | /* |
| 2163 | * ALC880 W810 model |
| 2164 | * |
| 2165 | * W810 has rear IO for: |
| 2166 | * Front (DAC 02) |
| 2167 | * Surround (DAC 03) |
| 2168 | * Center/LFE (DAC 04) |
| 2169 | * Digital out (06) |
| 2170 | * |
| 2171 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2172 | * 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] | 2173 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2174 | * There is a variable resistor to control the speaker or headphone |
| 2175 | * volume. This is a hardware-only device without a software API. |
| 2176 | * |
| 2177 | * Plugging headphones in will disable the internal speakers. This is |
| 2178 | * implemented in hardware, not via the driver using jack sense. In |
| 2179 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2180 | * disable both the speakers and headphones. |
| 2181 | * |
| 2182 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2183 | * These may not do anything useful with this driver yet, because I |
| 2184 | * haven't setup any initialization verbs for these yet... |
| 2185 | */ |
| 2186 | |
| 2187 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2188 | /* front, rear/surround, clfe */ |
| 2189 | 0x02, 0x03, 0x04 |
| 2190 | }; |
| 2191 | |
| 2192 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2193 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | { 6, NULL } |
| 2195 | }; |
| 2196 | |
| 2197 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2198 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2199 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2200 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2201 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2202 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2203 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2204 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2205 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2206 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2207 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2208 | { } /* end */ |
| 2209 | }; |
| 2210 | |
| 2211 | |
| 2212 | /* |
| 2213 | * Z710V model |
| 2214 | * |
| 2215 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2216 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2217 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2218 | */ |
| 2219 | |
| 2220 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2221 | 0x02 |
| 2222 | }; |
| 2223 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2224 | |
| 2225 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2226 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2227 | { 2, NULL } |
| 2228 | }; |
| 2229 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2230 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2231 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2232 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2233 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2234 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2235 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2236 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2237 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2238 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2239 | { } /* end */ |
| 2240 | }; |
| 2241 | |
| 2242 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2243 | /* |
| 2244 | * ALC880 F1734 model |
| 2245 | * |
| 2246 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2247 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2248 | */ |
| 2249 | |
| 2250 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2251 | 0x03 |
| 2252 | }; |
| 2253 | #define ALC880_F1734_HP_DAC 0x02 |
| 2254 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2255 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2256 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2257 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2258 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2259 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2260 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2261 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2263 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2264 | { } /* end */ |
| 2265 | }; |
| 2266 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2267 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2268 | .num_items = 2, |
| 2269 | .items = { |
| 2270 | { "Mic", 0x1 }, |
| 2271 | { "CD", 0x4 }, |
| 2272 | }, |
| 2273 | }; |
| 2274 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2276 | /* |
| 2277 | * ALC880 ASUS model |
| 2278 | * |
| 2279 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2280 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2281 | * Mic = 0x18, Line = 0x1a |
| 2282 | */ |
| 2283 | |
| 2284 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2285 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2286 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2287 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2288 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2289 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2290 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2291 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2292 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2293 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2294 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2295 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2296 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2297 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2298 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2299 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2300 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2301 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2302 | { |
| 2303 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2304 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2305 | .info = alc_ch_mode_info, |
| 2306 | .get = alc_ch_mode_get, |
| 2307 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2308 | }, |
| 2309 | { } /* end */ |
| 2310 | }; |
| 2311 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2312 | /* |
| 2313 | * ALC880 ASUS W1V model |
| 2314 | * |
| 2315 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2316 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2317 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2318 | */ |
| 2319 | |
| 2320 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2321 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2322 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2323 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2324 | { } /* end */ |
| 2325 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2326 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2327 | /* TCL S700 */ |
| 2328 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2330 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2331 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2333 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2336 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2337 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2338 | { } /* end */ |
| 2339 | }; |
| 2340 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2341 | /* Uniwill */ |
| 2342 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2343 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2344 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2345 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2346 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2347 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2348 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2349 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2350 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2357 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2358 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2359 | { |
| 2360 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2361 | .name = "Channel Mode", |
| 2362 | .info = alc_ch_mode_info, |
| 2363 | .get = alc_ch_mode_get, |
| 2364 | .put = alc_ch_mode_put, |
| 2365 | }, |
| 2366 | { } /* end */ |
| 2367 | }; |
| 2368 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2369 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2370 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2371 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2372 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2373 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2376 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2377 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2378 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2379 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2380 | { } /* end */ |
| 2381 | }; |
| 2382 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2383 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2384 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2385 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2386 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2387 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2388 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2389 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2390 | { } /* end */ |
| 2391 | }; |
| 2392 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2393 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2394 | * virtual master controls |
| 2395 | */ |
| 2396 | |
| 2397 | /* |
| 2398 | * slave controls for virtual master |
| 2399 | */ |
| 2400 | static const char *alc_slave_vols[] = { |
| 2401 | "Front Playback Volume", |
| 2402 | "Surround Playback Volume", |
| 2403 | "Center Playback Volume", |
| 2404 | "LFE Playback Volume", |
| 2405 | "Side Playback Volume", |
| 2406 | "Headphone Playback Volume", |
| 2407 | "Speaker Playback Volume", |
| 2408 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2409 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2410 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2411 | NULL, |
| 2412 | }; |
| 2413 | |
| 2414 | static const char *alc_slave_sws[] = { |
| 2415 | "Front Playback Switch", |
| 2416 | "Surround Playback Switch", |
| 2417 | "Center Playback Switch", |
| 2418 | "LFE Playback Switch", |
| 2419 | "Side Playback Switch", |
| 2420 | "Headphone Playback Switch", |
| 2421 | "Speaker Playback Switch", |
| 2422 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2423 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2424 | "Line-Out Playback Switch", |
| 2425 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2426 | NULL, |
| 2427 | }; |
| 2428 | |
| 2429 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2430 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2431 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2432 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2433 | #define NID_MAPPING (-1) |
| 2434 | |
| 2435 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2436 | #define SUBDEV_HP_ (1 << 6) |
| 2437 | #define SUBDEV_LINE_ (2 << 6) |
| 2438 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2439 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2440 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2441 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2442 | static void alc_free_kctls(struct hda_codec *codec); |
| 2443 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2444 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2445 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2446 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2447 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2448 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2449 | { } /* end */ |
| 2450 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2451 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2452 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2453 | static int alc_build_controls(struct hda_codec *codec) |
| 2454 | { |
| 2455 | struct alc_spec *spec = codec->spec; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2456 | struct snd_kcontrol *kctl; |
| 2457 | struct snd_kcontrol_new *knew; |
| 2458 | int i, j, err; |
| 2459 | unsigned int u; |
| 2460 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2461 | |
| 2462 | for (i = 0; i < spec->num_mixers; i++) { |
| 2463 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2464 | if (err < 0) |
| 2465 | return err; |
| 2466 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2467 | if (spec->cap_mixer) { |
| 2468 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2469 | if (err < 0) |
| 2470 | return err; |
| 2471 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2472 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2473 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2474 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | if (err < 0) |
| 2476 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2477 | if (!spec->no_analog) { |
| 2478 | err = snd_hda_create_spdif_share_sw(codec, |
| 2479 | &spec->multiout); |
| 2480 | if (err < 0) |
| 2481 | return err; |
| 2482 | spec->multiout.share_spdif = 1; |
| 2483 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | } |
| 2485 | if (spec->dig_in_nid) { |
| 2486 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2487 | if (err < 0) |
| 2488 | return err; |
| 2489 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2490 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2491 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2492 | /* create beep controls if needed */ |
| 2493 | if (spec->beep_amp) { |
| 2494 | struct snd_kcontrol_new *knew; |
| 2495 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2496 | struct snd_kcontrol *kctl; |
| 2497 | kctl = snd_ctl_new1(knew, codec); |
| 2498 | if (!kctl) |
| 2499 | return -ENOMEM; |
| 2500 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2501 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2502 | if (err < 0) |
| 2503 | return err; |
| 2504 | } |
| 2505 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2506 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2507 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2508 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2509 | if (!spec->no_analog && |
| 2510 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2511 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2512 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2513 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2514 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2515 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2516 | if (err < 0) |
| 2517 | return err; |
| 2518 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2519 | if (!spec->no_analog && |
| 2520 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2521 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2522 | NULL, alc_slave_sws); |
| 2523 | if (err < 0) |
| 2524 | return err; |
| 2525 | } |
| 2526 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2527 | alc_free_kctls(codec); /* no longer needed */ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2528 | |
| 2529 | /* assign Capture Source enums to NID */ |
| 2530 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2531 | if (!kctl) |
| 2532 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2533 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | d1409ae | 2009-12-17 15:01:31 +0100 | [diff] [blame] | 2534 | hda_nid_t *nids = spec->capsrc_nids; |
| 2535 | if (!nids) |
| 2536 | nids = spec->adc_nids; |
Takashi Iwai | 21949f0 | 2009-12-23 08:31:59 +0100 | [diff] [blame] | 2537 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2538 | if (err < 0) |
| 2539 | return err; |
| 2540 | } |
| 2541 | if (spec->cap_mixer) { |
| 2542 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2543 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2544 | if (kname && strcmp(knew->name, kname) == 0) |
| 2545 | continue; |
| 2546 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2547 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2548 | err = snd_hda_add_nid(codec, kctl, i, |
| 2549 | spec->adc_nids[i]); |
| 2550 | if (err < 0) |
| 2551 | return err; |
| 2552 | } |
| 2553 | } |
| 2554 | } |
| 2555 | |
| 2556 | /* other nid->control mapping */ |
| 2557 | for (i = 0; i < spec->num_mixers; i++) { |
| 2558 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2559 | if (knew->iface != NID_MAPPING) |
| 2560 | continue; |
| 2561 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2562 | if (kctl == NULL) |
| 2563 | continue; |
| 2564 | u = knew->subdevice; |
| 2565 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2566 | nid = u & 0x3f; |
| 2567 | if (nid == 0) |
| 2568 | continue; |
| 2569 | switch (u & 0xc0) { |
| 2570 | case SUBDEV_SPEAKER_: |
| 2571 | nid = spec->autocfg.speaker_pins[nid]; |
| 2572 | break; |
| 2573 | case SUBDEV_LINE_: |
| 2574 | nid = spec->autocfg.line_out_pins[nid]; |
| 2575 | break; |
| 2576 | case SUBDEV_HP_: |
| 2577 | nid = spec->autocfg.hp_pins[nid]; |
| 2578 | break; |
| 2579 | default: |
| 2580 | continue; |
| 2581 | } |
| 2582 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2583 | if (err < 0) |
| 2584 | return err; |
| 2585 | } |
| 2586 | u = knew->private_value; |
| 2587 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2588 | nid = u & 0xff; |
| 2589 | if (nid == 0) |
| 2590 | continue; |
| 2591 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2592 | if (err < 0) |
| 2593 | return err; |
| 2594 | } |
| 2595 | } |
| 2596 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2597 | return 0; |
| 2598 | } |
| 2599 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2600 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2601 | /* |
| 2602 | * initialize the codec volumes, etc |
| 2603 | */ |
| 2604 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2605 | /* |
| 2606 | * generic initialization of ADC, input mixers and output mixers |
| 2607 | */ |
| 2608 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2609 | /* |
| 2610 | * Unmute ADC0-2 and set the default input to mic-in |
| 2611 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2612 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2614 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2615 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2616 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2617 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2618 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2619 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2620 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2621 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2622 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2623 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2624 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2625 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2626 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2627 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2628 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2629 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2630 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2632 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2633 | /* |
| 2634 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2635 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2636 | /* set vol=0 to output mixers */ |
| 2637 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2638 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2639 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2640 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2641 | /* set up input amps for analog loopback */ |
| 2642 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2643 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2645 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2647 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2649 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2650 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2651 | |
| 2652 | { } |
| 2653 | }; |
| 2654 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2655 | /* |
| 2656 | * 3-stack pin configuration: |
| 2657 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2658 | */ |
| 2659 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2660 | /* |
| 2661 | * preset connection lists of input pins |
| 2662 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2663 | */ |
| 2664 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2665 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2666 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2667 | |
| 2668 | /* |
| 2669 | * Set pin mode and muting |
| 2670 | */ |
| 2671 | /* set front pin widgets 0x14 for output */ |
| 2672 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2673 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2674 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2675 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2676 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2677 | /* Mic2 (as headphone out) for HP output */ |
| 2678 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2679 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2680 | /* Line In pin widget for input */ |
| 2681 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2682 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2683 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2684 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2685 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2686 | /* CD pin widget for input */ |
| 2687 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2688 | |
| 2689 | { } |
| 2690 | }; |
| 2691 | |
| 2692 | /* |
| 2693 | * 5-stack pin configuration: |
| 2694 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2695 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2696 | */ |
| 2697 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2698 | /* |
| 2699 | * preset connection lists of input pins |
| 2700 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2701 | */ |
| 2702 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2703 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2704 | |
| 2705 | /* |
| 2706 | * Set pin mode and muting |
| 2707 | */ |
| 2708 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2709 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2710 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2711 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2712 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2713 | /* unmute pins for output (no gain on this amp) */ |
| 2714 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2715 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2717 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2718 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2719 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2720 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2722 | /* Mic2 (as headphone out) for HP output */ |
| 2723 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2724 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2725 | /* Line In pin widget for input */ |
| 2726 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2727 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2728 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2730 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2731 | /* CD pin widget for input */ |
| 2732 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2733 | |
| 2734 | { } |
| 2735 | }; |
| 2736 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2737 | /* |
| 2738 | * W810 pin configuration: |
| 2739 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2740 | */ |
| 2741 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2742 | /* hphone/speaker input selector: front DAC */ |
| 2743 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2744 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2745 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2746 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2750 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2751 | |
| 2752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2753 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2754 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2755 | { } |
| 2756 | }; |
| 2757 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2758 | /* |
| 2759 | * Z71V pin configuration: |
| 2760 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2761 | */ |
| 2762 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2763 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2765 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2766 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2767 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2768 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2769 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2770 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2771 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2772 | |
| 2773 | { } |
| 2774 | }; |
| 2775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | /* |
| 2777 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2778 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2779 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2780 | */ |
| 2781 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2782 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2783 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2786 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2787 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2788 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2789 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2790 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2791 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2792 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2793 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2794 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2795 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2796 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2798 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2799 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2800 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2801 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2802 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2803 | { } |
| 2804 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2805 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2806 | /* |
| 2807 | * Uniwill pin configuration: |
| 2808 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2809 | * line = 0x1a |
| 2810 | */ |
| 2811 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2812 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2813 | |
| 2814 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2815 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2817 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2818 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2819 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2820 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2821 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2822 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2823 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2824 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2825 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2826 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2827 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2828 | |
| 2829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2830 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2831 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2832 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2833 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2834 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2835 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2836 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2837 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2838 | |
| 2839 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2840 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2841 | |
| 2842 | { } |
| 2843 | }; |
| 2844 | |
| 2845 | /* |
| 2846 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2847 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2848 | */ |
| 2849 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2850 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2851 | |
| 2852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2853 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2854 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2855 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2856 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2857 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2858 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2859 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2860 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2861 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2862 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2863 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2864 | |
| 2865 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2866 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2867 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2868 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2869 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2870 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2871 | |
| 2872 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2873 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2874 | |
| 2875 | { } |
| 2876 | }; |
| 2877 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2878 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2879 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2880 | { } |
| 2881 | }; |
| 2882 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2883 | /* auto-toggle front mic */ |
| 2884 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2885 | { |
| 2886 | unsigned int present; |
| 2887 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2888 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2889 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2890 | bits = present ? HDA_AMP_MUTE : 0; |
| 2891 | 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] | 2892 | } |
| 2893 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2894 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2895 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2896 | struct alc_spec *spec = codec->spec; |
| 2897 | |
| 2898 | spec->autocfg.hp_pins[0] = 0x14; |
| 2899 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2900 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2901 | } |
| 2902 | |
| 2903 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2904 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2905 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2906 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2907 | } |
| 2908 | |
| 2909 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2910 | unsigned int res) |
| 2911 | { |
| 2912 | /* Looks like the unsol event is incompatible with the standard |
| 2913 | * definition. 4bit tag is placed at 28 bit! |
| 2914 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2915 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2916 | case ALC880_MIC_EVENT: |
| 2917 | alc880_uniwill_mic_automute(codec); |
| 2918 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2919 | default: |
| 2920 | alc_automute_amp_unsol_event(codec, res); |
| 2921 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2922 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2923 | } |
| 2924 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2925 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2926 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2927 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2928 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2929 | spec->autocfg.hp_pins[0] = 0x14; |
| 2930 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2931 | } |
| 2932 | |
| 2933 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2934 | { |
| 2935 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2936 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2937 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2938 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2939 | present &= HDA_AMP_VOLMASK; |
| 2940 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2941 | HDA_AMP_VOLMASK, present); |
| 2942 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2943 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2944 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2945 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2946 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2947 | unsigned int res) |
| 2948 | { |
| 2949 | /* Looks like the unsol event is incompatible with the standard |
| 2950 | * definition. 4bit tag is placed at 28 bit! |
| 2951 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2952 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2953 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2954 | else |
| 2955 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2956 | } |
| 2957 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2958 | /* |
| 2959 | * F1734 pin configuration: |
| 2960 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2961 | */ |
| 2962 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2963 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2964 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2965 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2966 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2967 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2968 | |
| 2969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2973 | |
| 2974 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2975 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2976 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2977 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2978 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2980 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2981 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2982 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2984 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2985 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2986 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2987 | { } |
| 2988 | }; |
| 2989 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2990 | /* |
| 2991 | * ASUS pin configuration: |
| 2992 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2993 | */ |
| 2994 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2995 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2996 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2997 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2998 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2999 | |
| 3000 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3001 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3002 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3004 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3005 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3006 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3007 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3008 | |
| 3009 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3010 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3012 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3013 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3014 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3015 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3016 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3017 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3018 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3019 | { } |
| 3020 | }; |
| 3021 | |
| 3022 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3023 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3024 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3025 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3027 | /* Clevo m520g init */ |
| 3028 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3029 | /* headphone output */ |
| 3030 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3031 | /* line-out */ |
| 3032 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3034 | /* Line-in */ |
| 3035 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3036 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3037 | /* CD */ |
| 3038 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3039 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3040 | /* Mic1 (rear panel) */ |
| 3041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3043 | /* Mic2 (front panel) */ |
| 3044 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3045 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3046 | /* headphone */ |
| 3047 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3048 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3049 | /* change to EAPD mode */ |
| 3050 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3051 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3052 | |
| 3053 | { } |
| 3054 | }; |
| 3055 | |
| 3056 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3057 | /* change to EAPD mode */ |
| 3058 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3059 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3061 | /* Headphone output */ |
| 3062 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3063 | /* Front output*/ |
| 3064 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3065 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3066 | |
| 3067 | /* Line In pin widget for input */ |
| 3068 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3069 | /* CD pin widget for input */ |
| 3070 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3071 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3072 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3073 | |
| 3074 | /* change to EAPD mode */ |
| 3075 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3076 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3077 | |
| 3078 | { } |
| 3079 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3080 | |
| 3081 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3082 | * LG m1 express dual |
| 3083 | * |
| 3084 | * Pin assignment: |
| 3085 | * Rear Line-In/Out (blue): 0x14 |
| 3086 | * Build-in Mic-In: 0x15 |
| 3087 | * Speaker-out: 0x17 |
| 3088 | * HP-Out (green): 0x1b |
| 3089 | * Mic-In/Out (red): 0x19 |
| 3090 | * SPDIF-Out: 0x1e |
| 3091 | */ |
| 3092 | |
| 3093 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3094 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3095 | 0x05, 0x02, 0x03 |
| 3096 | }; |
| 3097 | |
| 3098 | /* seems analog CD is not working */ |
| 3099 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3100 | .num_items = 3, |
| 3101 | .items = { |
| 3102 | { "Mic", 0x1 }, |
| 3103 | { "Line", 0x5 }, |
| 3104 | { "Internal Mic", 0x6 }, |
| 3105 | }, |
| 3106 | }; |
| 3107 | |
| 3108 | /* 2,4,6 channel modes */ |
| 3109 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3110 | /* set line-in and mic-in to input */ |
| 3111 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3112 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3113 | { } |
| 3114 | }; |
| 3115 | |
| 3116 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3117 | /* set line-in to out and mic-in to input */ |
| 3118 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3119 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3120 | { } |
| 3121 | }; |
| 3122 | |
| 3123 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3124 | /* set line-in and mic-in to output */ |
| 3125 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3126 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3127 | { } |
| 3128 | }; |
| 3129 | |
| 3130 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3131 | { 2, alc880_lg_ch2_init }, |
| 3132 | { 4, alc880_lg_ch4_init }, |
| 3133 | { 6, alc880_lg_ch6_init }, |
| 3134 | }; |
| 3135 | |
| 3136 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3137 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3138 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3139 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3140 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3141 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3142 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3143 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3144 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3145 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3146 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3147 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3148 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3149 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3150 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3151 | { |
| 3152 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3153 | .name = "Channel Mode", |
| 3154 | .info = alc_ch_mode_info, |
| 3155 | .get = alc_ch_mode_get, |
| 3156 | .put = alc_ch_mode_put, |
| 3157 | }, |
| 3158 | { } /* end */ |
| 3159 | }; |
| 3160 | |
| 3161 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3162 | /* set capture source to mic-in */ |
| 3163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3164 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3165 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3166 | /* mute all amp mixer inputs */ |
| 3167 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3168 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3170 | /* line-in to input */ |
| 3171 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3172 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3173 | /* built-in mic */ |
| 3174 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3175 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3176 | /* speaker-out */ |
| 3177 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3178 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3179 | /* mic-in to input */ |
| 3180 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3181 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3182 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3183 | /* HP-out */ |
| 3184 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3186 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3187 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3188 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3189 | { } |
| 3190 | }; |
| 3191 | |
| 3192 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3193 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3194 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3195 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3196 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3197 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3198 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3199 | } |
| 3200 | |
| 3201 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3202 | * LG LW20 |
| 3203 | * |
| 3204 | * Pin assignment: |
| 3205 | * Speaker-out: 0x14 |
| 3206 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3207 | * Built-in Mic-In: 0x19 |
| 3208 | * Line-In: 0x1b |
| 3209 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3210 | * SPDIF-Out: 0x1e |
| 3211 | */ |
| 3212 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3213 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3214 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3215 | .items = { |
| 3216 | { "Mic", 0x0 }, |
| 3217 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3218 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3219 | }, |
| 3220 | }; |
| 3221 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3222 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3223 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3224 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3225 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3226 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3227 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3228 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3229 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3230 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3231 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3232 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3236 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3237 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3238 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3239 | { |
| 3240 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3241 | .name = "Channel Mode", |
| 3242 | .info = alc_ch_mode_info, |
| 3243 | .get = alc_ch_mode_get, |
| 3244 | .put = alc_ch_mode_put, |
| 3245 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3246 | { } /* end */ |
| 3247 | }; |
| 3248 | |
| 3249 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3250 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3251 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3252 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3253 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3254 | /* set capture source to mic-in */ |
| 3255 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3256 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3258 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3259 | /* speaker-out */ |
| 3260 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3261 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3262 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3263 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3264 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3265 | /* mic-in to input */ |
| 3266 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3267 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3268 | /* built-in mic */ |
| 3269 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3270 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3271 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3272 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3273 | { } |
| 3274 | }; |
| 3275 | |
| 3276 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3277 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3278 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3279 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3280 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3281 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3282 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3283 | } |
| 3284 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3285 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3286 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3287 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3288 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3289 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3290 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3291 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3292 | { } /* end */ |
| 3293 | }; |
| 3294 | |
| 3295 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3296 | .num_items = 2, |
| 3297 | .items = { |
| 3298 | { "Mic", 0x0 }, |
| 3299 | { "Internal Mic", 0x1 }, |
| 3300 | }, |
| 3301 | }; |
| 3302 | |
| 3303 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3304 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3305 | |
| 3306 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3308 | |
| 3309 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3310 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3312 | /* Mic2 (as headphone out) for HP output */ |
| 3313 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3314 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3315 | /* Internal Speaker */ |
| 3316 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3317 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3318 | |
| 3319 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3320 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3321 | |
| 3322 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3323 | { } |
| 3324 | }; |
| 3325 | |
| 3326 | /* toggle speaker-output according to the hp-jack state */ |
| 3327 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3328 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3329 | struct alc_spec *spec = codec->spec; |
| 3330 | alc_automute_amp(codec); |
| 3331 | /* toggle EAPD */ |
| 3332 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3333 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3334 | else |
| 3335 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3336 | } |
| 3337 | |
| 3338 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3339 | unsigned int res) |
| 3340 | { |
| 3341 | /* Looks like the unsol event is incompatible with the standard |
| 3342 | * definition. 4bit tag is placed at 28 bit! |
| 3343 | */ |
| 3344 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3345 | alc880_medion_rim_automute(codec); |
| 3346 | } |
| 3347 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3348 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3349 | { |
| 3350 | struct alc_spec *spec = codec->spec; |
| 3351 | |
| 3352 | spec->autocfg.hp_pins[0] = 0x14; |
| 3353 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3354 | } |
| 3355 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3356 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3357 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3358 | { 0x0b, HDA_INPUT, 0 }, |
| 3359 | { 0x0b, HDA_INPUT, 1 }, |
| 3360 | { 0x0b, HDA_INPUT, 2 }, |
| 3361 | { 0x0b, HDA_INPUT, 3 }, |
| 3362 | { 0x0b, HDA_INPUT, 4 }, |
| 3363 | { } /* end */ |
| 3364 | }; |
| 3365 | |
| 3366 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3367 | { 0x0b, HDA_INPUT, 1 }, |
| 3368 | { 0x0b, HDA_INPUT, 6 }, |
| 3369 | { 0x0b, HDA_INPUT, 7 }, |
| 3370 | { } /* end */ |
| 3371 | }; |
| 3372 | #endif |
| 3373 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3374 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3375 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3376 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3377 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3378 | static int alc_init(struct hda_codec *codec) |
| 3379 | { |
| 3380 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3381 | unsigned int i; |
| 3382 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3383 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3384 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3385 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3386 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3387 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3388 | |
| 3389 | if (spec->init_hook) |
| 3390 | spec->init_hook(codec); |
| 3391 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3392 | return 0; |
| 3393 | } |
| 3394 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3395 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3396 | { |
| 3397 | struct alc_spec *spec = codec->spec; |
| 3398 | |
| 3399 | if (spec->unsol_event) |
| 3400 | spec->unsol_event(codec, res); |
| 3401 | } |
| 3402 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3403 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3404 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3405 | { |
| 3406 | struct alc_spec *spec = codec->spec; |
| 3407 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3408 | } |
| 3409 | #endif |
| 3410 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3411 | /* |
| 3412 | * Analog playback callbacks |
| 3413 | */ |
| 3414 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3415 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3416 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3417 | { |
| 3418 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3419 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3420 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3421 | } |
| 3422 | |
| 3423 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3424 | struct hda_codec *codec, |
| 3425 | unsigned int stream_tag, |
| 3426 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3427 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3428 | { |
| 3429 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3430 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3431 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3432 | } |
| 3433 | |
| 3434 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3435 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3436 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3437 | { |
| 3438 | struct alc_spec *spec = codec->spec; |
| 3439 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3440 | } |
| 3441 | |
| 3442 | /* |
| 3443 | * Digital out |
| 3444 | */ |
| 3445 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3446 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3447 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3448 | { |
| 3449 | struct alc_spec *spec = codec->spec; |
| 3450 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3451 | } |
| 3452 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3453 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3454 | struct hda_codec *codec, |
| 3455 | unsigned int stream_tag, |
| 3456 | unsigned int format, |
| 3457 | struct snd_pcm_substream *substream) |
| 3458 | { |
| 3459 | struct alc_spec *spec = codec->spec; |
| 3460 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3461 | stream_tag, format, substream); |
| 3462 | } |
| 3463 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3464 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3465 | struct hda_codec *codec, |
| 3466 | struct snd_pcm_substream *substream) |
| 3467 | { |
| 3468 | struct alc_spec *spec = codec->spec; |
| 3469 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3470 | } |
| 3471 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3472 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3473 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3474 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3475 | { |
| 3476 | struct alc_spec *spec = codec->spec; |
| 3477 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3478 | } |
| 3479 | |
| 3480 | /* |
| 3481 | * Analog capture |
| 3482 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3483 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3484 | struct hda_codec *codec, |
| 3485 | unsigned int stream_tag, |
| 3486 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3487 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3488 | { |
| 3489 | struct alc_spec *spec = codec->spec; |
| 3490 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3491 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3492 | stream_tag, 0, format); |
| 3493 | return 0; |
| 3494 | } |
| 3495 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3496 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3497 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3498 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3499 | { |
| 3500 | struct alc_spec *spec = codec->spec; |
| 3501 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3502 | snd_hda_codec_cleanup_stream(codec, |
| 3503 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3504 | return 0; |
| 3505 | } |
| 3506 | |
| 3507 | |
| 3508 | /* |
| 3509 | */ |
| 3510 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3511 | .substreams = 1, |
| 3512 | .channels_min = 2, |
| 3513 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3514 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3515 | .ops = { |
| 3516 | .open = alc880_playback_pcm_open, |
| 3517 | .prepare = alc880_playback_pcm_prepare, |
| 3518 | .cleanup = alc880_playback_pcm_cleanup |
| 3519 | }, |
| 3520 | }; |
| 3521 | |
| 3522 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3523 | .substreams = 1, |
| 3524 | .channels_min = 2, |
| 3525 | .channels_max = 2, |
| 3526 | /* NID is set in alc_build_pcms */ |
| 3527 | }; |
| 3528 | |
| 3529 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3530 | .substreams = 1, |
| 3531 | .channels_min = 2, |
| 3532 | .channels_max = 2, |
| 3533 | /* NID is set in alc_build_pcms */ |
| 3534 | }; |
| 3535 | |
| 3536 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3537 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3538 | .channels_min = 2, |
| 3539 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3541 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3542 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3543 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3544 | }, |
| 3545 | }; |
| 3546 | |
| 3547 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3548 | .substreams = 1, |
| 3549 | .channels_min = 2, |
| 3550 | .channels_max = 2, |
| 3551 | /* NID is set in alc_build_pcms */ |
| 3552 | .ops = { |
| 3553 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3554 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3555 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3556 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3557 | }, |
| 3558 | }; |
| 3559 | |
| 3560 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3561 | .substreams = 1, |
| 3562 | .channels_min = 2, |
| 3563 | .channels_max = 2, |
| 3564 | /* NID is set in alc_build_pcms */ |
| 3565 | }; |
| 3566 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3567 | /* 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] | 3568 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3569 | .substreams = 0, |
| 3570 | .channels_min = 0, |
| 3571 | .channels_max = 0, |
| 3572 | }; |
| 3573 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3574 | static int alc_build_pcms(struct hda_codec *codec) |
| 3575 | { |
| 3576 | struct alc_spec *spec = codec->spec; |
| 3577 | struct hda_pcm *info = spec->pcm_rec; |
| 3578 | int i; |
| 3579 | |
| 3580 | codec->num_pcms = 1; |
| 3581 | codec->pcm_info = info; |
| 3582 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3583 | if (spec->no_analog) |
| 3584 | goto skip_analog; |
| 3585 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3586 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3587 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3588 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3589 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3590 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3591 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3592 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3593 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3594 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3595 | } |
| 3596 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3597 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3598 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3599 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3601 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3602 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3603 | if (spec->channel_mode) { |
| 3604 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3605 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3606 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3607 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3608 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3609 | } |
| 3610 | } |
| 3611 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3612 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3613 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3614 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3615 | snprintf(spec->stream_name_digital, |
| 3616 | sizeof(spec->stream_name_digital), |
| 3617 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3618 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3619 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3620 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3621 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3622 | if (spec->dig_out_type) |
| 3623 | info->pcm_type = spec->dig_out_type; |
| 3624 | else |
| 3625 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3626 | if (spec->multiout.dig_out_nid && |
| 3627 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3628 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3629 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3630 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3631 | if (spec->dig_in_nid && |
| 3632 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3633 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3634 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3635 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3636 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3637 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3638 | } |
| 3639 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3640 | if (spec->no_analog) |
| 3641 | return 0; |
| 3642 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3643 | /* If the use of more than one ADC is requested for the current |
| 3644 | * model, configure a second analog capture-only PCM. |
| 3645 | */ |
| 3646 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3647 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3648 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3649 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3650 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3651 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3652 | if (spec->alt_dac_nid) { |
| 3653 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3654 | *spec->stream_analog_alt_playback; |
| 3655 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3656 | spec->alt_dac_nid; |
| 3657 | } else { |
| 3658 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3659 | alc_pcm_null_stream; |
| 3660 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3661 | } |
| 3662 | if (spec->num_adc_nids > 1) { |
| 3663 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3664 | *spec->stream_analog_alt_capture; |
| 3665 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3666 | spec->adc_nids[1]; |
| 3667 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3668 | spec->num_adc_nids - 1; |
| 3669 | } else { |
| 3670 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3671 | alc_pcm_null_stream; |
| 3672 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3673 | } |
| 3674 | } |
| 3675 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3676 | return 0; |
| 3677 | } |
| 3678 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3679 | static inline void alc_shutup(struct hda_codec *codec) |
| 3680 | { |
| 3681 | snd_hda_shutup_pins(codec); |
| 3682 | } |
| 3683 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3684 | static void alc_free_kctls(struct hda_codec *codec) |
| 3685 | { |
| 3686 | struct alc_spec *spec = codec->spec; |
| 3687 | |
| 3688 | if (spec->kctls.list) { |
| 3689 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3690 | int i; |
| 3691 | for (i = 0; i < spec->kctls.used; i++) |
| 3692 | kfree(kctl[i].name); |
| 3693 | } |
| 3694 | snd_array_free(&spec->kctls); |
| 3695 | } |
| 3696 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3697 | static void alc_free(struct hda_codec *codec) |
| 3698 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3699 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3700 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3701 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3702 | return; |
| 3703 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3704 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3705 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3706 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3707 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3708 | } |
| 3709 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3710 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3711 | static void alc_power_eapd(struct hda_codec *codec) |
| 3712 | { |
| 3713 | /* We currently only handle front, HP */ |
| 3714 | switch (codec->vendor_id) { |
| 3715 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3716 | set_eapd(codec, 0x0f, 0); |
| 3717 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3718 | break; |
| 3719 | case 0x10ec0262: |
| 3720 | case 0x10ec0267: |
| 3721 | case 0x10ec0268: |
| 3722 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3723 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3724 | case 0x10ec0272: |
| 3725 | case 0x10ec0660: |
| 3726 | case 0x10ec0662: |
| 3727 | case 0x10ec0663: |
| 3728 | case 0x10ec0862: |
| 3729 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3730 | set_eapd(codec, 0x14, 0); |
| 3731 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3732 | break; |
| 3733 | } |
| 3734 | } |
| 3735 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3736 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3737 | { |
| 3738 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3739 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3740 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3741 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3742 | return 0; |
| 3743 | } |
| 3744 | #endif |
| 3745 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3746 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3747 | static int alc_resume(struct hda_codec *codec) |
| 3748 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3749 | codec->patch_ops.init(codec); |
| 3750 | snd_hda_codec_resume_amp(codec); |
| 3751 | snd_hda_codec_resume_cache(codec); |
| 3752 | return 0; |
| 3753 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3754 | #endif |
| 3755 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3756 | /* |
| 3757 | */ |
| 3758 | static struct hda_codec_ops alc_patch_ops = { |
| 3759 | .build_controls = alc_build_controls, |
| 3760 | .build_pcms = alc_build_pcms, |
| 3761 | .init = alc_init, |
| 3762 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3763 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3764 | #ifdef SND_HDA_NEEDS_RESUME |
| 3765 | .resume = alc_resume, |
| 3766 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3767 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3768 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3769 | .check_power_status = alc_check_power_status, |
| 3770 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3771 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3772 | }; |
| 3773 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3774 | |
| 3775 | /* |
| 3776 | * Test configuration for debugging |
| 3777 | * |
| 3778 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3779 | * enum controls. |
| 3780 | */ |
| 3781 | #ifdef CONFIG_SND_DEBUG |
| 3782 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3783 | 0x02, 0x03, 0x04, 0x05 |
| 3784 | }; |
| 3785 | |
| 3786 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3787 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3788 | .items = { |
| 3789 | { "In-1", 0x0 }, |
| 3790 | { "In-2", 0x1 }, |
| 3791 | { "In-3", 0x2 }, |
| 3792 | { "In-4", 0x3 }, |
| 3793 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3794 | { "Front", 0x5 }, |
| 3795 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3796 | }, |
| 3797 | }; |
| 3798 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3799 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3800 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3801 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3802 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3803 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3804 | }; |
| 3805 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3806 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3807 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3808 | { |
| 3809 | static char *texts[] = { |
| 3810 | "N/A", "Line Out", "HP Out", |
| 3811 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3812 | }; |
| 3813 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3814 | uinfo->count = 1; |
| 3815 | uinfo->value.enumerated.items = 8; |
| 3816 | if (uinfo->value.enumerated.item >= 8) |
| 3817 | uinfo->value.enumerated.item = 7; |
| 3818 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3819 | return 0; |
| 3820 | } |
| 3821 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3822 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3823 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3824 | { |
| 3825 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3826 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3827 | unsigned int pin_ctl, item = 0; |
| 3828 | |
| 3829 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3830 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3831 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3832 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3833 | item = 2; |
| 3834 | else |
| 3835 | item = 1; |
| 3836 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3837 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3838 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3839 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3840 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3841 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3842 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3843 | } |
| 3844 | } |
| 3845 | ucontrol->value.enumerated.item[0] = item; |
| 3846 | return 0; |
| 3847 | } |
| 3848 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3849 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3850 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3851 | { |
| 3852 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3853 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3854 | static unsigned int ctls[] = { |
| 3855 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3856 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3857 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3858 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3859 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3860 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3861 | }; |
| 3862 | unsigned int old_ctl, new_ctl; |
| 3863 | |
| 3864 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3865 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3866 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3867 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3868 | int val; |
| 3869 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3870 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3871 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3872 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3873 | HDA_AMP_MUTE : 0; |
| 3874 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3875 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3876 | return 1; |
| 3877 | } |
| 3878 | return 0; |
| 3879 | } |
| 3880 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3881 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3882 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3883 | { |
| 3884 | static char *texts[] = { |
| 3885 | "Front", "Surround", "CLFE", "Side" |
| 3886 | }; |
| 3887 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3888 | uinfo->count = 1; |
| 3889 | uinfo->value.enumerated.items = 4; |
| 3890 | if (uinfo->value.enumerated.item >= 4) |
| 3891 | uinfo->value.enumerated.item = 3; |
| 3892 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3893 | return 0; |
| 3894 | } |
| 3895 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3896 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3897 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3898 | { |
| 3899 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3900 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3901 | unsigned int sel; |
| 3902 | |
| 3903 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3904 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3905 | return 0; |
| 3906 | } |
| 3907 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3908 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3909 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3910 | { |
| 3911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3912 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3913 | unsigned int sel; |
| 3914 | |
| 3915 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3916 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3917 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3918 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3919 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3920 | return 1; |
| 3921 | } |
| 3922 | return 0; |
| 3923 | } |
| 3924 | |
| 3925 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3926 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3927 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3928 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3929 | .info = alc_test_pin_ctl_info, \ |
| 3930 | .get = alc_test_pin_ctl_get, \ |
| 3931 | .put = alc_test_pin_ctl_put, \ |
| 3932 | .private_value = nid \ |
| 3933 | } |
| 3934 | |
| 3935 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3936 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3937 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 3938 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3939 | .info = alc_test_pin_src_info, \ |
| 3940 | .get = alc_test_pin_src_get, \ |
| 3941 | .put = alc_test_pin_src_put, \ |
| 3942 | .private_value = nid \ |
| 3943 | } |
| 3944 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3945 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3946 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3947 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3948 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3949 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3950 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3951 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3952 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3953 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3954 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3955 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3956 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3957 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3958 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3959 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3960 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3961 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3962 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3963 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3964 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3965 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3966 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3967 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3968 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3969 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3970 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3971 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3972 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3973 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3974 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3975 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3976 | { |
| 3977 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3978 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3979 | .info = alc_ch_mode_info, |
| 3980 | .get = alc_ch_mode_get, |
| 3981 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3982 | }, |
| 3983 | { } /* end */ |
| 3984 | }; |
| 3985 | |
| 3986 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3987 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3991 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3993 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3994 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3995 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3996 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3997 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3999 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4000 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4001 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4002 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4003 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4004 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4005 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4006 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4007 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4009 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4010 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4011 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4012 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4013 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4014 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4015 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4016 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4017 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4018 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4019 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4020 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4021 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4022 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4024 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4025 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4026 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4027 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4028 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4029 | /* Analog input/passthru */ |
| 4030 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4031 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4032 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4033 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4034 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4035 | { } |
| 4036 | }; |
| 4037 | #endif |
| 4038 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4039 | /* |
| 4040 | */ |
| 4041 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4042 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4043 | [ALC880_3ST] = "3stack", |
| 4044 | [ALC880_TCL_S700] = "tcl", |
| 4045 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4046 | [ALC880_CLEVO] = "clevo", |
| 4047 | [ALC880_5ST] = "5stack", |
| 4048 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4049 | [ALC880_W810] = "w810", |
| 4050 | [ALC880_Z71V] = "z71v", |
| 4051 | [ALC880_6ST] = "6stack", |
| 4052 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4053 | [ALC880_ASUS] = "asus", |
| 4054 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4055 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4056 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4057 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4058 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4059 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4060 | [ALC880_F1734] = "F1734", |
| 4061 | [ALC880_LG] = "lg", |
| 4062 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4063 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4064 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4065 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4066 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4067 | [ALC880_AUTO] = "auto", |
| 4068 | }; |
| 4069 | |
| 4070 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4071 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4072 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4073 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4074 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4075 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4076 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4077 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4078 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4079 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4080 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4081 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4082 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4083 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4084 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4085 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4086 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4087 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4088 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4089 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4090 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4091 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4092 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4093 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4094 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4095 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4096 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4097 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4098 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4099 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4100 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4101 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4102 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4103 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4104 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4105 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4106 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4107 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4108 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4109 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4110 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4111 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4112 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4113 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4114 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4115 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4116 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4117 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4118 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4119 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4120 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4121 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4122 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4123 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4124 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4125 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4126 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4127 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4128 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4129 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4130 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4131 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4132 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4133 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4134 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4135 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4136 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4137 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4138 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4139 | /* default Intel */ |
| 4140 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4141 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4142 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4143 | {} |
| 4144 | }; |
| 4145 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4146 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4147 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4149 | static struct alc_config_preset alc880_presets[] = { |
| 4150 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4151 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4152 | .init_verbs = { alc880_volume_init_verbs, |
| 4153 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4154 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4155 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4156 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4157 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4158 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4159 | .input_mux = &alc880_capture_source, |
| 4160 | }, |
| 4161 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4162 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4163 | .init_verbs = { alc880_volume_init_verbs, |
| 4164 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4165 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4166 | .dac_nids = alc880_dac_nids, |
| 4167 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4168 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4169 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4170 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4171 | .input_mux = &alc880_capture_source, |
| 4172 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4173 | [ALC880_TCL_S700] = { |
| 4174 | .mixers = { alc880_tcl_s700_mixer }, |
| 4175 | .init_verbs = { alc880_volume_init_verbs, |
| 4176 | alc880_pin_tcl_S700_init_verbs, |
| 4177 | alc880_gpio2_init_verbs }, |
| 4178 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4179 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4180 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4181 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4182 | .hp_nid = 0x03, |
| 4183 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4184 | .channel_mode = alc880_2_jack_modes, |
| 4185 | .input_mux = &alc880_capture_source, |
| 4186 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4187 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4188 | .mixers = { alc880_three_stack_mixer, |
| 4189 | alc880_five_stack_mixer}, |
| 4190 | .init_verbs = { alc880_volume_init_verbs, |
| 4191 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4192 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4193 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4194 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4195 | .channel_mode = alc880_fivestack_modes, |
| 4196 | .input_mux = &alc880_capture_source, |
| 4197 | }, |
| 4198 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4199 | .mixers = { alc880_three_stack_mixer, |
| 4200 | alc880_five_stack_mixer }, |
| 4201 | .init_verbs = { alc880_volume_init_verbs, |
| 4202 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4203 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4204 | .dac_nids = alc880_dac_nids, |
| 4205 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4206 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4207 | .channel_mode = alc880_fivestack_modes, |
| 4208 | .input_mux = &alc880_capture_source, |
| 4209 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4210 | [ALC880_6ST] = { |
| 4211 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4212 | .init_verbs = { alc880_volume_init_verbs, |
| 4213 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4214 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4215 | .dac_nids = alc880_6st_dac_nids, |
| 4216 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4217 | .channel_mode = alc880_sixstack_modes, |
| 4218 | .input_mux = &alc880_6stack_capture_source, |
| 4219 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4220 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4221 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4222 | .init_verbs = { alc880_volume_init_verbs, |
| 4223 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4224 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4225 | .dac_nids = alc880_6st_dac_nids, |
| 4226 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4227 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4228 | .channel_mode = alc880_sixstack_modes, |
| 4229 | .input_mux = &alc880_6stack_capture_source, |
| 4230 | }, |
| 4231 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4232 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4233 | .init_verbs = { alc880_volume_init_verbs, |
| 4234 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4235 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4236 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4237 | .dac_nids = alc880_w810_dac_nids, |
| 4238 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4239 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4240 | .channel_mode = alc880_w810_modes, |
| 4241 | .input_mux = &alc880_capture_source, |
| 4242 | }, |
| 4243 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4244 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4245 | .init_verbs = { alc880_volume_init_verbs, |
| 4246 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4247 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4248 | .dac_nids = alc880_z71v_dac_nids, |
| 4249 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4250 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4251 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4252 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4253 | .input_mux = &alc880_capture_source, |
| 4254 | }, |
| 4255 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4256 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4257 | .init_verbs = { alc880_volume_init_verbs, |
| 4258 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4259 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4260 | .dac_nids = alc880_f1734_dac_nids, |
| 4261 | .hp_nid = 0x02, |
| 4262 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4263 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4264 | .input_mux = &alc880_f1734_capture_source, |
| 4265 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4266 | .setup = alc880_uniwill_p53_setup, |
| 4267 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4268 | }, |
| 4269 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4270 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4271 | .init_verbs = { alc880_volume_init_verbs, |
| 4272 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | alc880_gpio1_init_verbs }, |
| 4274 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4275 | .dac_nids = alc880_asus_dac_nids, |
| 4276 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4277 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4278 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4279 | .input_mux = &alc880_capture_source, |
| 4280 | }, |
| 4281 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4282 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4283 | .init_verbs = { alc880_volume_init_verbs, |
| 4284 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4285 | alc880_gpio1_init_verbs }, |
| 4286 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4287 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4288 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4289 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4290 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4291 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4292 | .input_mux = &alc880_capture_source, |
| 4293 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4294 | [ALC880_ASUS_DIG2] = { |
| 4295 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4296 | .init_verbs = { alc880_volume_init_verbs, |
| 4297 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4298 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4299 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4300 | .dac_nids = alc880_asus_dac_nids, |
| 4301 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4302 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4303 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4304 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4305 | .input_mux = &alc880_capture_source, |
| 4306 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4307 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4308 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4309 | .init_verbs = { alc880_volume_init_verbs, |
| 4310 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4311 | alc880_gpio1_init_verbs }, |
| 4312 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4313 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4314 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4315 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4316 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4317 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4318 | .input_mux = &alc880_capture_source, |
| 4319 | }, |
| 4320 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4321 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4322 | .init_verbs = { alc880_volume_init_verbs, |
| 4323 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4324 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4325 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4326 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4328 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4329 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4330 | .input_mux = &alc880_capture_source, |
| 4331 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4332 | [ALC880_UNIWILL] = { |
| 4333 | .mixers = { alc880_uniwill_mixer }, |
| 4334 | .init_verbs = { alc880_volume_init_verbs, |
| 4335 | alc880_uniwill_init_verbs }, |
| 4336 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4337 | .dac_nids = alc880_asus_dac_nids, |
| 4338 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4339 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4340 | .channel_mode = alc880_threestack_modes, |
| 4341 | .need_dac_fix = 1, |
| 4342 | .input_mux = &alc880_capture_source, |
| 4343 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4344 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4345 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4346 | }, |
| 4347 | [ALC880_UNIWILL_P53] = { |
| 4348 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4349 | .init_verbs = { alc880_volume_init_verbs, |
| 4350 | alc880_uniwill_p53_init_verbs }, |
| 4351 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4352 | .dac_nids = alc880_asus_dac_nids, |
| 4353 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4354 | .channel_mode = alc880_threestack_modes, |
| 4355 | .input_mux = &alc880_capture_source, |
| 4356 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4357 | .setup = alc880_uniwill_p53_setup, |
| 4358 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4359 | }, |
| 4360 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4361 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4362 | .init_verbs = { alc880_volume_init_verbs, |
| 4363 | alc880_uniwill_p53_init_verbs, |
| 4364 | alc880_beep_init_verbs }, |
| 4365 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4366 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4367 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4368 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4369 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4370 | .input_mux = &alc880_capture_source, |
| 4371 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4372 | .setup = alc880_uniwill_p53_setup, |
| 4373 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4374 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4375 | [ALC880_CLEVO] = { |
| 4376 | .mixers = { alc880_three_stack_mixer }, |
| 4377 | .init_verbs = { alc880_volume_init_verbs, |
| 4378 | alc880_pin_clevo_init_verbs }, |
| 4379 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4380 | .dac_nids = alc880_dac_nids, |
| 4381 | .hp_nid = 0x03, |
| 4382 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4383 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4384 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4385 | .input_mux = &alc880_capture_source, |
| 4386 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4387 | [ALC880_LG] = { |
| 4388 | .mixers = { alc880_lg_mixer }, |
| 4389 | .init_verbs = { alc880_volume_init_verbs, |
| 4390 | alc880_lg_init_verbs }, |
| 4391 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4392 | .dac_nids = alc880_lg_dac_nids, |
| 4393 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4394 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4395 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4396 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4397 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4398 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4399 | .setup = alc880_lg_setup, |
| 4400 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4401 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4402 | .loopbacks = alc880_lg_loopbacks, |
| 4403 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4404 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4405 | [ALC880_LG_LW] = { |
| 4406 | .mixers = { alc880_lg_lw_mixer }, |
| 4407 | .init_verbs = { alc880_volume_init_verbs, |
| 4408 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4409 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4410 | .dac_nids = alc880_dac_nids, |
| 4411 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4412 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4413 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4414 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4415 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4416 | .setup = alc880_lg_lw_setup, |
| 4417 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4418 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4419 | [ALC880_MEDION_RIM] = { |
| 4420 | .mixers = { alc880_medion_rim_mixer }, |
| 4421 | .init_verbs = { alc880_volume_init_verbs, |
| 4422 | alc880_medion_rim_init_verbs, |
| 4423 | alc_gpio2_init_verbs }, |
| 4424 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4425 | .dac_nids = alc880_dac_nids, |
| 4426 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4427 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4428 | .channel_mode = alc880_2_jack_modes, |
| 4429 | .input_mux = &alc880_medion_rim_capture_source, |
| 4430 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4431 | .setup = alc880_medion_rim_setup, |
| 4432 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4433 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4434 | #ifdef CONFIG_SND_DEBUG |
| 4435 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4436 | .mixers = { alc880_test_mixer }, |
| 4437 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4438 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4439 | .dac_nids = alc880_test_dac_nids, |
| 4440 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4441 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4442 | .channel_mode = alc880_test_modes, |
| 4443 | .input_mux = &alc880_test_capture_source, |
| 4444 | }, |
| 4445 | #endif |
| 4446 | }; |
| 4447 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4448 | /* |
| 4449 | * Automatic parse of I/O pins from the BIOS configuration |
| 4450 | */ |
| 4451 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4452 | enum { |
| 4453 | ALC_CTL_WIDGET_VOL, |
| 4454 | ALC_CTL_WIDGET_MUTE, |
| 4455 | ALC_CTL_BIND_MUTE, |
| 4456 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4457 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4459 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4460 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4461 | }; |
| 4462 | |
| 4463 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4464 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4465 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4467 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4468 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4469 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4470 | knew = snd_array_new(&spec->kctls); |
| 4471 | if (!knew) |
| 4472 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4473 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4474 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4475 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4476 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4477 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4478 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4479 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4480 | return 0; |
| 4481 | } |
| 4482 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4483 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4484 | const char *pfx, const char *dir, |
| 4485 | const char *sfx, unsigned long val) |
| 4486 | { |
| 4487 | char name[32]; |
| 4488 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4489 | return add_control(spec, type, name, val); |
| 4490 | } |
| 4491 | |
| 4492 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4493 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4494 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4495 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4496 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4497 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4498 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4499 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4500 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4501 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4502 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4503 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4504 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4505 | #define ALC880_PIN_CD_NID 0x1c |
| 4506 | |
| 4507 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4508 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4509 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4510 | { |
| 4511 | hda_nid_t nid; |
| 4512 | int assigned[4]; |
| 4513 | int i, j; |
| 4514 | |
| 4515 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4516 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4517 | |
| 4518 | /* check the pins hardwired to audio widget */ |
| 4519 | for (i = 0; i < cfg->line_outs; i++) { |
| 4520 | nid = cfg->line_out_pins[i]; |
| 4521 | if (alc880_is_fixed_pin(nid)) { |
| 4522 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4523 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4524 | assigned[idx] = 1; |
| 4525 | } |
| 4526 | } |
| 4527 | /* left pins can be connect to any audio widget */ |
| 4528 | for (i = 0; i < cfg->line_outs; i++) { |
| 4529 | nid = cfg->line_out_pins[i]; |
| 4530 | if (alc880_is_fixed_pin(nid)) |
| 4531 | continue; |
| 4532 | /* search for an empty channel */ |
| 4533 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4534 | if (!assigned[j]) { |
| 4535 | spec->multiout.dac_nids[i] = |
| 4536 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4537 | assigned[j] = 1; |
| 4538 | break; |
| 4539 | } |
| 4540 | } |
| 4541 | } |
| 4542 | spec->multiout.num_dacs = cfg->line_outs; |
| 4543 | return 0; |
| 4544 | } |
| 4545 | |
| 4546 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4547 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4548 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4549 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4550 | static const char *chname[4] = { |
| 4551 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4552 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4553 | hda_nid_t nid; |
| 4554 | int i, err; |
| 4555 | |
| 4556 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4557 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4558 | continue; |
| 4559 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4560 | if (i == 2) { |
| 4561 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4562 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4563 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4564 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4565 | HDA_OUTPUT)); |
| 4566 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4567 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4568 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4569 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4570 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4571 | HDA_OUTPUT)); |
| 4572 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4573 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4574 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4575 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4576 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4577 | HDA_INPUT)); |
| 4578 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4579 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4580 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4581 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4582 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4583 | HDA_INPUT)); |
| 4584 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4585 | return err; |
| 4586 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4587 | const char *pfx; |
| 4588 | if (cfg->line_outs == 1 && |
| 4589 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4590 | pfx = "Speaker"; |
| 4591 | else |
| 4592 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4593 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4594 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4595 | HDA_OUTPUT)); |
| 4596 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4597 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4598 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4599 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4600 | HDA_INPUT)); |
| 4601 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4602 | return err; |
| 4603 | } |
| 4604 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4605 | return 0; |
| 4606 | } |
| 4607 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4608 | /* add playback controls for speaker and HP outputs */ |
| 4609 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4610 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4611 | { |
| 4612 | hda_nid_t nid; |
| 4613 | int err; |
| 4614 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4615 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4616 | return 0; |
| 4617 | |
| 4618 | if (alc880_is_fixed_pin(pin)) { |
| 4619 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4620 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4621 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4622 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4623 | else |
| 4624 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4625 | /* control HP volume/switch on the output mixer amp */ |
| 4626 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4627 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4628 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4629 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4630 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4631 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4632 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4633 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4634 | return err; |
| 4635 | } else if (alc880_is_multi_pin(pin)) { |
| 4636 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4637 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4638 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4639 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4640 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4641 | return err; |
| 4642 | } |
| 4643 | return 0; |
| 4644 | } |
| 4645 | |
| 4646 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4647 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4648 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4649 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4650 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4651 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4653 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4654 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4655 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4656 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4657 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4658 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4659 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4660 | return err; |
| 4661 | return 0; |
| 4662 | } |
| 4663 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4664 | 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] | 4665 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4666 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4667 | return (pincap & AC_PINCAP_IN) != 0; |
| 4668 | } |
| 4669 | |
| 4670 | /* create playback/capture controls for input pins */ |
| 4671 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4672 | const struct auto_pin_cfg *cfg, |
| 4673 | hda_nid_t mixer, |
| 4674 | hda_nid_t cap1, hda_nid_t cap2) |
| 4675 | { |
| 4676 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4677 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4678 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4679 | |
| 4680 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4681 | hda_nid_t pin; |
| 4682 | |
| 4683 | pin = cfg->input_pins[i]; |
| 4684 | if (!alc_is_input_pin(codec, pin)) |
| 4685 | continue; |
| 4686 | |
| 4687 | if (mixer) { |
| 4688 | idx = get_connection_index(codec, mixer, pin); |
| 4689 | if (idx >= 0) { |
| 4690 | err = new_analog_input(spec, pin, |
| 4691 | auto_pin_cfg_labels[i], |
| 4692 | idx, mixer); |
| 4693 | if (err < 0) |
| 4694 | return err; |
| 4695 | } |
| 4696 | } |
| 4697 | |
| 4698 | if (!cap1) |
| 4699 | continue; |
| 4700 | idx = get_connection_index(codec, cap1, pin); |
| 4701 | if (idx < 0 && cap2) |
| 4702 | idx = get_connection_index(codec, cap2, pin); |
| 4703 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4704 | imux->items[imux->num_items].label = |
| 4705 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4706 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4707 | imux->num_items++; |
| 4708 | } |
| 4709 | } |
| 4710 | return 0; |
| 4711 | } |
| 4712 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4713 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4714 | const struct auto_pin_cfg *cfg) |
| 4715 | { |
| 4716 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4717 | } |
| 4718 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4719 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4720 | unsigned int pin_type) |
| 4721 | { |
| 4722 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4723 | pin_type); |
| 4724 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4725 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4726 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4727 | } |
| 4728 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4729 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4730 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4731 | int dac_idx) |
| 4732 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4733 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4734 | /* need the manual connection? */ |
| 4735 | if (alc880_is_multi_pin(nid)) { |
| 4736 | struct alc_spec *spec = codec->spec; |
| 4737 | int idx = alc880_multi_pin_idx(nid); |
| 4738 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4739 | AC_VERB_SET_CONNECT_SEL, |
| 4740 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4741 | } |
| 4742 | } |
| 4743 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4744 | static int get_pin_type(int line_out_type) |
| 4745 | { |
| 4746 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4747 | return PIN_HP; |
| 4748 | else |
| 4749 | return PIN_OUT; |
| 4750 | } |
| 4751 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4752 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4753 | { |
| 4754 | struct alc_spec *spec = codec->spec; |
| 4755 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4756 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4757 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4758 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4759 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4760 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4761 | } |
| 4762 | } |
| 4763 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4764 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4765 | { |
| 4766 | struct alc_spec *spec = codec->spec; |
| 4767 | hda_nid_t pin; |
| 4768 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4769 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4770 | if (pin) /* connect to front */ |
| 4771 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4772 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4773 | if (pin) /* connect to front */ |
| 4774 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4775 | } |
| 4776 | |
| 4777 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4778 | { |
| 4779 | struct alc_spec *spec = codec->spec; |
| 4780 | int i; |
| 4781 | |
| 4782 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4783 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4784 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4785 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4786 | if (nid != ALC880_PIN_CD_NID && |
| 4787 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4788 | snd_hda_codec_write(codec, nid, 0, |
| 4789 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4790 | AMP_OUT_MUTE); |
| 4791 | } |
| 4792 | } |
| 4793 | } |
| 4794 | |
| 4795 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4796 | /* return 1 if successful, 0 if the proper config is not found, |
| 4797 | * or a negative error code |
| 4798 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4799 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4800 | { |
| 4801 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4802 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4803 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4804 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4805 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4806 | alc880_ignore); |
| 4807 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4808 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4809 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4810 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4811 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4812 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4813 | if (err < 0) |
| 4814 | return err; |
| 4815 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4816 | if (err < 0) |
| 4817 | return err; |
| 4818 | err = alc880_auto_create_extra_out(spec, |
| 4819 | spec->autocfg.speaker_pins[0], |
| 4820 | "Speaker"); |
| 4821 | if (err < 0) |
| 4822 | return err; |
| 4823 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4824 | "Headphone"); |
| 4825 | if (err < 0) |
| 4826 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4827 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4828 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4829 | return err; |
| 4830 | |
| 4831 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4832 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4833 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4834 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4835 | hda_nid_t dig_nid; |
| 4836 | err = snd_hda_get_connections(codec, |
| 4837 | spec->autocfg.dig_out_pins[i], |
| 4838 | &dig_nid, 1); |
| 4839 | if (err < 0) |
| 4840 | continue; |
| 4841 | if (!i) |
| 4842 | spec->multiout.dig_out_nid = dig_nid; |
| 4843 | else { |
| 4844 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4845 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4846 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4847 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4848 | } |
| 4849 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4850 | if (spec->autocfg.dig_in_pin) |
| 4851 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4852 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4853 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4854 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4855 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4856 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4857 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4858 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4859 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4860 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4861 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4862 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4863 | return 1; |
| 4864 | } |
| 4865 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4866 | /* additional initialization for auto-configuration model */ |
| 4867 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4868 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4869 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4870 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4871 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4872 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4873 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4874 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4875 | } |
| 4876 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4877 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4878 | * one of two digital mic pins, e.g. on ALC272 |
| 4879 | */ |
| 4880 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4881 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4882 | struct alc_spec *spec = codec->spec; |
| 4883 | int i; |
| 4884 | |
| 4885 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4886 | hda_nid_t cap = spec->capsrc_nids ? |
| 4887 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4888 | int iidx, eidx; |
| 4889 | |
| 4890 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4891 | if (iidx < 0) |
| 4892 | continue; |
| 4893 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4894 | if (eidx < 0) |
| 4895 | continue; |
| 4896 | spec->int_mic.mux_idx = iidx; |
| 4897 | spec->ext_mic.mux_idx = eidx; |
| 4898 | if (spec->capsrc_nids) |
| 4899 | spec->capsrc_nids += i; |
| 4900 | spec->adc_nids += i; |
| 4901 | spec->num_adc_nids = 1; |
| 4902 | return; |
| 4903 | } |
| 4904 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4905 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4906 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4907 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4908 | } |
| 4909 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 4910 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 4911 | static void fixup_single_adc(struct hda_codec *codec) |
| 4912 | { |
| 4913 | struct alc_spec *spec = codec->spec; |
| 4914 | hda_nid_t pin; |
| 4915 | int i; |
| 4916 | |
| 4917 | /* search for the input pin; there must be only one */ |
| 4918 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4919 | if (spec->autocfg.input_pins[i]) { |
| 4920 | pin = spec->autocfg.input_pins[i]; |
| 4921 | break; |
| 4922 | } |
| 4923 | } |
| 4924 | if (!pin) |
| 4925 | return; |
| 4926 | |
| 4927 | /* set the default connection to that pin */ |
| 4928 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4929 | hda_nid_t cap = spec->capsrc_nids ? |
| 4930 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4931 | int idx; |
| 4932 | |
| 4933 | idx = get_connection_index(codec, cap, pin); |
| 4934 | if (idx < 0) |
| 4935 | continue; |
| 4936 | /* use only this ADC */ |
| 4937 | if (spec->capsrc_nids) |
| 4938 | spec->capsrc_nids += i; |
| 4939 | spec->adc_nids += i; |
| 4940 | spec->num_adc_nids = 1; |
| 4941 | /* select or unmute this route */ |
| 4942 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 4943 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 4944 | HDA_AMP_MUTE, 0); |
| 4945 | } else { |
| 4946 | snd_hda_codec_write_cache(codec, cap, 0, |
| 4947 | AC_VERB_SET_CONNECT_SEL, idx); |
| 4948 | } |
| 4949 | return; |
| 4950 | } |
| 4951 | } |
| 4952 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4953 | static void set_capture_mixer(struct hda_codec *codec) |
| 4954 | { |
| 4955 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4956 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4957 | { alc_capture_mixer_nosrc1, |
| 4958 | alc_capture_mixer_nosrc2, |
| 4959 | alc_capture_mixer_nosrc3 }, |
| 4960 | { alc_capture_mixer1, |
| 4961 | alc_capture_mixer2, |
| 4962 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4963 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4964 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 4965 | int mux = 0; |
| 4966 | if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4967 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 4968 | else if (spec->input_mux) { |
| 4969 | if (spec->input_mux->num_items > 1) |
| 4970 | mux = 1; |
| 4971 | else if (spec->input_mux->num_items == 1) |
| 4972 | fixup_single_adc(codec); |
| 4973 | } |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4974 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4975 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4976 | } |
| 4977 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4978 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4979 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4980 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 4981 | #else |
| 4982 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 4983 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4984 | |
| 4985 | /* |
| 4986 | * OK, here we have finally the patch for ALC880 |
| 4987 | */ |
| 4988 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4989 | static int patch_alc880(struct hda_codec *codec) |
| 4990 | { |
| 4991 | struct alc_spec *spec; |
| 4992 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4993 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4994 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4995 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4996 | if (spec == NULL) |
| 4997 | return -ENOMEM; |
| 4998 | |
| 4999 | codec->spec = spec; |
| 5000 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5001 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5002 | alc880_models, |
| 5003 | alc880_cfg_tbl); |
| 5004 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5005 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5006 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5007 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5008 | } |
| 5009 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5010 | if (board_config == ALC880_AUTO) { |
| 5011 | /* automatic parse from the BIOS config */ |
| 5012 | err = alc880_parse_auto_config(codec); |
| 5013 | if (err < 0) { |
| 5014 | alc_free(codec); |
| 5015 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5016 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5017 | printk(KERN_INFO |
| 5018 | "hda_codec: Cannot set up configuration " |
| 5019 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5020 | board_config = ALC880_3ST; |
| 5021 | } |
| 5022 | } |
| 5023 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5024 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5025 | if (err < 0) { |
| 5026 | alc_free(codec); |
| 5027 | return err; |
| 5028 | } |
| 5029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5031 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5032 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5033 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5034 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5035 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5036 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5037 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5038 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5039 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5040 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5041 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5042 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5043 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5044 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5045 | if (wcap != AC_WID_AUD_IN) { |
| 5046 | spec->adc_nids = alc880_adc_nids_alt; |
| 5047 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5048 | } else { |
| 5049 | spec->adc_nids = alc880_adc_nids; |
| 5050 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5051 | } |
| 5052 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5053 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5054 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5055 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5056 | spec->vmaster_nid = 0x0c; |
| 5057 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5058 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5059 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5060 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5061 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5062 | if (!spec->loopback.amplist) |
| 5063 | spec->loopback.amplist = alc880_loopbacks; |
| 5064 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5065 | |
| 5066 | return 0; |
| 5067 | } |
| 5068 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5069 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5070 | /* |
| 5071 | * ALC260 support |
| 5072 | */ |
| 5073 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5074 | static hda_nid_t alc260_dac_nids[1] = { |
| 5075 | /* front */ |
| 5076 | 0x02, |
| 5077 | }; |
| 5078 | |
| 5079 | static hda_nid_t alc260_adc_nids[1] = { |
| 5080 | /* ADC0 */ |
| 5081 | 0x04, |
| 5082 | }; |
| 5083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5084 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5085 | /* ADC1 */ |
| 5086 | 0x05, |
| 5087 | }; |
| 5088 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5089 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5090 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5091 | */ |
| 5092 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5093 | /* ADC0, ADC1 */ |
| 5094 | 0x04, 0x05 |
| 5095 | }; |
| 5096 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5097 | #define ALC260_DIGOUT_NID 0x03 |
| 5098 | #define ALC260_DIGIN_NID 0x06 |
| 5099 | |
| 5100 | static struct hda_input_mux alc260_capture_source = { |
| 5101 | .num_items = 4, |
| 5102 | .items = { |
| 5103 | { "Mic", 0x0 }, |
| 5104 | { "Front Mic", 0x1 }, |
| 5105 | { "Line", 0x2 }, |
| 5106 | { "CD", 0x4 }, |
| 5107 | }, |
| 5108 | }; |
| 5109 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5110 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5111 | * headphone jack and the internal CD lines since these are the only pins at |
| 5112 | * which audio can appear. For flexibility, also allow the option of |
| 5113 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5114 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5115 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5116 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5117 | { |
| 5118 | .num_items = 3, |
| 5119 | .items = { |
| 5120 | { "Mic/Line", 0x0 }, |
| 5121 | { "CD", 0x4 }, |
| 5122 | { "Headphone", 0x2 }, |
| 5123 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5124 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5125 | { |
| 5126 | .num_items = 4, |
| 5127 | .items = { |
| 5128 | { "Mic/Line", 0x0 }, |
| 5129 | { "CD", 0x4 }, |
| 5130 | { "Headphone", 0x2 }, |
| 5131 | { "Mixer", 0x5 }, |
| 5132 | }, |
| 5133 | }, |
| 5134 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5135 | }; |
| 5136 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5137 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5138 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5139 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5140 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5141 | { |
| 5142 | .num_items = 4, |
| 5143 | .items = { |
| 5144 | { "Mic", 0x0 }, |
| 5145 | { "Line", 0x2 }, |
| 5146 | { "CD", 0x4 }, |
| 5147 | { "Headphone", 0x5 }, |
| 5148 | }, |
| 5149 | }, |
| 5150 | { |
| 5151 | .num_items = 5, |
| 5152 | .items = { |
| 5153 | { "Mic", 0x0 }, |
| 5154 | { "Line", 0x2 }, |
| 5155 | { "CD", 0x4 }, |
| 5156 | { "Headphone", 0x6 }, |
| 5157 | { "Mixer", 0x5 }, |
| 5158 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5159 | }, |
| 5160 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5161 | |
| 5162 | /* Maxdata Favorit 100XS */ |
| 5163 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5164 | { |
| 5165 | .num_items = 2, |
| 5166 | .items = { |
| 5167 | { "Line/Mic", 0x0 }, |
| 5168 | { "CD", 0x4 }, |
| 5169 | }, |
| 5170 | }, |
| 5171 | { |
| 5172 | .num_items = 3, |
| 5173 | .items = { |
| 5174 | { "Line/Mic", 0x0 }, |
| 5175 | { "CD", 0x4 }, |
| 5176 | { "Mixer", 0x5 }, |
| 5177 | }, |
| 5178 | }, |
| 5179 | }; |
| 5180 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5181 | /* |
| 5182 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5183 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5184 | * element which allows changing the channel mode, so the verb list is |
| 5185 | * never used. |
| 5186 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5187 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5188 | { 2, NULL }, |
| 5189 | }; |
| 5190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5191 | |
| 5192 | /* Mixer combinations |
| 5193 | * |
| 5194 | * basic: base_output + input + pc_beep + capture |
| 5195 | * HP: base_output + input + capture_alt |
| 5196 | * HP_3013: hp_3013 + input + capture |
| 5197 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5198 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5199 | */ |
| 5200 | |
| 5201 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5202 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5203 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5204 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5205 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5206 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5207 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5208 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5209 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5210 | |
| 5211 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5213 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5215 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5216 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5217 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5218 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5219 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5220 | { } /* end */ |
| 5221 | }; |
| 5222 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5223 | /* update HP, line and mono out pins according to the master switch */ |
| 5224 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5225 | hda_nid_t hp, hda_nid_t line, |
| 5226 | hda_nid_t mono) |
| 5227 | { |
| 5228 | struct alc_spec *spec = codec->spec; |
| 5229 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5230 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5231 | 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] | 5232 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5233 | 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] | 5234 | val); |
| 5235 | /* mono (speaker) depending on the HP jack sense */ |
| 5236 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5237 | 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] | 5238 | val); |
| 5239 | } |
| 5240 | |
| 5241 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5242 | struct snd_ctl_elem_value *ucontrol) |
| 5243 | { |
| 5244 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5245 | struct alc_spec *spec = codec->spec; |
| 5246 | *ucontrol->value.integer.value = spec->master_sw; |
| 5247 | return 0; |
| 5248 | } |
| 5249 | |
| 5250 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5251 | struct snd_ctl_elem_value *ucontrol) |
| 5252 | { |
| 5253 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5254 | struct alc_spec *spec = codec->spec; |
| 5255 | int val = !!*ucontrol->value.integer.value; |
| 5256 | hda_nid_t hp, line, mono; |
| 5257 | |
| 5258 | if (val == spec->master_sw) |
| 5259 | return 0; |
| 5260 | spec->master_sw = val; |
| 5261 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5262 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5263 | mono = kcontrol->private_value & 0xff; |
| 5264 | alc260_hp_master_update(codec, hp, line, mono); |
| 5265 | return 1; |
| 5266 | } |
| 5267 | |
| 5268 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5269 | { |
| 5270 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5271 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5272 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5273 | .info = snd_ctl_boolean_mono_info, |
| 5274 | .get = alc260_hp_master_sw_get, |
| 5275 | .put = alc260_hp_master_sw_put, |
| 5276 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5277 | }, |
| 5278 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5279 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5280 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5281 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5282 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5283 | HDA_OUTPUT), |
| 5284 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5285 | { } /* end */ |
| 5286 | }; |
| 5287 | |
| 5288 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5289 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5290 | {}, |
| 5291 | }; |
| 5292 | |
| 5293 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5294 | { |
| 5295 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5296 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5297 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5298 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5299 | } |
| 5300 | |
| 5301 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5302 | { |
| 5303 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5304 | alc260_hp_automute(codec); |
| 5305 | } |
| 5306 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5307 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5308 | { |
| 5309 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5310 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5311 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5312 | .info = snd_ctl_boolean_mono_info, |
| 5313 | .get = alc260_hp_master_sw_get, |
| 5314 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5315 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5316 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5317 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5318 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5319 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5320 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5321 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5322 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5323 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5324 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5325 | { } /* end */ |
| 5326 | }; |
| 5327 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5328 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5329 | .ops = &snd_hda_bind_vol, |
| 5330 | .values = { |
| 5331 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5332 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5333 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5334 | 0 |
| 5335 | }, |
| 5336 | }; |
| 5337 | |
| 5338 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5339 | .ops = &snd_hda_bind_sw, |
| 5340 | .values = { |
| 5341 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5342 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5343 | 0 |
| 5344 | }, |
| 5345 | }; |
| 5346 | |
| 5347 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5348 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5349 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5350 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5351 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5352 | { } /* end */ |
| 5353 | }; |
| 5354 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5355 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5356 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5357 | {}, |
| 5358 | }; |
| 5359 | |
| 5360 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5361 | { |
| 5362 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5363 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5364 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5365 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5366 | } |
| 5367 | |
| 5368 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5369 | unsigned int res) |
| 5370 | { |
| 5371 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5372 | alc260_hp_3013_automute(codec); |
| 5373 | } |
| 5374 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5375 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5376 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5377 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5378 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5379 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5380 | bits); |
| 5381 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5382 | bits); |
| 5383 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5384 | bits); |
| 5385 | } |
| 5386 | |
| 5387 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5388 | unsigned int res) |
| 5389 | { |
| 5390 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5391 | alc260_hp_3012_automute(codec); |
| 5392 | } |
| 5393 | |
| 5394 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5395 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5396 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5397 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5398 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5399 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5400 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5402 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5403 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5404 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5405 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5406 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5407 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5408 | { } /* end */ |
| 5409 | }; |
| 5410 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5411 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5412 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5413 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5414 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5415 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5416 | * revisions available in early 2006. Therefore for now allow the |
| 5417 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5418 | * that the lack of mic bias for this NID is intentional we could change the |
| 5419 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5420 | * |
| 5421 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5422 | * don't appear to make the mic bias available from the "line" jack, even |
| 5423 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5424 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5425 | * and the output jack. If this turns out to be the case for all such |
| 5426 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5427 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5428 | * |
| 5429 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5430 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5431 | * controls for such models. On models without a "mono speaker" the control |
| 5432 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5433 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5434 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5435 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5436 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5437 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5438 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5439 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5440 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5441 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5442 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5443 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5446 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5447 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5448 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5449 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5450 | { } /* end */ |
| 5451 | }; |
| 5452 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5453 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5454 | */ |
| 5455 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5456 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5457 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5458 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5459 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5460 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5461 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5462 | { } /* end */ |
| 5463 | }; |
| 5464 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5465 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5466 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5467 | */ |
| 5468 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5469 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5470 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5473 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5475 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5476 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5478 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5479 | { } /* end */ |
| 5480 | }; |
| 5481 | |
| 5482 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5483 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5484 | */ |
| 5485 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5486 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5487 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5488 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5489 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5490 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5491 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5492 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5493 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5494 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5495 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5496 | { } /* end */ |
| 5497 | }; |
| 5498 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5499 | /* |
| 5500 | * initialization verbs |
| 5501 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5502 | static struct hda_verb alc260_init_verbs[] = { |
| 5503 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5505 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5506 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5507 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5508 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5509 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5510 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5511 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5512 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5513 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5514 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5515 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5516 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5517 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5518 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5519 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5520 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5521 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5522 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5523 | /* set connection select to line in (default select for this ADC) */ |
| 5524 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5525 | /* mute capture amp left and right */ |
| 5526 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5527 | /* set connection select to line in (default select for this ADC) */ |
| 5528 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5529 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5530 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5531 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5532 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5533 | /* set vol=0 HP mixer amp left and right */ |
| 5534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5535 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5536 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5537 | /* set vol=0 Mono mixer amp left and right */ |
| 5538 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5539 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5540 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5541 | /* unmute LINE-2 out pin */ |
| 5542 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5543 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5544 | * Line In 2 = 0x03 |
| 5545 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5546 | /* mute analog inputs */ |
| 5547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5552 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5553 | /* mute Front out path */ |
| 5554 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5556 | /* mute Headphone out path */ |
| 5557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5558 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5559 | /* mute Mono out path */ |
| 5560 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5561 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5562 | { } |
| 5563 | }; |
| 5564 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5565 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5566 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5567 | /* Headphone and output */ |
| 5568 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5569 | /* mono output */ |
| 5570 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5571 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5572 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5573 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5574 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5575 | /* Line In pin widget for input */ |
| 5576 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5577 | /* Line-2 pin widget for output */ |
| 5578 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5579 | /* CD pin widget for input */ |
| 5580 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5581 | /* unmute amp left and right */ |
| 5582 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5583 | /* set connection select to line in (default select for this ADC) */ |
| 5584 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5585 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5586 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5587 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5588 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5589 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5590 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5591 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5592 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5593 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5594 | * Line In 2 = 0x03 |
| 5595 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5596 | /* mute analog inputs */ |
| 5597 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5598 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5599 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5600 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5601 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5602 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5603 | /* Unmute Front out path */ |
| 5604 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5605 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5606 | /* Unmute Headphone out path */ |
| 5607 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5608 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5609 | /* Unmute Mono out path */ |
| 5610 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5611 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5612 | { } |
| 5613 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5614 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5615 | |
| 5616 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5617 | /* Line out and output */ |
| 5618 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5619 | /* mono output */ |
| 5620 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5621 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5622 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5623 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5624 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5625 | /* Line In pin widget for input */ |
| 5626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5627 | /* Headphone pin widget for output */ |
| 5628 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5629 | /* CD pin widget for input */ |
| 5630 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5631 | /* unmute amp left and right */ |
| 5632 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5633 | /* set connection select to line in (default select for this ADC) */ |
| 5634 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5635 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5636 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5637 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5639 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5640 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5641 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5642 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5643 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5644 | * Line In 2 = 0x03 |
| 5645 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5646 | /* mute analog inputs */ |
| 5647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5649 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5650 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5651 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5652 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5653 | /* Unmute Front out path */ |
| 5654 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5656 | /* Unmute Headphone out path */ |
| 5657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5658 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5659 | /* Unmute Mono out path */ |
| 5660 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5661 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5662 | { } |
| 5663 | }; |
| 5664 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5665 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5666 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5667 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5668 | */ |
| 5669 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5670 | /* Disable all GPIOs */ |
| 5671 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5672 | /* Internal speaker is connected to headphone pin */ |
| 5673 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5674 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5675 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5676 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5677 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5678 | /* Ensure all other unused pins are disabled and muted. */ |
| 5679 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5680 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5681 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5682 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5683 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5684 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5685 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5687 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5688 | /* Disable digital (SPDIF) pins */ |
| 5689 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5690 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5691 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5692 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5693 | * when acting as an output. |
| 5694 | */ |
| 5695 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5696 | |
| 5697 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5698 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5699 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5700 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5701 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5702 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5703 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5704 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5705 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5706 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5707 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5708 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5709 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5710 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5711 | * If the pin mode is changed by the user the pin mode control will |
| 5712 | * take care of enabling the pin's input/output buffers as needed. |
| 5713 | * Therefore there's no need to enable the input buffer at this |
| 5714 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5715 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5716 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5717 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5718 | * mixer ctrl) |
| 5719 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5720 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5721 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5722 | /* Mute capture amp left and right */ |
| 5723 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5724 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5725 | * in (on mic1 pin) |
| 5726 | */ |
| 5727 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5728 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5729 | /* Do the same for the second ADC: mute capture input amp and |
| 5730 | * set ADC connection to line in (on mic1 pin) |
| 5731 | */ |
| 5732 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5733 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5734 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5735 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5738 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5739 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5740 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5741 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5743 | {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] | 5744 | |
| 5745 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5746 | }; |
| 5747 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5748 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5749 | * similar laptops (adapted from Fujitsu init verbs). |
| 5750 | */ |
| 5751 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5752 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5753 | * the headphone jack. Turn this on and rely on the standard mute |
| 5754 | * methods whenever the user wants to turn these outputs off. |
| 5755 | */ |
| 5756 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5757 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5758 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5759 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5760 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5761 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5762 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5763 | /* Line In jack is connected to Line1 pin */ |
| 5764 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5765 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5766 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5767 | /* Ensure all other unused pins are disabled and muted. */ |
| 5768 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5769 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5770 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5771 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5774 | /* Disable digital (SPDIF) pins */ |
| 5775 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5776 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5777 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5778 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5779 | * bus when acting as outputs. |
| 5780 | */ |
| 5781 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5782 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5783 | |
| 5784 | /* Start with output sum widgets muted and their output gains at min */ |
| 5785 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5786 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5787 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5788 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5789 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5790 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5791 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5792 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5793 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5794 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5795 | /* Unmute Line-out pin widget amp left and right |
| 5796 | * (no equiv mixer ctrl) |
| 5797 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5798 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5799 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5800 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5801 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5802 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5803 | * will take care of enabling the pin's input/output buffers as needed. |
| 5804 | * Therefore there's no need to enable the input buffer at this |
| 5805 | * stage. |
| 5806 | */ |
| 5807 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5809 | |
| 5810 | /* Mute capture amp left and right */ |
| 5811 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5812 | /* Set ADC connection select to match default mixer setting - mic |
| 5813 | * (on mic1 pin) |
| 5814 | */ |
| 5815 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5816 | |
| 5817 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5818 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5819 | */ |
| 5820 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5821 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5822 | |
| 5823 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5824 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5825 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5826 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5828 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5829 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5831 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5832 | |
| 5833 | { } |
| 5834 | }; |
| 5835 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5836 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5837 | * (adapted from Acer init verbs). |
| 5838 | */ |
| 5839 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5840 | /* GPIO 0 enables the output jack. |
| 5841 | * Turn this on and rely on the standard mute |
| 5842 | * methods whenever the user wants to turn these outputs off. |
| 5843 | */ |
| 5844 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5845 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5846 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5847 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5848 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5849 | /* Ensure all other unused pins are disabled and muted. */ |
| 5850 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5851 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5852 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5853 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5854 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5855 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5856 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5857 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5859 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5860 | /* Disable digital (SPDIF) pins */ |
| 5861 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5862 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5863 | |
| 5864 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5865 | * bus when acting as outputs. |
| 5866 | */ |
| 5867 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5868 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5869 | |
| 5870 | /* Start with output sum widgets muted and their output gains at min */ |
| 5871 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5873 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5875 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5877 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5878 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5879 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5880 | |
| 5881 | /* Unmute Line-out pin widget amp left and right |
| 5882 | * (no equiv mixer ctrl) |
| 5883 | */ |
| 5884 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5885 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5886 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5887 | * will take care of enabling the pin's input/output buffers as needed. |
| 5888 | * Therefore there's no need to enable the input buffer at this |
| 5889 | * stage. |
| 5890 | */ |
| 5891 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5892 | |
| 5893 | /* Mute capture amp left and right */ |
| 5894 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5895 | /* Set ADC connection select to match default mixer setting - mic |
| 5896 | * (on mic1 pin) |
| 5897 | */ |
| 5898 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5899 | |
| 5900 | /* Do similar with the second ADC: mute capture input amp and |
| 5901 | * set ADC connection to mic to match ALSA's default state. |
| 5902 | */ |
| 5903 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5904 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5905 | |
| 5906 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5907 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5908 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5909 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5910 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5911 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5912 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5913 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5914 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5915 | |
| 5916 | { } |
| 5917 | }; |
| 5918 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5919 | static struct hda_verb alc260_will_verbs[] = { |
| 5920 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5921 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5922 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5923 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5924 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5925 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5926 | {} |
| 5927 | }; |
| 5928 | |
| 5929 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5930 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5931 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5932 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5933 | |
| 5934 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5935 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5936 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5937 | |
| 5938 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5939 | {} |
| 5940 | }; |
| 5941 | |
| 5942 | /* toggle speaker-output according to the hp-jack state */ |
| 5943 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5944 | { |
| 5945 | unsigned int present; |
| 5946 | |
| 5947 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5948 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5949 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5950 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5951 | AC_VERB_SET_GPIO_DATA, 1); |
| 5952 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5953 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5954 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5955 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5956 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5957 | AC_VERB_SET_GPIO_DATA, 0); |
| 5958 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5959 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5960 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5961 | } |
| 5962 | } |
| 5963 | |
| 5964 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5965 | unsigned int res) |
| 5966 | { |
| 5967 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5968 | alc260_replacer_672v_automute(codec); |
| 5969 | } |
| 5970 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5971 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5972 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5973 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5974 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5975 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5976 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5977 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5978 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5979 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5980 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5981 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5982 | {} |
| 5983 | }; |
| 5984 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5985 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5986 | * configuration. |
| 5987 | */ |
| 5988 | #ifdef CONFIG_SND_DEBUG |
| 5989 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5990 | 0x02, |
| 5991 | }; |
| 5992 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5993 | 0x04, 0x05, |
| 5994 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5995 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5996 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5997 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5998 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5999 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6000 | { |
| 6001 | .num_items = 7, |
| 6002 | .items = { |
| 6003 | { "MIC1 pin", 0x0 }, |
| 6004 | { "MIC2 pin", 0x1 }, |
| 6005 | { "LINE1 pin", 0x2 }, |
| 6006 | { "LINE2 pin", 0x3 }, |
| 6007 | { "CD pin", 0x4 }, |
| 6008 | { "LINE-OUT pin", 0x5 }, |
| 6009 | { "HP-OUT pin", 0x6 }, |
| 6010 | }, |
| 6011 | }, |
| 6012 | { |
| 6013 | .num_items = 8, |
| 6014 | .items = { |
| 6015 | { "MIC1 pin", 0x0 }, |
| 6016 | { "MIC2 pin", 0x1 }, |
| 6017 | { "LINE1 pin", 0x2 }, |
| 6018 | { "LINE2 pin", 0x3 }, |
| 6019 | { "CD pin", 0x4 }, |
| 6020 | { "Mixer", 0x5 }, |
| 6021 | { "LINE-OUT pin", 0x6 }, |
| 6022 | { "HP-OUT pin", 0x7 }, |
| 6023 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6024 | }, |
| 6025 | }; |
| 6026 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6027 | /* Output driver widgets */ |
| 6028 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6029 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6030 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6031 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6032 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6033 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6034 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6035 | /* Modes for retasking pin widgets |
| 6036 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6037 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6038 | * mention this restriction. At this stage it's not clear whether |
| 6039 | * this behaviour is intentional or is a hardware bug in chip |
| 6040 | * revisions available at least up until early 2006. Therefore for |
| 6041 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6042 | * choices, but if it turns out that the lack of mic bias for these |
| 6043 | * NIDs is intentional we could change their modes from |
| 6044 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6045 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6046 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6047 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6048 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6049 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6050 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6051 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6052 | |
| 6053 | /* Loopback mixer controls */ |
| 6054 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6055 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6056 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6057 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6058 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6059 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6060 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6061 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6062 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6063 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6064 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6065 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6066 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6067 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6068 | |
| 6069 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6070 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6071 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6072 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6073 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6074 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6075 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6076 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6077 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6078 | */ |
| 6079 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6080 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6081 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6082 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6083 | * this output to turn on an external amplifier. |
| 6084 | */ |
| 6085 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6086 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6087 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6088 | { } /* end */ |
| 6089 | }; |
| 6090 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6091 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6092 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6093 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6094 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6095 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6096 | /* Enable retasking pins as output, initially without power amp */ |
| 6097 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6098 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6099 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6100 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6101 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6102 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6103 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6104 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6105 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6106 | * payload also sets the generation to 0, output to be in "consumer" |
| 6107 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6108 | * control. |
| 6109 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6110 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6111 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6112 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6113 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6114 | * OUT1 sum bus when acting as an output. |
| 6115 | */ |
| 6116 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6117 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6118 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6119 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6120 | |
| 6121 | /* Start with output sum widgets muted and their output gains at min */ |
| 6122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6123 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6124 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6126 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6128 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6130 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6131 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6132 | /* Unmute retasking pin widget output buffers since the default |
| 6133 | * state appears to be output. As the pin mode is changed by the |
| 6134 | * user the pin mode control will take care of enabling the pin's |
| 6135 | * input/output buffers as needed. |
| 6136 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6137 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6138 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6139 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6140 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6141 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6142 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6143 | /* Also unmute the mono-out pin widget */ |
| 6144 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6145 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6146 | /* Mute capture amp left and right */ |
| 6147 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6148 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6149 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6150 | */ |
| 6151 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6152 | |
| 6153 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6154 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6155 | */ |
| 6156 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6157 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6158 | |
| 6159 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6160 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6161 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6162 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6163 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6164 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6167 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6168 | |
| 6169 | { } |
| 6170 | }; |
| 6171 | #endif |
| 6172 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6173 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6174 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6175 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6176 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6177 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6179 | /* |
| 6180 | * for BIOS auto-configuration |
| 6181 | */ |
| 6182 | |
| 6183 | 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] | 6184 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6185 | { |
| 6186 | hda_nid_t nid_vol; |
| 6187 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6188 | int err; |
| 6189 | |
| 6190 | if (nid >= 0x0f && nid < 0x11) { |
| 6191 | nid_vol = nid - 0x7; |
| 6192 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6193 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6194 | } else if (nid == 0x11) { |
| 6195 | nid_vol = nid - 0x7; |
| 6196 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6197 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6198 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6199 | nid_vol = 0x08; |
| 6200 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6201 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6202 | } else |
| 6203 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6204 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6205 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6206 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6207 | 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] | 6208 | if (err < 0) |
| 6209 | return err; |
| 6210 | *vol_bits |= (1 << nid_vol); |
| 6211 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6212 | 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] | 6213 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | return err; |
| 6215 | return 1; |
| 6216 | } |
| 6217 | |
| 6218 | /* add playback controls from the parsed DAC table */ |
| 6219 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6220 | const struct auto_pin_cfg *cfg) |
| 6221 | { |
| 6222 | hda_nid_t nid; |
| 6223 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6224 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6225 | |
| 6226 | spec->multiout.num_dacs = 1; |
| 6227 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6228 | spec->multiout.dac_nids[0] = 0x02; |
| 6229 | |
| 6230 | nid = cfg->line_out_pins[0]; |
| 6231 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6232 | const char *pfx; |
| 6233 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6234 | pfx = "Master"; |
| 6235 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6236 | pfx = "Speaker"; |
| 6237 | else |
| 6238 | pfx = "Front"; |
| 6239 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6240 | if (err < 0) |
| 6241 | return err; |
| 6242 | } |
| 6243 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6244 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6245 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6246 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6247 | if (err < 0) |
| 6248 | return err; |
| 6249 | } |
| 6250 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6251 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6252 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6253 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6254 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6255 | if (err < 0) |
| 6256 | return err; |
| 6257 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6258 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6259 | } |
| 6260 | |
| 6261 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6262 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6263 | const struct auto_pin_cfg *cfg) |
| 6264 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6265 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | } |
| 6267 | |
| 6268 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6269 | hda_nid_t nid, int pin_type, |
| 6270 | int sel_idx) |
| 6271 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6272 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6273 | /* need the manual connection? */ |
| 6274 | if (nid >= 0x12) { |
| 6275 | int idx = nid - 0x12; |
| 6276 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6277 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6278 | } |
| 6279 | } |
| 6280 | |
| 6281 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6282 | { |
| 6283 | struct alc_spec *spec = codec->spec; |
| 6284 | hda_nid_t nid; |
| 6285 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6286 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6287 | if (nid) { |
| 6288 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6289 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6290 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6291 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6292 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6293 | if (nid) |
| 6294 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6295 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6296 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6298 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6299 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6300 | |
| 6301 | #define ALC260_PIN_CD_NID 0x16 |
| 6302 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6303 | { |
| 6304 | struct alc_spec *spec = codec->spec; |
| 6305 | int i; |
| 6306 | |
| 6307 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6308 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6309 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6310 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6311 | if (nid != ALC260_PIN_CD_NID && |
| 6312 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6313 | snd_hda_codec_write(codec, nid, 0, |
| 6314 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6315 | AMP_OUT_MUTE); |
| 6316 | } |
| 6317 | } |
| 6318 | } |
| 6319 | |
| 6320 | /* |
| 6321 | * generic initialization of ADC, input mixers and output mixers |
| 6322 | */ |
| 6323 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6324 | /* |
| 6325 | * Unmute ADC0-1 and set the default input to mic-in |
| 6326 | */ |
| 6327 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6328 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6329 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6330 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6331 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6333 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6334 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6335 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6336 | */ |
| 6337 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6338 | /* mute analog inputs */ |
| 6339 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6340 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6341 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6342 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6343 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6344 | |
| 6345 | /* |
| 6346 | * Set up output mixers (0x08 - 0x0a) |
| 6347 | */ |
| 6348 | /* set vol=0 to output mixers */ |
| 6349 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6350 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6351 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6352 | /* set up input amps for analog loopback */ |
| 6353 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6354 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6356 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6357 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6358 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6359 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6360 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6361 | { } |
| 6362 | }; |
| 6363 | |
| 6364 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6365 | { |
| 6366 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6367 | int err; |
| 6368 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6369 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6370 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6371 | alc260_ignore); |
| 6372 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6373 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6374 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6375 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6376 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6377 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6378 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6379 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6380 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6381 | return err; |
| 6382 | |
| 6383 | spec->multiout.max_channels = 2; |
| 6384 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6385 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6387 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6388 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6389 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6390 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6391 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6392 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6393 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6394 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6395 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6396 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6397 | return 1; |
| 6398 | } |
| 6399 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6400 | /* additional initialization for auto-configuration model */ |
| 6401 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6402 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6403 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6404 | alc260_auto_init_multi_out(codec); |
| 6405 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6406 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6407 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | } |
| 6409 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6410 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6411 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6412 | { 0x07, HDA_INPUT, 0 }, |
| 6413 | { 0x07, HDA_INPUT, 1 }, |
| 6414 | { 0x07, HDA_INPUT, 2 }, |
| 6415 | { 0x07, HDA_INPUT, 3 }, |
| 6416 | { 0x07, HDA_INPUT, 4 }, |
| 6417 | { } /* end */ |
| 6418 | }; |
| 6419 | #endif |
| 6420 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6421 | /* |
| 6422 | * ALC260 configurations |
| 6423 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6424 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6425 | [ALC260_BASIC] = "basic", |
| 6426 | [ALC260_HP] = "hp", |
| 6427 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6428 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6429 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6430 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6431 | [ALC260_WILL] = "will", |
| 6432 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6433 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6434 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6435 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6436 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6437 | [ALC260_AUTO] = "auto", |
| 6438 | }; |
| 6439 | |
| 6440 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6441 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6442 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6443 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6444 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6445 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6446 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6447 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6448 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6449 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6450 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6451 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6452 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6453 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6454 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6455 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6456 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6457 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6458 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6459 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6460 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6461 | {} |
| 6462 | }; |
| 6463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6464 | static struct alc_config_preset alc260_presets[] = { |
| 6465 | [ALC260_BASIC] = { |
| 6466 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6467 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6468 | .init_verbs = { alc260_init_verbs }, |
| 6469 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6470 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6471 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6472 | .adc_nids = alc260_adc_nids, |
| 6473 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6474 | .channel_mode = alc260_modes, |
| 6475 | .input_mux = &alc260_capture_source, |
| 6476 | }, |
| 6477 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6478 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6479 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6480 | .init_verbs = { alc260_init_verbs, |
| 6481 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6482 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6483 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6484 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6485 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6486 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6487 | .channel_mode = alc260_modes, |
| 6488 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6489 | .unsol_event = alc260_hp_unsol_event, |
| 6490 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6491 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6492 | [ALC260_HP_DC7600] = { |
| 6493 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6494 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6495 | .init_verbs = { alc260_init_verbs, |
| 6496 | alc260_hp_dc7600_verbs }, |
| 6497 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6498 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6499 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6500 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6501 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6502 | .channel_mode = alc260_modes, |
| 6503 | .input_mux = &alc260_capture_source, |
| 6504 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6505 | .init_hook = alc260_hp_3012_automute, |
| 6506 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6507 | [ALC260_HP_3013] = { |
| 6508 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6509 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6510 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6511 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6512 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6513 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6514 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6515 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6516 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6517 | .channel_mode = alc260_modes, |
| 6518 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6519 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6520 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6521 | }, |
| 6522 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6523 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6524 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6525 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6526 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6527 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6528 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6529 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6530 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6531 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6532 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6533 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6534 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6535 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6536 | .init_verbs = { alc260_acer_init_verbs }, |
| 6537 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6538 | .dac_nids = alc260_dac_nids, |
| 6539 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6540 | .adc_nids = alc260_dual_adc_nids, |
| 6541 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6542 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6543 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6544 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6545 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6546 | [ALC260_FAVORIT100] = { |
| 6547 | .mixers = { alc260_favorit100_mixer }, |
| 6548 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6549 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6550 | .dac_nids = alc260_dac_nids, |
| 6551 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6552 | .adc_nids = alc260_dual_adc_nids, |
| 6553 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6554 | .channel_mode = alc260_modes, |
| 6555 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6556 | .input_mux = alc260_favorit100_capture_sources, |
| 6557 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6558 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6559 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6560 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6561 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6562 | .dac_nids = alc260_dac_nids, |
| 6563 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6564 | .adc_nids = alc260_adc_nids, |
| 6565 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6566 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6567 | .channel_mode = alc260_modes, |
| 6568 | .input_mux = &alc260_capture_source, |
| 6569 | }, |
| 6570 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6571 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6572 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6573 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6574 | .dac_nids = alc260_dac_nids, |
| 6575 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6576 | .adc_nids = alc260_adc_nids, |
| 6577 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6578 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6579 | .channel_mode = alc260_modes, |
| 6580 | .input_mux = &alc260_capture_source, |
| 6581 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6582 | .init_hook = alc260_replacer_672v_automute, |
| 6583 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6584 | #ifdef CONFIG_SND_DEBUG |
| 6585 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6586 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6587 | .init_verbs = { alc260_test_init_verbs }, |
| 6588 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6589 | .dac_nids = alc260_test_dac_nids, |
| 6590 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6591 | .adc_nids = alc260_test_adc_nids, |
| 6592 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6593 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6594 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6595 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6596 | }, |
| 6597 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6598 | }; |
| 6599 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6600 | static int patch_alc260(struct hda_codec *codec) |
| 6601 | { |
| 6602 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6603 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6604 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6605 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6606 | if (spec == NULL) |
| 6607 | return -ENOMEM; |
| 6608 | |
| 6609 | codec->spec = spec; |
| 6610 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6611 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6612 | alc260_models, |
| 6613 | alc260_cfg_tbl); |
| 6614 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6615 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6616 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6617 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6618 | } |
| 6619 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6620 | if (board_config == ALC260_AUTO) { |
| 6621 | /* automatic parse from the BIOS config */ |
| 6622 | err = alc260_parse_auto_config(codec); |
| 6623 | if (err < 0) { |
| 6624 | alc_free(codec); |
| 6625 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6626 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6627 | printk(KERN_INFO |
| 6628 | "hda_codec: Cannot set up configuration " |
| 6629 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6630 | board_config = ALC260_BASIC; |
| 6631 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6632 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6633 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6634 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6635 | if (err < 0) { |
| 6636 | alc_free(codec); |
| 6637 | return err; |
| 6638 | } |
| 6639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6640 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6641 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6642 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6643 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6644 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6645 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6646 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6647 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6648 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6649 | if (!spec->adc_nids && spec->input_mux) { |
| 6650 | /* check whether NID 0x04 is valid */ |
| 6651 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6652 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6653 | /* get type */ |
| 6654 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6655 | spec->adc_nids = alc260_adc_nids_alt; |
| 6656 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6657 | } else { |
| 6658 | spec->adc_nids = alc260_adc_nids; |
| 6659 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6660 | } |
| 6661 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6662 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6663 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6664 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6665 | spec->vmaster_nid = 0x08; |
| 6666 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6667 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6668 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6669 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6670 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6671 | if (!spec->loopback.amplist) |
| 6672 | spec->loopback.amplist = alc260_loopbacks; |
| 6673 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6674 | |
| 6675 | return 0; |
| 6676 | } |
| 6677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6678 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6679 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6680 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6681 | * |
| 6682 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6683 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6684 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6685 | * 6-channel independent captures. |
| 6686 | * |
| 6687 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6688 | * driver yet). |
| 6689 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6690 | #define ALC882_DIGOUT_NID 0x06 |
| 6691 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6692 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6693 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6694 | #define ALC1200_DIGOUT_NID 0x10 |
| 6695 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6696 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6697 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6698 | { 8, NULL } |
| 6699 | }; |
| 6700 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6701 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6702 | static hda_nid_t alc882_dac_nids[4] = { |
| 6703 | /* front, rear, clfe, rear_surr */ |
| 6704 | 0x02, 0x03, 0x04, 0x05 |
| 6705 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6706 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6707 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6708 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6709 | #define alc882_adc_nids alc880_adc_nids |
| 6710 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6711 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6712 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6713 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6714 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6715 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6716 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6717 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6718 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6719 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6720 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6721 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6722 | /* input MUX */ |
| 6723 | /* FIXME: should be a matrix-type input source selection */ |
| 6724 | |
| 6725 | static struct hda_input_mux alc882_capture_source = { |
| 6726 | .num_items = 4, |
| 6727 | .items = { |
| 6728 | { "Mic", 0x0 }, |
| 6729 | { "Front Mic", 0x1 }, |
| 6730 | { "Line", 0x2 }, |
| 6731 | { "CD", 0x4 }, |
| 6732 | }, |
| 6733 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6734 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6735 | #define alc883_capture_source alc882_capture_source |
| 6736 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6737 | static struct hda_input_mux alc889_capture_source = { |
| 6738 | .num_items = 3, |
| 6739 | .items = { |
| 6740 | { "Front Mic", 0x0 }, |
| 6741 | { "Mic", 0x3 }, |
| 6742 | { "Line", 0x2 }, |
| 6743 | }, |
| 6744 | }; |
| 6745 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6746 | static struct hda_input_mux mb5_capture_source = { |
| 6747 | .num_items = 3, |
| 6748 | .items = { |
| 6749 | { "Mic", 0x1 }, |
| 6750 | { "Line", 0x2 }, |
| 6751 | { "CD", 0x4 }, |
| 6752 | }, |
| 6753 | }; |
| 6754 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 6755 | static struct hda_input_mux macmini3_capture_source = { |
| 6756 | .num_items = 2, |
| 6757 | .items = { |
| 6758 | { "Line", 0x2 }, |
| 6759 | { "CD", 0x4 }, |
| 6760 | }, |
| 6761 | }; |
| 6762 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6763 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6764 | .num_items = 4, |
| 6765 | .items = { |
| 6766 | { "Mic", 0x1 }, |
| 6767 | { "Front Mic", 0x0 }, |
| 6768 | { "Line", 0x2 }, |
| 6769 | { "CD", 0x4 }, |
| 6770 | }, |
| 6771 | }; |
| 6772 | |
| 6773 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6774 | .num_items = 2, |
| 6775 | .items = { |
| 6776 | { "Mic", 0x1 }, |
| 6777 | { "Line", 0x2 }, |
| 6778 | }, |
| 6779 | }; |
| 6780 | |
| 6781 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6782 | .num_items = 4, |
| 6783 | .items = { |
| 6784 | { "Mic", 0x0 }, |
| 6785 | { "iMic", 0x1 }, |
| 6786 | { "Line", 0x2 }, |
| 6787 | { "CD", 0x4 }, |
| 6788 | }, |
| 6789 | }; |
| 6790 | |
| 6791 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6792 | .num_items = 2, |
| 6793 | .items = { |
| 6794 | { "Mic", 0x0 }, |
| 6795 | { "Int Mic", 0x1 }, |
| 6796 | }, |
| 6797 | }; |
| 6798 | |
| 6799 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6800 | .num_items = 3, |
| 6801 | .items = { |
| 6802 | { "Mic", 0x0 }, |
| 6803 | { "Front Mic", 0x1 }, |
| 6804 | { "Line", 0x4 }, |
| 6805 | }, |
| 6806 | }; |
| 6807 | |
| 6808 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6809 | .num_items = 2, |
| 6810 | .items = { |
| 6811 | { "Mic", 0x0 }, |
| 6812 | { "Line", 0x2 }, |
| 6813 | }, |
| 6814 | }; |
| 6815 | |
| 6816 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6817 | .num_items = 2, |
| 6818 | .items = { |
| 6819 | { "Mic", 0x0 }, |
| 6820 | /* Front Mic (0x01) unused */ |
| 6821 | { "Line", 0x2 }, |
| 6822 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 6823 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6824 | }, |
| 6825 | }; |
| 6826 | |
| 6827 | /* |
| 6828 | * 2ch mode |
| 6829 | */ |
| 6830 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6831 | { 2, NULL } |
| 6832 | }; |
| 6833 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6834 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6835 | * 2ch mode |
| 6836 | */ |
| 6837 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6838 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6839 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6840 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6841 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6842 | { } /* end */ |
| 6843 | }; |
| 6844 | |
| 6845 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6846 | * 4ch mode |
| 6847 | */ |
| 6848 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6849 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6850 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6851 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6852 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6853 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6854 | { } /* end */ |
| 6855 | }; |
| 6856 | |
| 6857 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6858 | * 6ch mode |
| 6859 | */ |
| 6860 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6861 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6862 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6863 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6864 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6865 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6866 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6867 | { } /* end */ |
| 6868 | }; |
| 6869 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6870 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6871 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6872 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6873 | { 6, alc882_3ST_ch6_init }, |
| 6874 | }; |
| 6875 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6876 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6877 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6878 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6879 | * 2ch mode |
| 6880 | */ |
| 6881 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6882 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6883 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6884 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6885 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6886 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6887 | { } /* end */ |
| 6888 | }; |
| 6889 | |
| 6890 | /* |
| 6891 | * 4ch mode |
| 6892 | */ |
| 6893 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6894 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6895 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6896 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6897 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6898 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6899 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6900 | { } /* end */ |
| 6901 | }; |
| 6902 | |
| 6903 | /* |
| 6904 | * 6ch mode |
| 6905 | */ |
| 6906 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6907 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6908 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6909 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6910 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6911 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6912 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6913 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6914 | { } /* end */ |
| 6915 | }; |
| 6916 | |
| 6917 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6918 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6919 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6920 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6921 | }; |
| 6922 | |
| 6923 | |
| 6924 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6925 | * 6ch mode |
| 6926 | */ |
| 6927 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6928 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6929 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6930 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6931 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6932 | { } /* end */ |
| 6933 | }; |
| 6934 | |
| 6935 | /* |
| 6936 | * 8ch mode |
| 6937 | */ |
| 6938 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6939 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6940 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6941 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6942 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6943 | { } /* end */ |
| 6944 | }; |
| 6945 | |
| 6946 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6947 | { 6, alc882_sixstack_ch6_init }, |
| 6948 | { 8, alc882_sixstack_ch8_init }, |
| 6949 | }; |
| 6950 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6951 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6952 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6953 | */ |
| 6954 | |
| 6955 | /* |
| 6956 | * 2ch mode |
| 6957 | */ |
| 6958 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6959 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6960 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6961 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6962 | { } /* end */ |
| 6963 | }; |
| 6964 | |
| 6965 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6966 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6967 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6968 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6969 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6970 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6971 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6972 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6973 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6974 | { } /* end */ |
| 6975 | }; |
| 6976 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6977 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6978 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6979 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6980 | }; |
| 6981 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6982 | /* |
| 6983 | * 2ch |
| 6984 | * Speakers/Woofer/HP = Front |
| 6985 | * LineIn = Input |
| 6986 | */ |
| 6987 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6988 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6989 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6990 | { } /* end */ |
| 6991 | }; |
| 6992 | |
| 6993 | /* |
| 6994 | * 6ch mode |
| 6995 | * Speakers/HP = Front |
| 6996 | * Woofer = LFE |
| 6997 | * LineIn = Surround |
| 6998 | */ |
| 6999 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7000 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7001 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7002 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7003 | { } /* end */ |
| 7004 | }; |
| 7005 | |
| 7006 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7007 | { 2, alc885_mb5_ch2_init }, |
| 7008 | { 6, alc885_mb5_ch6_init }, |
| 7009 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7010 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame^] | 7011 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7012 | |
| 7013 | /* |
| 7014 | * 2ch mode |
| 7015 | */ |
| 7016 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7017 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7018 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7019 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7020 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7021 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7022 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7023 | { } /* end */ |
| 7024 | }; |
| 7025 | |
| 7026 | /* |
| 7027 | * 4ch mode |
| 7028 | */ |
| 7029 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7030 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7031 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7032 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7033 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7034 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7035 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7036 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7037 | { } /* end */ |
| 7038 | }; |
| 7039 | |
| 7040 | /* |
| 7041 | * 6ch mode |
| 7042 | */ |
| 7043 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7044 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7045 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7046 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7047 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7048 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7049 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7050 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7051 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7052 | { } /* end */ |
| 7053 | }; |
| 7054 | |
| 7055 | /* |
| 7056 | * 8ch mode |
| 7057 | */ |
| 7058 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7059 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7060 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7061 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7062 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7063 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7064 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7065 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7066 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7067 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7068 | { } /* end */ |
| 7069 | }; |
| 7070 | |
| 7071 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7072 | { 2, alc883_4ST_ch2_init }, |
| 7073 | { 4, alc883_4ST_ch4_init }, |
| 7074 | { 6, alc883_4ST_ch6_init }, |
| 7075 | { 8, alc883_4ST_ch8_init }, |
| 7076 | }; |
| 7077 | |
| 7078 | |
| 7079 | /* |
| 7080 | * 2ch mode |
| 7081 | */ |
| 7082 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7083 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7084 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7085 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7086 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7087 | { } /* end */ |
| 7088 | }; |
| 7089 | |
| 7090 | /* |
| 7091 | * 4ch mode |
| 7092 | */ |
| 7093 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7094 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7095 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7096 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7097 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7098 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7099 | { } /* end */ |
| 7100 | }; |
| 7101 | |
| 7102 | /* |
| 7103 | * 6ch mode |
| 7104 | */ |
| 7105 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7106 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7107 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7108 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7109 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7110 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7111 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7112 | { } /* end */ |
| 7113 | }; |
| 7114 | |
| 7115 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7116 | { 2, alc883_3ST_ch2_intel_init }, |
| 7117 | { 4, alc883_3ST_ch4_intel_init }, |
| 7118 | { 6, alc883_3ST_ch6_intel_init }, |
| 7119 | }; |
| 7120 | |
| 7121 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7122 | * 2ch mode |
| 7123 | */ |
| 7124 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7125 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7126 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7127 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7128 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7129 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7130 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7131 | { } /* end */ |
| 7132 | }; |
| 7133 | |
| 7134 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7135 | * 6ch mode |
| 7136 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7137 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7138 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7139 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7140 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7141 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7142 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7143 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7144 | { } /* end */ |
| 7145 | }; |
| 7146 | |
| 7147 | /* |
| 7148 | * 8ch mode |
| 7149 | */ |
| 7150 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7151 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7152 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7153 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7154 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7155 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7156 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7157 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7158 | { } /* end */ |
| 7159 | }; |
| 7160 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7161 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7162 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7163 | { 6, alc889_ch6_intel_init }, |
| 7164 | { 8, alc889_ch8_intel_init }, |
| 7165 | }; |
| 7166 | |
| 7167 | /* |
| 7168 | * 6ch mode |
| 7169 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7170 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7171 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7172 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7173 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7174 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7175 | { } /* end */ |
| 7176 | }; |
| 7177 | |
| 7178 | /* |
| 7179 | * 8ch mode |
| 7180 | */ |
| 7181 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7182 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7183 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7184 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7185 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7186 | { } /* end */ |
| 7187 | }; |
| 7188 | |
| 7189 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7190 | { 6, alc883_sixstack_ch6_init }, |
| 7191 | { 8, alc883_sixstack_ch8_init }, |
| 7192 | }; |
| 7193 | |
| 7194 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7195 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7196 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7197 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7198 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7199 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7200 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7201 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7202 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7203 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7204 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7205 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7206 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7207 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7208 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7210 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7211 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7212 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7213 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7214 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7215 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7217 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7218 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7219 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7220 | { } /* end */ |
| 7221 | }; |
| 7222 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7223 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7224 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7225 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7226 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7227 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7228 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7229 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7230 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7231 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7232 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7233 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7234 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7235 | { } /* end */ |
| 7236 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7237 | |
| 7238 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7240 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7241 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7242 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7243 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7244 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7245 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7246 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7247 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7248 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7249 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7250 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7251 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7252 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7253 | { } /* end */ |
| 7254 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7255 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7256 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7257 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7258 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7259 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7260 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7261 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7262 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7263 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7264 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7265 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7266 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7267 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7268 | { } /* end */ |
| 7269 | }; |
| 7270 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7271 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7272 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7273 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7274 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7275 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7276 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7277 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7279 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7280 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7281 | { } /* end */ |
| 7282 | }; |
| 7283 | |
| 7284 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7285 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7287 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7288 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7289 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7290 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7291 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7293 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7295 | { } /* end */ |
| 7296 | }; |
| 7297 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7298 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7299 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7300 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7301 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7304 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7305 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7306 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7307 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7308 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7309 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7310 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7311 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7312 | { } /* end */ |
| 7313 | }; |
| 7314 | |
| 7315 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7316 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7317 | */ |
| 7318 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7320 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7321 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7322 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7323 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7324 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7325 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7326 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7327 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7328 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7329 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7330 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7331 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7332 | { } /* end */ |
| 7333 | }; |
| 7334 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7335 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7336 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7337 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7338 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7339 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7340 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7341 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7342 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7343 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7344 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7345 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7346 | { } /* end */ |
| 7347 | }; |
| 7348 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7349 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7350 | { |
| 7351 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7352 | .name = "Channel Mode", |
| 7353 | .info = alc_ch_mode_info, |
| 7354 | .get = alc_ch_mode_get, |
| 7355 | .put = alc_ch_mode_put, |
| 7356 | }, |
| 7357 | { } /* end */ |
| 7358 | }; |
| 7359 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7360 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7361 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7362 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7363 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7364 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7365 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7366 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7367 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7368 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7369 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7370 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7371 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7372 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7374 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7375 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7376 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7377 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7378 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7380 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7381 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7382 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7383 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7384 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7385 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7386 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7387 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7388 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7389 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7390 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7391 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7393 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7396 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7397 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7398 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7399 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7401 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7402 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7403 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7404 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7405 | |
| 7406 | /* FIXME: use matrix-type input source selection */ |
| 7407 | /* 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] | 7408 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7410 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7411 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7412 | /* ADC2: mute amp left and right */ |
| 7413 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7414 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7415 | /* ADC3: mute amp left and right */ |
| 7416 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7417 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7418 | |
| 7419 | { } |
| 7420 | }; |
| 7421 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7422 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7423 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7425 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7428 | /* ADC1: mute amp left and right */ |
| 7429 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7430 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7431 | { } |
| 7432 | }; |
| 7433 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7434 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7435 | /* change to EAPD mode */ |
| 7436 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7437 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7438 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7439 | }; |
| 7440 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7441 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7442 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7443 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7444 | { } |
| 7445 | }; |
| 7446 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7447 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7448 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7450 | {} |
| 7451 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7452 | |
| 7453 | static struct hda_verb alc885_init_verbs[] = { |
| 7454 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7455 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7457 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7460 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7463 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7464 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7466 | |
| 7467 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7468 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7470 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7471 | /* Front Pin: output 0 (0x0c) */ |
| 7472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7474 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7475 | /* Rear Pin: output 1 (0x0d) */ |
| 7476 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7477 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7478 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7479 | /* CLFE Pin: output 2 (0x0e) */ |
| 7480 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7481 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7482 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7483 | /* Side Pin: output 3 (0x0f) */ |
| 7484 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7485 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7486 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7487 | /* Mic (rear) pin: input vref at 80% */ |
| 7488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7489 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7490 | /* Front Mic pin: input vref at 80% */ |
| 7491 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7492 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7493 | /* Line In pin: input */ |
| 7494 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7495 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7496 | |
| 7497 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7498 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7499 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7500 | /* Input mixer2 */ |
| 7501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7502 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7504 | /* ADC2: mute amp left and right */ |
| 7505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7506 | /* ADC3: mute amp left and right */ |
| 7507 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7508 | |
| 7509 | { } |
| 7510 | }; |
| 7511 | |
| 7512 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7516 | { } |
| 7517 | }; |
| 7518 | |
| 7519 | |
| 7520 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7521 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7522 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7523 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7524 | { } |
| 7525 | }; |
| 7526 | |
| 7527 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7528 | #define alc883_init_verbs alc882_base_init_verbs |
| 7529 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7530 | /* Mac Pro test */ |
| 7531 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7532 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7533 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7534 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7535 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7536 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7537 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7538 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7539 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7540 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7541 | { } /* end */ |
| 7542 | }; |
| 7543 | |
| 7544 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7545 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7548 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7549 | /* Front Pin: output 0 (0x0c) */ |
| 7550 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7551 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7552 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7553 | /* Front Mic pin: input vref at 80% */ |
| 7554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7556 | /* Speaker: output */ |
| 7557 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7558 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7559 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7560 | /* Headphone output (output 0 - 0x0c) */ |
| 7561 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7562 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7563 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7564 | |
| 7565 | /* FIXME: use matrix-type input source selection */ |
| 7566 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7567 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7568 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7569 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7570 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7571 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7572 | /* Input mixer2 */ |
| 7573 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7574 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7575 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7576 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7577 | /* Input mixer3 */ |
| 7578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7579 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7580 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7581 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7582 | /* ADC1: mute amp left and right */ |
| 7583 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7584 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7585 | /* ADC2: mute amp left and right */ |
| 7586 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7587 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7588 | /* ADC3: mute amp left and right */ |
| 7589 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7590 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7591 | |
| 7592 | { } |
| 7593 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7594 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7595 | /* Macbook 5,1 */ |
| 7596 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7597 | /* DACs */ |
| 7598 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7599 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7600 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7601 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7602 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7606 | /* Surround mixer */ |
| 7607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7608 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7609 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7610 | /* LFE mixer */ |
| 7611 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7612 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7613 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7614 | /* HP mixer */ |
| 7615 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7616 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7617 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7618 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7619 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7620 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7621 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7622 | /* LFE Pin (0x0e) */ |
| 7623 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7624 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7625 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7626 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7627 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7628 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7629 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7630 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7631 | /* Front Mic pin: input vref at 80% */ |
| 7632 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7634 | /* Line In pin */ |
| 7635 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7636 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7637 | |
| 7638 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7639 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7640 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7641 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7642 | { } |
| 7643 | }; |
| 7644 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7645 | /* Macmini 3,1 */ |
| 7646 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7647 | /* DACs */ |
| 7648 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7649 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7650 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7651 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7652 | /* Front mixer */ |
| 7653 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7654 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7655 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7656 | /* Surround mixer */ |
| 7657 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7658 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7659 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7660 | /* LFE mixer */ |
| 7661 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7662 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7663 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7664 | /* HP mixer */ |
| 7665 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7666 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7667 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7668 | /* Front Pin (0x0c) */ |
| 7669 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7670 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7671 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7672 | /* LFE Pin (0x0e) */ |
| 7673 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7674 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7675 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7676 | /* HP Pin (0x0f) */ |
| 7677 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7678 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7679 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7680 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7681 | /* Line In pin */ |
| 7682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7684 | |
| 7685 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7686 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7687 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7688 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7689 | { } |
| 7690 | }; |
| 7691 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7692 | /* Macbook Pro rev3 */ |
| 7693 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7694 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7695 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7697 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7698 | /* Rear mixer */ |
| 7699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7702 | /* HP mixer */ |
| 7703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7704 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7705 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7706 | /* Front Pin: output 0 (0x0c) */ |
| 7707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7708 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7709 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7710 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7711 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7713 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7714 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7715 | /* Mic (rear) pin: input vref at 80% */ |
| 7716 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7718 | /* Front Mic pin: input vref at 80% */ |
| 7719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7721 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7722 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7723 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7724 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7725 | |
| 7726 | /* FIXME: use matrix-type input source selection */ |
| 7727 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7728 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7729 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7730 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7731 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7732 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7733 | /* Input mixer2 */ |
| 7734 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7735 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7736 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7737 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7738 | /* Input mixer3 */ |
| 7739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7741 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7742 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7743 | /* ADC1: mute amp left and right */ |
| 7744 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7745 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7746 | /* ADC2: mute amp left and right */ |
| 7747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7748 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7749 | /* ADC3: mute amp left and right */ |
| 7750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7751 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7752 | |
| 7753 | { } |
| 7754 | }; |
| 7755 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7756 | /* iMac 9,1 */ |
| 7757 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7758 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7759 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7762 | /* Rear mixer */ |
| 7763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7764 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7766 | /* HP Pin: output 0 (0x0c) */ |
| 7767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7768 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7769 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7770 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7771 | /* Internal Speakers: output 0 (0x0d) */ |
| 7772 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7774 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7775 | /* Mic (rear) pin: input vref at 80% */ |
| 7776 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7777 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7778 | /* Front Mic pin: input vref at 80% */ |
| 7779 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7780 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7781 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7782 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7783 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7784 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7785 | |
| 7786 | /* FIXME: use matrix-type input source selection */ |
| 7787 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7788 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7793 | /* Input mixer2 */ |
| 7794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7798 | /* Input mixer3 */ |
| 7799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7803 | /* ADC1: mute amp left and right */ |
| 7804 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7805 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7806 | /* ADC2: mute amp left and right */ |
| 7807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7808 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7809 | /* ADC3: mute amp left and right */ |
| 7810 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7811 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7812 | |
| 7813 | { } |
| 7814 | }; |
| 7815 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7816 | /* iMac 24 mixer. */ |
| 7817 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7818 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7819 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7820 | { } /* end */ |
| 7821 | }; |
| 7822 | |
| 7823 | /* iMac 24 init verbs. */ |
| 7824 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7825 | /* Internal speakers: output 0 (0x0c) */ |
| 7826 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7827 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7828 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7829 | /* Internal speakers: output 0 (0x0c) */ |
| 7830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7832 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7833 | /* Headphone: output 0 (0x0c) */ |
| 7834 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7835 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7836 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7837 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7838 | /* Front Mic: input vref at 80% */ |
| 7839 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7840 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7841 | { } |
| 7842 | }; |
| 7843 | |
| 7844 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7845 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7846 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7847 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7848 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7849 | spec->autocfg.hp_pins[0] = 0x14; |
| 7850 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7851 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7852 | } |
| 7853 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 7854 | #define alc885_mb5_setup alc885_imac24_setup |
| 7855 | #define alc885_macmini3_setup alc885_imac24_setup |
| 7856 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7857 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7858 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7859 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7860 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7861 | spec->autocfg.hp_pins[0] = 0x15; |
| 7862 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7863 | } |
| 7864 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 7865 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7866 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 7867 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7868 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 7869 | spec->autocfg.hp_pins[0] = 0x14; |
| 7870 | spec->autocfg.speaker_pins[0] = 0x15; |
| 7871 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7872 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7873 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7874 | static struct hda_verb alc882_targa_verbs[] = { |
| 7875 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7876 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7877 | |
| 7878 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7879 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7880 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7881 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7882 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7883 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7884 | |
| 7885 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7886 | { } /* end */ |
| 7887 | }; |
| 7888 | |
| 7889 | /* toggle speaker-output according to the hp-jack state */ |
| 7890 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7891 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7892 | struct alc_spec *spec = codec->spec; |
| 7893 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7894 | 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] | 7895 | spec->jack_present ? 1 : 3); |
| 7896 | } |
| 7897 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7898 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7899 | { |
| 7900 | struct alc_spec *spec = codec->spec; |
| 7901 | |
| 7902 | spec->autocfg.hp_pins[0] = 0x14; |
| 7903 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7904 | } |
| 7905 | |
| 7906 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7907 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7908 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7909 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7910 | } |
| 7911 | |
| 7912 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7913 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7915 | |
| 7916 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7917 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7919 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7920 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7921 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7922 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7923 | |
| 7924 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7925 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7926 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7927 | { } /* end */ |
| 7928 | }; |
| 7929 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7930 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7932 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7933 | |
| 7934 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7935 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7936 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7937 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7938 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7940 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7941 | |
| 7942 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7943 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7944 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7945 | { } /* end */ |
| 7946 | }; |
| 7947 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7948 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7949 | { |
| 7950 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7951 | |
| 7952 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7953 | AC_VERB_GET_GPIO_DATA, 0); |
| 7954 | |
| 7955 | if (!muted) |
| 7956 | gpiostate |= (1 << pin); |
| 7957 | else |
| 7958 | gpiostate &= ~(1 << pin); |
| 7959 | |
| 7960 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7961 | AC_VERB_GET_GPIO_MASK, 0); |
| 7962 | gpiomask |= (1 << pin); |
| 7963 | |
| 7964 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7965 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7966 | gpiodir |= (1 << pin); |
| 7967 | |
| 7968 | |
| 7969 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7970 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7971 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7972 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7973 | |
| 7974 | msleep(1); |
| 7975 | |
| 7976 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7977 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7978 | } |
| 7979 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7980 | /* set up GPIO at initialization */ |
| 7981 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7982 | { |
| 7983 | alc882_gpio_mute(codec, 0, 0); |
| 7984 | alc882_gpio_mute(codec, 1, 0); |
| 7985 | } |
| 7986 | |
| 7987 | /* set up GPIO and update auto-muting at initialization */ |
| 7988 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7989 | { |
| 7990 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7991 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7992 | } |
| 7993 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7994 | /* |
| 7995 | * generic initialization of ADC, input mixers and output mixers |
| 7996 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7997 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7998 | /* |
| 7999 | * Unmute ADC0-2 and set the default input to mic-in |
| 8000 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8001 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8003 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8004 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8005 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8006 | /* |
| 8007 | * Set up output mixers (0x0c - 0x0f) |
| 8008 | */ |
| 8009 | /* set vol=0 to output mixers */ |
| 8010 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8011 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8012 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8013 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8014 | /* set up input amps for analog loopback */ |
| 8015 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8016 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8017 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8018 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8019 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8020 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8021 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8022 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8023 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8024 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8025 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8026 | |
| 8027 | /* FIXME: use matrix-type input source selection */ |
| 8028 | /* 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] | 8029 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8030 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8031 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8032 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8033 | { } |
| 8034 | }; |
| 8035 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8036 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8037 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8038 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8039 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8040 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8041 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8042 | { } /* end */ |
| 8043 | }; |
| 8044 | |
| 8045 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8046 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8047 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8048 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
| 8054 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8055 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8056 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8057 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8058 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8059 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8060 | { } /* end */ |
| 8061 | }; |
| 8062 | |
| 8063 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8064 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8066 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8068 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8069 | { } /* end */ |
| 8070 | }; |
| 8071 | |
| 8072 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8073 | { 2, alc889A_mb31_ch2_init }, |
| 8074 | { 4, alc889A_mb31_ch4_init }, |
| 8075 | { 5, alc889A_mb31_ch5_init }, |
| 8076 | { 6, alc889A_mb31_ch6_init }, |
| 8077 | }; |
| 8078 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8079 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8080 | /* eanable EAPD on medion laptop */ |
| 8081 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8082 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8083 | { } |
| 8084 | }; |
| 8085 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8086 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8087 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8088 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8089 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8090 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8091 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8092 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8093 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8094 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8095 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8096 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8097 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8099 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8100 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8101 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8102 | { } /* end */ |
| 8103 | }; |
| 8104 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8105 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8106 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8107 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8108 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8109 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8111 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8112 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8113 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8114 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8115 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8116 | { } /* end */ |
| 8117 | }; |
| 8118 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8119 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8120 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8121 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8122 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8123 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8125 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8127 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8128 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8129 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8130 | { } /* end */ |
| 8131 | }; |
| 8132 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8133 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8136 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8137 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8138 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8139 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8140 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8141 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8142 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8143 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8144 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8145 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8146 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8147 | { } /* end */ |
| 8148 | }; |
| 8149 | |
| 8150 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8151 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8152 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8153 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8154 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8155 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8156 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8157 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8158 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8159 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8160 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8161 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8162 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8163 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8165 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8167 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8168 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8169 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8170 | { } /* end */ |
| 8171 | }; |
| 8172 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8173 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8174 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8175 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8176 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8177 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8178 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8179 | HDA_OUTPUT), |
| 8180 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8181 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8182 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8183 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8184 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8185 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8186 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8187 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8188 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8189 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8190 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8191 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8192 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8193 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8194 | { } /* end */ |
| 8195 | }; |
| 8196 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8197 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8198 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8199 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8200 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8201 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8202 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8203 | HDA_OUTPUT), |
| 8204 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8205 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8206 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8207 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8208 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8209 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8210 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8211 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8212 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8213 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8214 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8215 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8216 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8217 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8218 | { } /* end */ |
| 8219 | }; |
| 8220 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8221 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8222 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8223 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8224 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8225 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8226 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8227 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8228 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8229 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8230 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8231 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8232 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8234 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8235 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8236 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8237 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8238 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8239 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8240 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8241 | { } /* end */ |
| 8242 | }; |
| 8243 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8244 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8245 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8246 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8248 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8249 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8250 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8251 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8252 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8253 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8254 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8255 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8256 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8257 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8258 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8259 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8260 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8261 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8262 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8263 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8264 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8265 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8266 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8267 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8269 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8270 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8271 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8273 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8274 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8275 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8276 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8277 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8278 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8279 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8280 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8281 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8282 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8283 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8284 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8285 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8286 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8287 | { } /* end */ |
| 8288 | }; |
| 8289 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8290 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8291 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8292 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8293 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8294 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8295 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8296 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8297 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8298 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8299 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8300 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8301 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8302 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8303 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8304 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8305 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8306 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8307 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8308 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8309 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8310 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8311 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8312 | { } /* end */ |
| 8313 | }; |
| 8314 | |
| 8315 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8317 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8318 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8319 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8320 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8321 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8322 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8323 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8324 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8325 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8326 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8327 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8328 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8329 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8330 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8331 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8335 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8336 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8337 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8338 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8339 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8340 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8341 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8342 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8343 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8344 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8346 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8350 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8352 | { } /* end */ |
| 8353 | }; |
| 8354 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8355 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8356 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8357 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8358 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8359 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8360 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8361 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8362 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8363 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8364 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8365 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8366 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8367 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8368 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8369 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8372 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8373 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8374 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8375 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8376 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8377 | { } /* end */ |
| 8378 | }; |
| 8379 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8380 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8381 | /* Output mixers */ |
| 8382 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8383 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8384 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8385 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8386 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8387 | HDA_OUTPUT), |
| 8388 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8389 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8390 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8391 | /* Output switches */ |
| 8392 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8393 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8394 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8395 | /* Boost mixers */ |
| 8396 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8397 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8398 | /* Input mixers */ |
| 8399 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8400 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8401 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8402 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8403 | { } /* end */ |
| 8404 | }; |
| 8405 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8406 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8408 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8409 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8410 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8411 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8412 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8413 | { } /* end */ |
| 8414 | }; |
| 8415 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8416 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8417 | .ops = &snd_hda_bind_vol, |
| 8418 | .values = { |
| 8419 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8420 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8421 | 0 |
| 8422 | }, |
| 8423 | }; |
| 8424 | |
| 8425 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8426 | .ops = &snd_hda_bind_sw, |
| 8427 | .values = { |
| 8428 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8429 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8430 | 0 |
| 8431 | }, |
| 8432 | }; |
| 8433 | |
| 8434 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8435 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8436 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8437 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8438 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8439 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8440 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8441 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8442 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8443 | { } /* end */ |
| 8444 | }; |
| 8445 | |
| 8446 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8447 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8448 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8449 | { |
| 8450 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8451 | /* .name = "Capture Source", */ |
| 8452 | .name = "Input Source", |
| 8453 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8454 | .info = alc_mux_enum_info, |
| 8455 | .get = alc_mux_enum_get, |
| 8456 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8457 | }, |
| 8458 | { } /* end */ |
| 8459 | }; |
| 8460 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8461 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8462 | { |
| 8463 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8464 | .name = "Channel Mode", |
| 8465 | .info = alc_ch_mode_info, |
| 8466 | .get = alc_ch_mode_get, |
| 8467 | .put = alc_ch_mode_put, |
| 8468 | }, |
| 8469 | { } /* end */ |
| 8470 | }; |
| 8471 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8472 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8473 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8474 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8475 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8476 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8477 | spec->autocfg.hp_pins[0] = 0x15; |
| 8478 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8479 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8480 | } |
| 8481 | |
| 8482 | /* auto-toggle front mic */ |
| 8483 | /* |
| 8484 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8485 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8486 | 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] | 8487 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8488 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8489 | } |
| 8490 | */ |
| 8491 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8492 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8493 | /* HP */ |
| 8494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8495 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8496 | /* Subwoofer */ |
| 8497 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8498 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8499 | |
| 8500 | /* enable unsolicited event */ |
| 8501 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8502 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8503 | |
| 8504 | { } /* end */ |
| 8505 | }; |
| 8506 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8507 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8508 | /* HP */ |
| 8509 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8510 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8511 | /* Int speaker */ |
| 8512 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8513 | |
| 8514 | /* enable unsolicited event */ |
| 8515 | /* |
| 8516 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8517 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8518 | */ |
| 8519 | |
| 8520 | { } /* end */ |
| 8521 | }; |
| 8522 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8523 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8524 | /* HP */ |
| 8525 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8526 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8527 | /* Int speaker */ |
| 8528 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8529 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8530 | |
| 8531 | /* enable unsolicited event */ |
| 8532 | {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] | 8533 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8534 | |
| 8535 | { } /* end */ |
| 8536 | }; |
| 8537 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8538 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8539 | /* HP */ |
| 8540 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8541 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8542 | /* Subwoofer */ |
| 8543 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8544 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8545 | |
| 8546 | /* enable unsolicited event */ |
| 8547 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8548 | |
| 8549 | { } /* end */ |
| 8550 | }; |
| 8551 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8552 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8553 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8554 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8555 | |
| 8556 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8557 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8558 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8559 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8560 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8561 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8562 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8563 | /* Connect Mic jack to CLFE */ |
| 8564 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8565 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8566 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8567 | /* Connect Line-in jack to Surround */ |
| 8568 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8569 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8570 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8571 | /* Connect HP out jack to Front */ |
| 8572 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8573 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8574 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8575 | |
| 8576 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8577 | |
| 8578 | { } /* end */ |
| 8579 | }; |
| 8580 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8581 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8582 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8583 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8584 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8585 | { } /* end */ |
| 8586 | }; |
| 8587 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8588 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8589 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8590 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8591 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8592 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8593 | { } /* end */ |
| 8594 | }; |
| 8595 | |
| 8596 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8600 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8601 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8602 | { } /* end */ |
| 8603 | }; |
| 8604 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8605 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8606 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8607 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8608 | |
| 8609 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8610 | |
| 8611 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8612 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8613 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8614 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8615 | { } /* end */ |
| 8616 | }; |
| 8617 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8618 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8619 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8620 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8621 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8623 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8625 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8626 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8627 | { } /* end */ |
| 8628 | }; |
| 8629 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8630 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8631 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8632 | { } |
| 8633 | }; |
| 8634 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8635 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8636 | /* HP */ |
| 8637 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8638 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8639 | |
| 8640 | /* enable unsolicited event */ |
| 8641 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8642 | |
| 8643 | { } /* end */ |
| 8644 | }; |
| 8645 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8646 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8648 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8650 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8651 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8652 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8653 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8654 | } |
| 8655 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8656 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8657 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8658 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8659 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8660 | {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] | 8661 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8662 | }; |
| 8663 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8664 | /* |
| 8665 | * 2ch mode |
| 8666 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8667 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8668 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8669 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8670 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8671 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8672 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8673 | }; |
| 8674 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8675 | /* |
| 8676 | * 4ch mode |
| 8677 | */ |
| 8678 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8679 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8680 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8681 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8682 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8683 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8684 | { } /* end */ |
| 8685 | }; |
| 8686 | |
| 8687 | /* |
| 8688 | * 6ch mode |
| 8689 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8690 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8691 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8692 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8693 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8694 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8695 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8696 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8697 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8698 | }; |
| 8699 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8700 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8701 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8702 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8703 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8704 | }; |
| 8705 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8706 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8707 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8708 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8709 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8710 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8711 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8712 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8713 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8714 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8715 | } |
| 8716 | |
| 8717 | /* toggle RCA according to the front-jack state */ |
| 8718 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8719 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8720 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8721 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8722 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8723 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8724 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8725 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8726 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8727 | unsigned int res) |
| 8728 | { |
| 8729 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8730 | alc888_lenovo_ms7195_front_automute(codec); |
| 8731 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8732 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8733 | } |
| 8734 | |
| 8735 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8737 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8738 | |
| 8739 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8740 | |
| 8741 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8742 | { } /* end */ |
| 8743 | }; |
| 8744 | |
| 8745 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8746 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8747 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8748 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8749 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8750 | spec->autocfg.hp_pins[0] = 0x14; |
| 8751 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8752 | } |
| 8753 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8754 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8755 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8756 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8757 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8758 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8759 | { |
| 8760 | unsigned int present; |
| 8761 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8762 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8763 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8764 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8765 | } |
| 8766 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8767 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8768 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8769 | struct alc_spec *spec = codec->spec; |
| 8770 | |
| 8771 | spec->autocfg.hp_pins[0] = 0x15; |
| 8772 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8773 | } |
| 8774 | |
| 8775 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8776 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8777 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8778 | alc883_clevo_m720_mic_automute(codec); |
| 8779 | } |
| 8780 | |
| 8781 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8782 | unsigned int res) |
| 8783 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8784 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8785 | case ALC880_MIC_EVENT: |
| 8786 | alc883_clevo_m720_mic_automute(codec); |
| 8787 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8788 | default: |
| 8789 | alc_automute_amp_unsol_event(codec, res); |
| 8790 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8791 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8792 | } |
| 8793 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8794 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8795 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8796 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8797 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8798 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8799 | spec->autocfg.hp_pins[0] = 0x14; |
| 8800 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8801 | } |
| 8802 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8803 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8804 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8805 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8806 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8807 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8808 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8809 | } |
| 8810 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8811 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8812 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8813 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8814 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8815 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8816 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8817 | } |
| 8818 | |
| 8819 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8820 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8821 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8822 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8823 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8824 | HDA_AMP_MUTE, bits); |
| 8825 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8826 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8827 | } |
| 8828 | |
| 8829 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8830 | unsigned int res) |
| 8831 | { |
| 8832 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8833 | alc883_lenovo_101e_all_automute(codec); |
| 8834 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8835 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8836 | } |
| 8837 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8838 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8839 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8840 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8841 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8842 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8843 | spec->autocfg.hp_pins[0] = 0x14; |
| 8844 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8845 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8846 | } |
| 8847 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8848 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8849 | /* HP Pin: output 0 (0x0c) */ |
| 8850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8851 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8852 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8853 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8854 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8855 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8856 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8857 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8858 | /* eanable EAPD on medion laptop */ |
| 8859 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8860 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8861 | /* enable unsolicited event */ |
| 8862 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8863 | { } |
| 8864 | }; |
| 8865 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8866 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8867 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8868 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8869 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8870 | { } /* end */ |
| 8871 | }; |
| 8872 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8873 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8874 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8875 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8876 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8877 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8878 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8879 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8880 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8881 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8882 | } |
| 8883 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8884 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8885 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8886 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8887 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8888 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8889 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8890 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8891 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8892 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8893 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8894 | } |
| 8895 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8896 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8897 | { |
| 8898 | struct alc_spec *spec = codec->spec; |
| 8899 | |
| 8900 | spec->autocfg.hp_pins[0] = 0x15; |
| 8901 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8902 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8903 | } |
| 8904 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8905 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8907 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8908 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8909 | /* enable unsolicited event */ |
| 8910 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8911 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8912 | { } /* end */ |
| 8913 | }; |
| 8914 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8915 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8916 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8917 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8918 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8919 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8920 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8921 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8922 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8923 | spec->ext_mic.pin = 0x18; |
| 8924 | spec->int_mic.pin = 0x19; |
| 8925 | spec->ext_mic.mux_idx = 0; |
| 8926 | spec->int_mic.mux_idx = 1; |
| 8927 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8928 | } |
| 8929 | |
| 8930 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8931 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8933 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8934 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8935 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8936 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8937 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8938 | /* enable unsolicited event */ |
| 8939 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8940 | { } /* end */ |
| 8941 | }; |
| 8942 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8943 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8944 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8945 | struct alc_spec *spec = codec->spec; |
| 8946 | |
| 8947 | spec->autocfg.hp_pins[0] = 0x14; |
| 8948 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8949 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8950 | } |
| 8951 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8952 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8953 | /* Init rear pin (used as headphone output) */ |
| 8954 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8955 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8956 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8957 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8958 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8959 | /* Init line 2 pin (used as headphone out by default) */ |
| 8960 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8961 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8962 | { } /* end */ |
| 8963 | }; |
| 8964 | |
| 8965 | /* Mute speakers according to the headphone jack state */ |
| 8966 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8967 | { |
| 8968 | unsigned int present; |
| 8969 | |
| 8970 | /* Mute only in 2ch or 4ch mode */ |
| 8971 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8972 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8973 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8974 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8975 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8976 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8977 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8978 | } |
| 8979 | } |
| 8980 | |
| 8981 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8982 | { |
| 8983 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8984 | alc889A_mb31_automute(codec); |
| 8985 | } |
| 8986 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8987 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8988 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8989 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8990 | #endif |
| 8991 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8992 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8993 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8994 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8995 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8996 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8997 | |
| 8998 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8999 | ALC1200_DIGOUT_NID, 0, |
| 9000 | }; |
| 9001 | |
| 9002 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9003 | ALC883_DIGOUT_NID, 0, |
| 9004 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9005 | |
| 9006 | /* |
| 9007 | * configuration and preset |
| 9008 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9009 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9010 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9011 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9012 | [ALC882_ARIMA] = "arima", |
| 9013 | [ALC882_W2JC] = "w2jc", |
| 9014 | [ALC882_TARGA] = "targa", |
| 9015 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9016 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9017 | [ALC885_MACPRO] = "macpro", |
| 9018 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9019 | [ALC885_MACMINI3] = "macmini3", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9020 | [ALC885_MBP3] = "mbp3", |
| 9021 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9022 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9023 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9024 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9025 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9026 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9027 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9028 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9029 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9030 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9031 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9032 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9033 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9034 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9035 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9036 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9037 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9038 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9039 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9040 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9041 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9042 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9043 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9044 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9045 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9046 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9047 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9048 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9049 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9050 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9051 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9052 | [ALC889A_INTEL] = "intel-alc889a", |
| 9053 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9054 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9055 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9056 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9057 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9058 | }; |
| 9059 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9060 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9061 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9062 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9063 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9064 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9065 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9066 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9067 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9068 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9069 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9070 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9071 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9072 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9073 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9074 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9075 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9076 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9077 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9078 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9079 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9080 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9081 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9082 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9083 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9084 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9085 | /* default Acer -- disabled as it causes more problems. |
| 9086 | * model=auto should work fine now |
| 9087 | */ |
| 9088 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9089 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9090 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9091 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9092 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9093 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9094 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9095 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9096 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9097 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9098 | |
| 9099 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9100 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9101 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9102 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9103 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9104 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9105 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9106 | 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] | 9107 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9108 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9109 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9110 | |
| 9111 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9112 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9113 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9114 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9115 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9116 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9117 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9118 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9119 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9120 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9121 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9122 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9123 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9124 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9125 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9126 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9127 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9128 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9129 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9130 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9131 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9132 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9133 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9134 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9135 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9136 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9137 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9138 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9139 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9140 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9141 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9142 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9143 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9144 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9145 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9146 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9147 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9148 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9149 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9150 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9151 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9152 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9153 | 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] | 9154 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9155 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9156 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9157 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9158 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9159 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9160 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9161 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9162 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9163 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9164 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9165 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9166 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9167 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9168 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9169 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9170 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9171 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9172 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9173 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9174 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9175 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9176 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9177 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9178 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9179 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9180 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9181 | {} |
| 9182 | }; |
| 9183 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9184 | /* codec SSID table for Intel Mac */ |
| 9185 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9186 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9187 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9188 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9189 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9190 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9191 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9192 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9193 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9194 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9195 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9196 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9197 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9198 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9199 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9200 | */ |
| 9201 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9202 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9203 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9204 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9205 | }; |
| 9206 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9207 | static struct alc_config_preset alc882_presets[] = { |
| 9208 | [ALC882_3ST_DIG] = { |
| 9209 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9210 | .init_verbs = { alc882_base_init_verbs, |
| 9211 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9212 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9213 | .dac_nids = alc882_dac_nids, |
| 9214 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9215 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9216 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9217 | .channel_mode = alc882_ch_modes, |
| 9218 | .need_dac_fix = 1, |
| 9219 | .input_mux = &alc882_capture_source, |
| 9220 | }, |
| 9221 | [ALC882_6ST_DIG] = { |
| 9222 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9223 | .init_verbs = { alc882_base_init_verbs, |
| 9224 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9225 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9226 | .dac_nids = alc882_dac_nids, |
| 9227 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9228 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9229 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9230 | .channel_mode = alc882_sixstack_modes, |
| 9231 | .input_mux = &alc882_capture_source, |
| 9232 | }, |
| 9233 | [ALC882_ARIMA] = { |
| 9234 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9235 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9236 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9237 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9238 | .dac_nids = alc882_dac_nids, |
| 9239 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9240 | .channel_mode = alc882_sixstack_modes, |
| 9241 | .input_mux = &alc882_capture_source, |
| 9242 | }, |
| 9243 | [ALC882_W2JC] = { |
| 9244 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9245 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9246 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9247 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9248 | .dac_nids = alc882_dac_nids, |
| 9249 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9250 | .channel_mode = alc880_threestack_modes, |
| 9251 | .need_dac_fix = 1, |
| 9252 | .input_mux = &alc882_capture_source, |
| 9253 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9254 | }, |
| 9255 | [ALC885_MBP3] = { |
| 9256 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9257 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9258 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9259 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9260 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9261 | .hp_nid = 0x04, |
| 9262 | .channel_mode = alc885_mbp_4ch_modes, |
| 9263 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9264 | .input_mux = &alc882_capture_source, |
| 9265 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9266 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9267 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9268 | .setup = alc885_mbp3_setup, |
| 9269 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9270 | }, |
| 9271 | [ALC885_MB5] = { |
| 9272 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9273 | .init_verbs = { alc885_mb5_init_verbs, |
| 9274 | alc880_gpio1_init_verbs }, |
| 9275 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9276 | .dac_nids = alc882_dac_nids, |
| 9277 | .channel_mode = alc885_mb5_6ch_modes, |
| 9278 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9279 | .input_mux = &mb5_capture_source, |
| 9280 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9281 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9282 | .unsol_event = alc_automute_amp_unsol_event, |
| 9283 | .setup = alc885_mb5_setup, |
| 9284 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9285 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9286 | [ALC885_MACMINI3] = { |
| 9287 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9288 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9289 | alc880_gpio1_init_verbs }, |
| 9290 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9291 | .dac_nids = alc882_dac_nids, |
| 9292 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9293 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9294 | .input_mux = &macmini3_capture_source, |
| 9295 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9296 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9297 | .unsol_event = alc_automute_amp_unsol_event, |
| 9298 | .setup = alc885_macmini3_setup, |
| 9299 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9300 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9301 | [ALC885_MACPRO] = { |
| 9302 | .mixers = { alc882_macpro_mixer }, |
| 9303 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9304 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9305 | .dac_nids = alc882_dac_nids, |
| 9306 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9307 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9308 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9309 | .channel_mode = alc882_ch_modes, |
| 9310 | .input_mux = &alc882_capture_source, |
| 9311 | .init_hook = alc885_macpro_init_hook, |
| 9312 | }, |
| 9313 | [ALC885_IMAC24] = { |
| 9314 | .mixers = { alc885_imac24_mixer }, |
| 9315 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9316 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9317 | .dac_nids = alc882_dac_nids, |
| 9318 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9319 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9320 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9321 | .channel_mode = alc882_ch_modes, |
| 9322 | .input_mux = &alc882_capture_source, |
| 9323 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9324 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9325 | .init_hook = alc885_imac24_init_hook, |
| 9326 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9327 | [ALC885_IMAC91] = { |
| 9328 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9329 | .init_verbs = { alc885_imac91_init_verbs, |
| 9330 | alc880_gpio1_init_verbs }, |
| 9331 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9332 | .dac_nids = alc882_dac_nids, |
| 9333 | .channel_mode = alc885_mbp_4ch_modes, |
| 9334 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9335 | .input_mux = &alc882_capture_source, |
| 9336 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9337 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9338 | .unsol_event = alc_automute_amp_unsol_event, |
| 9339 | .setup = alc885_imac91_setup, |
| 9340 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9341 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9342 | [ALC882_TARGA] = { |
| 9343 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9344 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9345 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9346 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9347 | .dac_nids = alc882_dac_nids, |
| 9348 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9349 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9350 | .adc_nids = alc882_adc_nids, |
| 9351 | .capsrc_nids = alc882_capsrc_nids, |
| 9352 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9353 | .channel_mode = alc882_3ST_6ch_modes, |
| 9354 | .need_dac_fix = 1, |
| 9355 | .input_mux = &alc882_capture_source, |
| 9356 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9357 | .setup = alc882_targa_setup, |
| 9358 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9359 | }, |
| 9360 | [ALC882_ASUS_A7J] = { |
| 9361 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9362 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9363 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9364 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9365 | .dac_nids = alc882_dac_nids, |
| 9366 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9367 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9368 | .adc_nids = alc882_adc_nids, |
| 9369 | .capsrc_nids = alc882_capsrc_nids, |
| 9370 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9371 | .channel_mode = alc882_3ST_6ch_modes, |
| 9372 | .need_dac_fix = 1, |
| 9373 | .input_mux = &alc882_capture_source, |
| 9374 | }, |
| 9375 | [ALC882_ASUS_A7M] = { |
| 9376 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9377 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9378 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9379 | alc882_asus_a7m_verbs }, |
| 9380 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9381 | .dac_nids = alc882_dac_nids, |
| 9382 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9383 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9384 | .channel_mode = alc880_threestack_modes, |
| 9385 | .need_dac_fix = 1, |
| 9386 | .input_mux = &alc882_capture_source, |
| 9387 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9388 | [ALC883_3ST_2ch_DIG] = { |
| 9389 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9390 | .init_verbs = { alc883_init_verbs }, |
| 9391 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9392 | .dac_nids = alc883_dac_nids, |
| 9393 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9394 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9396 | .channel_mode = alc883_3ST_2ch_modes, |
| 9397 | .input_mux = &alc883_capture_source, |
| 9398 | }, |
| 9399 | [ALC883_3ST_6ch_DIG] = { |
| 9400 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9401 | .init_verbs = { alc883_init_verbs }, |
| 9402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9403 | .dac_nids = alc883_dac_nids, |
| 9404 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9405 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9406 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9407 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9408 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9409 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9410 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9411 | [ALC883_3ST_6ch] = { |
| 9412 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9413 | .init_verbs = { alc883_init_verbs }, |
| 9414 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9415 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9416 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9417 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9418 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9419 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9420 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9421 | [ALC883_3ST_6ch_INTEL] = { |
| 9422 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9423 | .init_verbs = { alc883_init_verbs }, |
| 9424 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9425 | .dac_nids = alc883_dac_nids, |
| 9426 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9427 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9428 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9429 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9430 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9431 | .need_dac_fix = 1, |
| 9432 | .input_mux = &alc883_3stack_6ch_intel, |
| 9433 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9434 | [ALC889A_INTEL] = { |
| 9435 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9436 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9437 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9438 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9439 | .dac_nids = alc883_dac_nids, |
| 9440 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9441 | .adc_nids = alc889_adc_nids, |
| 9442 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9443 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9444 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9445 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9446 | .channel_mode = alc889_8ch_intel_modes, |
| 9447 | .capsrc_nids = alc889_capsrc_nids, |
| 9448 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9449 | .setup = alc889_automute_setup, |
| 9450 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9451 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9452 | .need_dac_fix = 1, |
| 9453 | }, |
| 9454 | [ALC889_INTEL] = { |
| 9455 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9456 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9457 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9458 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9459 | .dac_nids = alc883_dac_nids, |
| 9460 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9461 | .adc_nids = alc889_adc_nids, |
| 9462 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9463 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9464 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9465 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9466 | .channel_mode = alc889_8ch_intel_modes, |
| 9467 | .capsrc_nids = alc889_capsrc_nids, |
| 9468 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9469 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9470 | .init_hook = alc889_intel_init_hook, |
| 9471 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9472 | .need_dac_fix = 1, |
| 9473 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9474 | [ALC883_6ST_DIG] = { |
| 9475 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9476 | .init_verbs = { alc883_init_verbs }, |
| 9477 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9478 | .dac_nids = alc883_dac_nids, |
| 9479 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9480 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9481 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9482 | .channel_mode = alc883_sixstack_modes, |
| 9483 | .input_mux = &alc883_capture_source, |
| 9484 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9485 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9486 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9487 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9488 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9489 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9490 | .dac_nids = alc883_dac_nids, |
| 9491 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9492 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9493 | .channel_mode = alc883_3ST_6ch_modes, |
| 9494 | .need_dac_fix = 1, |
| 9495 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9496 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9497 | .setup = alc882_targa_setup, |
| 9498 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9499 | }, |
| 9500 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9501 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9502 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9503 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9504 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9505 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9506 | .adc_nids = alc883_adc_nids_alt, |
| 9507 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9508 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9509 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9510 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9511 | .channel_mode = alc883_3ST_2ch_modes, |
| 9512 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9513 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9514 | .setup = alc882_targa_setup, |
| 9515 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9516 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9517 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9518 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9519 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9520 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9521 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9522 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9523 | .dac_nids = alc883_dac_nids, |
| 9524 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9525 | .adc_nids = alc883_adc_nids_rev, |
| 9526 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9527 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9528 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9529 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9530 | .channel_mode = alc883_4ST_8ch_modes, |
| 9531 | .need_dac_fix = 1, |
| 9532 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9533 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9534 | .setup = alc882_targa_setup, |
| 9535 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9536 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9537 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9538 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9539 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9540 | * and the headphone jack. Turn this on and rely on the |
| 9541 | * standard mute methods whenever the user wants to turn |
| 9542 | * these outputs off. |
| 9543 | */ |
| 9544 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9546 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9547 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9548 | .channel_mode = alc883_3ST_2ch_modes, |
| 9549 | .input_mux = &alc883_capture_source, |
| 9550 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9551 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9552 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9553 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9554 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9555 | .dac_nids = alc883_dac_nids, |
| 9556 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9557 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9558 | .channel_mode = alc883_3ST_2ch_modes, |
| 9559 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9560 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9561 | .setup = alc883_acer_aspire_setup, |
| 9562 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9563 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9564 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9565 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9566 | alc883_chmode_mixer }, |
| 9567 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9568 | alc888_acer_aspire_4930g_verbs }, |
| 9569 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9570 | .dac_nids = alc883_dac_nids, |
| 9571 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9572 | .adc_nids = alc883_adc_nids_rev, |
| 9573 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9574 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9575 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9576 | .channel_mode = alc883_3ST_6ch_modes, |
| 9577 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9578 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9579 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9580 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9581 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9582 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9583 | .setup = alc888_acer_aspire_4930g_setup, |
| 9584 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9585 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9586 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9587 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9588 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9589 | alc888_acer_aspire_6530g_verbs }, |
| 9590 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9591 | .dac_nids = alc883_dac_nids, |
| 9592 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9593 | .adc_nids = alc883_adc_nids_rev, |
| 9594 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9595 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9596 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9597 | .channel_mode = alc883_3ST_2ch_modes, |
| 9598 | .num_mux_defs = |
| 9599 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9600 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9601 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9602 | .setup = alc888_acer_aspire_6530g_setup, |
| 9603 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9604 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9605 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9606 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9607 | alc883_chmode_mixer }, |
| 9608 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9609 | alc889_acer_aspire_8930g_verbs, |
| 9610 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9611 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9612 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9613 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9614 | .adc_nids = alc889_adc_nids, |
| 9615 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9616 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9617 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9618 | .channel_mode = alc883_3ST_6ch_modes, |
| 9619 | .need_dac_fix = 1, |
| 9620 | .const_channel_count = 6, |
| 9621 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9622 | ARRAY_SIZE(alc889_capture_sources), |
| 9623 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9624 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9625 | .setup = alc889_acer_aspire_8930g_setup, |
| 9626 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9627 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 9628 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9629 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9630 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9631 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9632 | .mixers = { alc883_3ST_6ch_mixer, |
| 9633 | alc883_chmode_mixer }, |
| 9634 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9635 | alc888_acer_aspire_7730G_verbs }, |
| 9636 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9637 | .dac_nids = alc883_dac_nids, |
| 9638 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9639 | .adc_nids = alc883_adc_nids_rev, |
| 9640 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9641 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9642 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9643 | .channel_mode = alc883_3ST_6ch_modes, |
| 9644 | .need_dac_fix = 1, |
| 9645 | .const_channel_count = 6, |
| 9646 | .input_mux = &alc883_capture_source, |
| 9647 | .unsol_event = alc_automute_amp_unsol_event, |
| 9648 | .setup = alc888_acer_aspire_6530g_setup, |
| 9649 | .init_hook = alc_automute_amp, |
| 9650 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9651 | [ALC883_MEDION] = { |
| 9652 | .mixers = { alc883_fivestack_mixer, |
| 9653 | alc883_chmode_mixer }, |
| 9654 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9655 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9656 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9657 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9658 | .adc_nids = alc883_adc_nids_alt, |
| 9659 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9660 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9661 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9662 | .channel_mode = alc883_sixstack_modes, |
| 9663 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9664 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9665 | [ALC883_MEDION_MD2] = { |
| 9666 | .mixers = { alc883_medion_md2_mixer}, |
| 9667 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9668 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9669 | .dac_nids = alc883_dac_nids, |
| 9670 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9671 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9672 | .channel_mode = alc883_3ST_2ch_modes, |
| 9673 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9674 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9675 | .setup = alc883_medion_md2_setup, |
| 9676 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9677 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9678 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9679 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9680 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9682 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9684 | .channel_mode = alc883_3ST_2ch_modes, |
| 9685 | .input_mux = &alc883_capture_source, |
| 9686 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9687 | [ALC883_CLEVO_M540R] = { |
| 9688 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9689 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9690 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9691 | .dac_nids = alc883_dac_nids, |
| 9692 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9693 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9694 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9695 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9696 | .need_dac_fix = 1, |
| 9697 | .input_mux = &alc883_capture_source, |
| 9698 | /* This machine has the hardware HP auto-muting, thus |
| 9699 | * we need no software mute via unsol event |
| 9700 | */ |
| 9701 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9702 | [ALC883_CLEVO_M720] = { |
| 9703 | .mixers = { alc883_clevo_m720_mixer }, |
| 9704 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9705 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9706 | .dac_nids = alc883_dac_nids, |
| 9707 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9708 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9709 | .channel_mode = alc883_3ST_2ch_modes, |
| 9710 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9711 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9712 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9713 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9714 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9715 | [ALC883_LENOVO_101E_2ch] = { |
| 9716 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9717 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9718 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9719 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9720 | .adc_nids = alc883_adc_nids_alt, |
| 9721 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9722 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9723 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9724 | .channel_mode = alc883_3ST_2ch_modes, |
| 9725 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9726 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9727 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9728 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9729 | [ALC883_LENOVO_NB0763] = { |
| 9730 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9731 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9732 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9733 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9734 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9735 | .channel_mode = alc883_3ST_2ch_modes, |
| 9736 | .need_dac_fix = 1, |
| 9737 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9738 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9739 | .setup = alc883_medion_md2_setup, |
| 9740 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9741 | }, |
| 9742 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9743 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9744 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9745 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9746 | .dac_nids = alc883_dac_nids, |
| 9747 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9748 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9749 | .channel_mode = alc883_3ST_6ch_modes, |
| 9750 | .need_dac_fix = 1, |
| 9751 | .input_mux = &alc883_capture_source, |
| 9752 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9753 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9754 | }, |
| 9755 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9756 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9757 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9758 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9759 | .dac_nids = alc883_dac_nids, |
| 9760 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9761 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9762 | .channel_mode = alc883_3ST_2ch_modes, |
| 9763 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9764 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9765 | .setup = alc883_haier_w66_setup, |
| 9766 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9767 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9768 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9769 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9770 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9771 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9772 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9773 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9774 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9775 | .need_dac_fix = 1, |
| 9776 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9777 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9778 | .setup = alc888_3st_hp_setup, |
| 9779 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9780 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9781 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9782 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9783 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9784 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9785 | .dac_nids = alc883_dac_nids, |
| 9786 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9787 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9788 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9789 | .channel_mode = alc883_sixstack_modes, |
| 9790 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9791 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9792 | .setup = alc888_6st_dell_setup, |
| 9793 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9794 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9795 | [ALC883_MITAC] = { |
| 9796 | .mixers = { alc883_mitac_mixer }, |
| 9797 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9798 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9799 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9800 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9801 | .channel_mode = alc883_3ST_2ch_modes, |
| 9802 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9803 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9804 | .setup = alc883_mitac_setup, |
| 9805 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9806 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9807 | [ALC883_FUJITSU_PI2515] = { |
| 9808 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9809 | .init_verbs = { alc883_init_verbs, |
| 9810 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9811 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9812 | .dac_nids = alc883_dac_nids, |
| 9813 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9814 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9815 | .channel_mode = alc883_3ST_2ch_modes, |
| 9816 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9817 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9818 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9819 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9820 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9821 | [ALC888_FUJITSU_XA3530] = { |
| 9822 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9823 | .init_verbs = { alc883_init_verbs, |
| 9824 | alc888_fujitsu_xa3530_verbs }, |
| 9825 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9826 | .dac_nids = alc883_dac_nids, |
| 9827 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9828 | .adc_nids = alc883_adc_nids_rev, |
| 9829 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9830 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9831 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9832 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9833 | .num_mux_defs = |
| 9834 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9835 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9836 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9837 | .setup = alc888_fujitsu_xa3530_setup, |
| 9838 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9839 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9840 | [ALC888_LENOVO_SKY] = { |
| 9841 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9842 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9844 | .dac_nids = alc883_dac_nids, |
| 9845 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9846 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9847 | .channel_mode = alc883_sixstack_modes, |
| 9848 | .need_dac_fix = 1, |
| 9849 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9850 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9851 | .setup = alc888_lenovo_sky_setup, |
| 9852 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9853 | }, |
| 9854 | [ALC888_ASUS_M90V] = { |
| 9855 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9856 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9857 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9858 | .dac_nids = alc883_dac_nids, |
| 9859 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9860 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9861 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9862 | .channel_mode = alc883_3ST_6ch_modes, |
| 9863 | .need_dac_fix = 1, |
| 9864 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9865 | .unsol_event = alc_sku_unsol_event, |
| 9866 | .setup = alc883_mode2_setup, |
| 9867 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9868 | }, |
| 9869 | [ALC888_ASUS_EEE1601] = { |
| 9870 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9871 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9872 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9873 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9874 | .dac_nids = alc883_dac_nids, |
| 9875 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9876 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9877 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9878 | .channel_mode = alc883_3ST_2ch_modes, |
| 9879 | .need_dac_fix = 1, |
| 9880 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9881 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9882 | .init_hook = alc883_eee1601_inithook, |
| 9883 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9884 | [ALC1200_ASUS_P5Q] = { |
| 9885 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9886 | .init_verbs = { alc883_init_verbs }, |
| 9887 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9888 | .dac_nids = alc883_dac_nids, |
| 9889 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9890 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9891 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9892 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9893 | .channel_mode = alc883_sixstack_modes, |
| 9894 | .input_mux = &alc883_capture_source, |
| 9895 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9896 | [ALC889A_MB31] = { |
| 9897 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9898 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9899 | alc880_gpio1_init_verbs }, |
| 9900 | .adc_nids = alc883_adc_nids, |
| 9901 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9902 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9903 | .dac_nids = alc883_dac_nids, |
| 9904 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9905 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9906 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9907 | .input_mux = &alc889A_mb31_capture_source, |
| 9908 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9909 | .unsol_event = alc889A_mb31_unsol_event, |
| 9910 | .init_hook = alc889A_mb31_automute, |
| 9911 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9912 | [ALC883_SONY_VAIO_TT] = { |
| 9913 | .mixers = { alc883_vaiott_mixer }, |
| 9914 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9915 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9916 | .dac_nids = alc883_dac_nids, |
| 9917 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9918 | .channel_mode = alc883_3ST_2ch_modes, |
| 9919 | .input_mux = &alc883_capture_source, |
| 9920 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9921 | .setup = alc883_vaiott_setup, |
| 9922 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9923 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9924 | }; |
| 9925 | |
| 9926 | |
| 9927 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9928 | * Pin config fixes |
| 9929 | */ |
| 9930 | enum { |
| 9931 | PINFIX_ABIT_AW9D_MAX |
| 9932 | }; |
| 9933 | |
| 9934 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9935 | { 0x15, 0x01080104 }, /* side */ |
| 9936 | { 0x16, 0x01011012 }, /* rear */ |
| 9937 | { 0x17, 0x01016011 }, /* clfe */ |
| 9938 | { } |
| 9939 | }; |
| 9940 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9941 | static const struct alc_fixup alc882_fixups[] = { |
| 9942 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9943 | .pins = alc882_abit_aw9d_pinfix |
| 9944 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9945 | }; |
| 9946 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 9947 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9948 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9949 | {} |
| 9950 | }; |
| 9951 | |
| 9952 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9953 | * BIOS auto configuration |
| 9954 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9955 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9956 | const struct auto_pin_cfg *cfg) |
| 9957 | { |
| 9958 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9959 | } |
| 9960 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9961 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9962 | hda_nid_t nid, int pin_type, |
| 9963 | int dac_idx) |
| 9964 | { |
| 9965 | /* set as output */ |
| 9966 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9967 | int idx; |
| 9968 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9969 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9970 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9971 | idx = 4; |
| 9972 | else |
| 9973 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9974 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9975 | |
| 9976 | } |
| 9977 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9978 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9979 | { |
| 9980 | struct alc_spec *spec = codec->spec; |
| 9981 | int i; |
| 9982 | |
| 9983 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9984 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9985 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9986 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9987 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9988 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9989 | } |
| 9990 | } |
| 9991 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9992 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9993 | { |
| 9994 | struct alc_spec *spec = codec->spec; |
| 9995 | hda_nid_t pin; |
| 9996 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9997 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9998 | if (pin) /* connect to front */ |
| 9999 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10000 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10001 | pin = spec->autocfg.speaker_pins[0]; |
| 10002 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10003 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10004 | } |
| 10005 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10006 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10007 | { |
| 10008 | struct alc_spec *spec = codec->spec; |
| 10009 | int i; |
| 10010 | |
| 10011 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10012 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10013 | if (!nid) |
| 10014 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10015 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10016 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10017 | snd_hda_codec_write(codec, nid, 0, |
| 10018 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10019 | AMP_OUT_MUTE); |
| 10020 | } |
| 10021 | } |
| 10022 | |
| 10023 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10024 | { |
| 10025 | struct alc_spec *spec = codec->spec; |
| 10026 | int c; |
| 10027 | |
| 10028 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10029 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10030 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10031 | unsigned int mux_idx; |
| 10032 | const struct hda_input_mux *imux; |
| 10033 | int conns, mute, idx, item; |
| 10034 | |
| 10035 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10036 | ARRAY_SIZE(conn_list)); |
| 10037 | if (conns < 0) |
| 10038 | continue; |
| 10039 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10040 | imux = &spec->input_mux[mux_idx]; |
| 10041 | for (idx = 0; idx < conns; idx++) { |
| 10042 | /* if the current connection is the selected one, |
| 10043 | * unmute it as default - otherwise mute it |
| 10044 | */ |
| 10045 | mute = AMP_IN_MUTE(idx); |
| 10046 | for (item = 0; item < imux->num_items; item++) { |
| 10047 | if (imux->items[item].index == idx) { |
| 10048 | if (spec->cur_mux[c] == item) |
| 10049 | mute = AMP_IN_UNMUTE(idx); |
| 10050 | break; |
| 10051 | } |
| 10052 | } |
| 10053 | /* check if we have a selector or mixer |
| 10054 | * we could check for the widget type instead, but |
| 10055 | * just check for Amp-In presence (in case of mixer |
| 10056 | * without amp-in there is something wrong, this |
| 10057 | * function shouldn't be used or capsrc nid is wrong) |
| 10058 | */ |
| 10059 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10060 | snd_hda_codec_write(codec, nid, 0, |
| 10061 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10062 | mute); |
| 10063 | else if (mute != AMP_IN_MUTE(idx)) |
| 10064 | snd_hda_codec_write(codec, nid, 0, |
| 10065 | AC_VERB_SET_CONNECT_SEL, |
| 10066 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10067 | } |
| 10068 | } |
| 10069 | } |
| 10070 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10071 | /* add mic boosts if needed */ |
| 10072 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10073 | { |
| 10074 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10075 | int err; |
| 10076 | hda_nid_t nid; |
| 10077 | |
| 10078 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10079 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10080 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10081 | "Mic Boost", |
| 10082 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10083 | if (err < 0) |
| 10084 | return err; |
| 10085 | } |
| 10086 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10087 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10088 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10089 | "Front Mic Boost", |
| 10090 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10091 | if (err < 0) |
| 10092 | return err; |
| 10093 | } |
| 10094 | return 0; |
| 10095 | } |
| 10096 | |
| 10097 | /* almost identical with ALC880 parser... */ |
| 10098 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10099 | { |
| 10100 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10101 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10102 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10103 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10104 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10105 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10106 | if (err < 0) |
| 10107 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10108 | if (!spec->autocfg.line_outs) |
| 10109 | return 0; /* can't find valid BIOS pin config */ |
| 10110 | |
| 10111 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10112 | if (err < 0) |
| 10113 | return err; |
| 10114 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10115 | if (err < 0) |
| 10116 | return err; |
| 10117 | err = alc880_auto_create_extra_out(spec, |
| 10118 | spec->autocfg.speaker_pins[0], |
| 10119 | "Speaker"); |
| 10120 | if (err < 0) |
| 10121 | return err; |
| 10122 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10123 | "Headphone"); |
| 10124 | if (err < 0) |
| 10125 | return err; |
| 10126 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10127 | if (err < 0) |
| 10128 | return err; |
| 10129 | |
| 10130 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10131 | |
| 10132 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10133 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10134 | hda_nid_t dig_nid; |
| 10135 | err = snd_hda_get_connections(codec, |
| 10136 | spec->autocfg.dig_out_pins[i], |
| 10137 | &dig_nid, 1); |
| 10138 | if (err < 0) |
| 10139 | continue; |
| 10140 | if (!i) |
| 10141 | spec->multiout.dig_out_nid = dig_nid; |
| 10142 | else { |
| 10143 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10144 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10145 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10146 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10147 | } |
| 10148 | } |
| 10149 | if (spec->autocfg.dig_in_pin) |
| 10150 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10151 | |
| 10152 | if (spec->kctls.list) |
| 10153 | add_mixer(spec, spec->kctls.list); |
| 10154 | |
| 10155 | add_verb(spec, alc883_auto_init_verbs); |
| 10156 | /* if ADC 0x07 is available, initialize it, too */ |
| 10157 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10158 | add_verb(spec, alc882_adc1_init_verbs); |
| 10159 | |
| 10160 | spec->num_mux_defs = 1; |
| 10161 | spec->input_mux = &spec->private_imux[0]; |
| 10162 | |
| 10163 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10164 | |
| 10165 | err = alc_auto_add_mic_boost(codec); |
| 10166 | if (err < 0) |
| 10167 | return err; |
| 10168 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10169 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10170 | } |
| 10171 | |
| 10172 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10173 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10174 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10175 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10176 | alc882_auto_init_multi_out(codec); |
| 10177 | alc882_auto_init_hp_out(codec); |
| 10178 | alc882_auto_init_analog_input(codec); |
| 10179 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10180 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10181 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10182 | } |
| 10183 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10184 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10185 | { |
| 10186 | struct alc_spec *spec; |
| 10187 | int err, board_config; |
| 10188 | |
| 10189 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10190 | if (spec == NULL) |
| 10191 | return -ENOMEM; |
| 10192 | |
| 10193 | codec->spec = spec; |
| 10194 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10195 | switch (codec->vendor_id) { |
| 10196 | case 0x10ec0882: |
| 10197 | case 0x10ec0885: |
| 10198 | break; |
| 10199 | default: |
| 10200 | /* ALC883 and variants */ |
| 10201 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10202 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10203 | } |
| 10204 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10205 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10206 | alc882_models, |
| 10207 | alc882_cfg_tbl); |
| 10208 | |
| 10209 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10210 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10211 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10212 | |
| 10213 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10214 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10215 | codec->chip_name); |
| 10216 | board_config = ALC882_AUTO; |
| 10217 | } |
| 10218 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10219 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10220 | |
| 10221 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10222 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10223 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10224 | if (err < 0) { |
| 10225 | alc_free(codec); |
| 10226 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10227 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10228 | printk(KERN_INFO |
| 10229 | "hda_codec: Cannot set up configuration " |
| 10230 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10231 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10232 | } |
| 10233 | } |
| 10234 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10235 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10236 | if (err < 0) { |
| 10237 | alc_free(codec); |
| 10238 | return err; |
| 10239 | } |
| 10240 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10241 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10242 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10243 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10244 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10245 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10246 | /* FIXME: setup DAC5 */ |
| 10247 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10248 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10249 | |
| 10250 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10251 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10252 | |
| 10253 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10254 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10255 | |
| 10256 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10257 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10258 | spec->num_adc_nids = 0; |
| 10259 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10260 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10261 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10262 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10263 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10264 | unsigned int wcap = get_wcaps(codec, nid); |
| 10265 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10266 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10267 | if (wcap != AC_WID_AUD_IN) |
| 10268 | continue; |
| 10269 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10270 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10271 | if (err < 0) |
| 10272 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10273 | err = snd_hda_get_connections(codec, cap, items, |
| 10274 | ARRAY_SIZE(items)); |
| 10275 | if (err < 0) |
| 10276 | continue; |
| 10277 | for (j = 0; j < imux->num_items; j++) |
| 10278 | if (imux->items[j].index >= err) |
| 10279 | break; |
| 10280 | if (j < imux->num_items) |
| 10281 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10282 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10283 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10284 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10285 | spec->adc_nids = spec->private_adc_nids; |
| 10286 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10287 | } |
| 10288 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10289 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 10290 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10291 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10292 | spec->vmaster_nid = 0x0c; |
| 10293 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10294 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10295 | if (board_config == ALC882_AUTO) |
| 10296 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10297 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10298 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10299 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10300 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10301 | |
| 10302 | return 0; |
| 10303 | } |
| 10304 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10305 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10306 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10307 | * ALC262 support |
| 10308 | */ |
| 10309 | |
| 10310 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10311 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10312 | |
| 10313 | #define alc262_dac_nids alc260_dac_nids |
| 10314 | #define alc262_adc_nids alc882_adc_nids |
| 10315 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10316 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10317 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10318 | |
| 10319 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10320 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10321 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10322 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10323 | /* ADC0 */ |
| 10324 | 0x09 |
| 10325 | }; |
| 10326 | |
| 10327 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10328 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10329 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10330 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10331 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10332 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10333 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10334 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10335 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10336 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10338 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10339 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10340 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10341 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10342 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10343 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10344 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10345 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10346 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10347 | }; |
| 10348 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10349 | /* update HP, line and mono-out pins according to the master switch */ |
| 10350 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10351 | { |
| 10352 | struct alc_spec *spec = codec->spec; |
| 10353 | int val = spec->master_sw; |
| 10354 | |
| 10355 | /* HP & line-out */ |
| 10356 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10357 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10358 | val ? PIN_HP : 0); |
| 10359 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10360 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10361 | val ? PIN_HP : 0); |
| 10362 | /* mono (speaker) depending on the HP jack sense */ |
| 10363 | val = val && !spec->jack_present; |
| 10364 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10365 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10366 | val ? PIN_OUT : 0); |
| 10367 | } |
| 10368 | |
| 10369 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10370 | { |
| 10371 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10372 | |
| 10373 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10374 | alc262_hp_master_update(codec); |
| 10375 | } |
| 10376 | |
| 10377 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10378 | { |
| 10379 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10380 | return; |
| 10381 | alc262_hp_bpc_automute(codec); |
| 10382 | } |
| 10383 | |
| 10384 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10385 | { |
| 10386 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10387 | |
| 10388 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10389 | alc262_hp_master_update(codec); |
| 10390 | } |
| 10391 | |
| 10392 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10393 | unsigned int res) |
| 10394 | { |
| 10395 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10396 | return; |
| 10397 | alc262_hp_wildwest_automute(codec); |
| 10398 | } |
| 10399 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10400 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10401 | |
| 10402 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10403 | struct snd_ctl_elem_value *ucontrol) |
| 10404 | { |
| 10405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10406 | struct alc_spec *spec = codec->spec; |
| 10407 | int val = !!*ucontrol->value.integer.value; |
| 10408 | |
| 10409 | if (val == spec->master_sw) |
| 10410 | return 0; |
| 10411 | spec->master_sw = val; |
| 10412 | alc262_hp_master_update(codec); |
| 10413 | return 1; |
| 10414 | } |
| 10415 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10416 | #define ALC262_HP_MASTER_SWITCH \ |
| 10417 | { \ |
| 10418 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10419 | .name = "Master Playback Switch", \ |
| 10420 | .info = snd_ctl_boolean_mono_info, \ |
| 10421 | .get = alc262_hp_master_sw_get, \ |
| 10422 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10423 | }, \ |
| 10424 | { \ |
| 10425 | .iface = NID_MAPPING, \ |
| 10426 | .name = "Master Playback Switch", \ |
| 10427 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10428 | } |
| 10429 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10431 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10432 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10433 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10434 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10435 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10436 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10437 | HDA_OUTPUT), |
| 10438 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10439 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10440 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10441 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10442 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10443 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10444 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10445 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10446 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10447 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10449 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10450 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10451 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10452 | { } /* end */ |
| 10453 | }; |
| 10454 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10455 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10456 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10457 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10458 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10459 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10460 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10461 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10462 | HDA_OUTPUT), |
| 10463 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10464 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10465 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10466 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10467 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10469 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10472 | { } /* end */ |
| 10473 | }; |
| 10474 | |
| 10475 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10476 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10477 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10478 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10479 | { } /* end */ |
| 10480 | }; |
| 10481 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10482 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10483 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10484 | { |
| 10485 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10486 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10487 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10488 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10489 | } |
| 10490 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10491 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10492 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10493 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10494 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10497 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10498 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10499 | { } /* end */ |
| 10500 | }; |
| 10501 | |
| 10502 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10503 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10504 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10505 | |
| 10506 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10507 | { } |
| 10508 | }; |
| 10509 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10510 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10511 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10512 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10513 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10514 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10515 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10516 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10517 | { } /* end */ |
| 10518 | }; |
| 10519 | |
| 10520 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10521 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10522 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10523 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10524 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10525 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10526 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10527 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10529 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10530 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10531 | {} |
| 10532 | }; |
| 10533 | |
| 10534 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10535 | .num_items = 1, |
| 10536 | .items = { |
| 10537 | { "Line", 0x1 }, |
| 10538 | }, |
| 10539 | }; |
| 10540 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10541 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10542 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10543 | { |
| 10544 | struct alc_spec *spec = codec->spec; |
| 10545 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10546 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10547 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10548 | unsigned int mute; |
| 10549 | |
| 10550 | /* HP */ |
| 10551 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10552 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10553 | HDA_AMP_MUTE, mute); |
| 10554 | /* mute internal speaker per jack sense */ |
| 10555 | if (spec->jack_present) |
| 10556 | mute = HDA_AMP_MUTE; |
| 10557 | if (line_nid) |
| 10558 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10559 | HDA_AMP_MUTE, mute); |
| 10560 | if (speaker_nid && speaker_nid != line_nid) |
| 10561 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10562 | HDA_AMP_MUTE, mute); |
| 10563 | } |
| 10564 | |
| 10565 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10566 | |
| 10567 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10568 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10569 | { |
| 10570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10571 | struct alc_spec *spec = codec->spec; |
| 10572 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10573 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10574 | if (val == spec->master_sw) |
| 10575 | return 0; |
| 10576 | spec->master_sw = val; |
| 10577 | alc262_hippo_master_update(codec); |
| 10578 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10579 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10580 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10581 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10582 | { \ |
| 10583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10584 | .name = "Master Playback Switch", \ |
| 10585 | .info = snd_ctl_boolean_mono_info, \ |
| 10586 | .get = alc262_hippo_master_sw_get, \ |
| 10587 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10588 | }, \ |
| 10589 | { \ |
| 10590 | .iface = NID_MAPPING, \ |
| 10591 | .name = "Master Playback Switch", \ |
| 10592 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 10593 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10594 | } |
| 10595 | |
| 10596 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10597 | ALC262_HIPPO_MASTER_SWITCH, |
| 10598 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10599 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10600 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10601 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10602 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10603 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10604 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10605 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10606 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10607 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10608 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10609 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10610 | { } /* end */ |
| 10611 | }; |
| 10612 | |
| 10613 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10614 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10615 | ALC262_HIPPO_MASTER_SWITCH, |
| 10616 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10617 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10618 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10619 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10620 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10621 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10622 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10625 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10626 | { } /* end */ |
| 10627 | }; |
| 10628 | |
| 10629 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10630 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10631 | { |
| 10632 | struct alc_spec *spec = codec->spec; |
| 10633 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10634 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10635 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10636 | alc262_hippo_master_update(codec); |
| 10637 | } |
| 10638 | |
| 10639 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10640 | { |
| 10641 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10642 | return; |
| 10643 | alc262_hippo_automute(codec); |
| 10644 | } |
| 10645 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10646 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10647 | { |
| 10648 | struct alc_spec *spec = codec->spec; |
| 10649 | |
| 10650 | spec->autocfg.hp_pins[0] = 0x15; |
| 10651 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10652 | } |
| 10653 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10654 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10655 | { |
| 10656 | struct alc_spec *spec = codec->spec; |
| 10657 | |
| 10658 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10659 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10660 | } |
| 10661 | |
| 10662 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10663 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10664 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10665 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10666 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10668 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10669 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10670 | { } /* end */ |
| 10671 | }; |
| 10672 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10673 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10674 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10675 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10676 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10679 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10680 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10681 | { } /* end */ |
| 10682 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10683 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10684 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10685 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10686 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10687 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10688 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10693 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10694 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10695 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10696 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10697 | { } /* end */ |
| 10698 | }; |
| 10699 | |
| 10700 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10701 | /* Headphone automute */ |
| 10702 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10703 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10704 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10705 | |
| 10706 | /* P11 AUX_IN, white 4-pin connector */ |
| 10707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10708 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10709 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10710 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10711 | |
| 10712 | {} |
| 10713 | }; |
| 10714 | |
| 10715 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10716 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10717 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10718 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10719 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10720 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10721 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10722 | } |
| 10723 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10725 | #define alc262_capture_mixer alc882_capture_mixer |
| 10726 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10727 | |
| 10728 | /* |
| 10729 | * generic initialization of ADC, input mixers and output mixers |
| 10730 | */ |
| 10731 | static struct hda_verb alc262_init_verbs[] = { |
| 10732 | /* |
| 10733 | * Unmute ADC0-2 and set the default input to mic-in |
| 10734 | */ |
| 10735 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10737 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10738 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10739 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10740 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10741 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10742 | /* 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] | 10743 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10744 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10745 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10746 | */ |
| 10747 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10749 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10750 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10751 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10752 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10753 | |
| 10754 | /* |
| 10755 | * Set up output mixers (0x0c - 0x0e) |
| 10756 | */ |
| 10757 | /* set vol=0 to output mixers */ |
| 10758 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10761 | /* set up input amps for analog loopback */ |
| 10762 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10763 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10766 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10767 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10768 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10769 | |
| 10770 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10771 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10772 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10773 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10774 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10775 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10776 | |
| 10777 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10778 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10782 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10783 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10785 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10786 | /* FIXME: use matrix-type input source selection */ |
| 10787 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10788 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10792 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10793 | /* Input mixer2 */ |
| 10794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10797 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10798 | /* Input mixer3 */ |
| 10799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10802 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10803 | |
| 10804 | { } |
| 10805 | }; |
| 10806 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10807 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10808 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10809 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10810 | { } |
| 10811 | }; |
| 10812 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10813 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10814 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10815 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10816 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10817 | |
| 10818 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10819 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10820 | {} |
| 10821 | }; |
| 10822 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10823 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10824 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10825 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10826 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10827 | |
| 10828 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10829 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10830 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10831 | }; |
| 10832 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10833 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10834 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10835 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10839 | { } /* end */ |
| 10840 | }; |
| 10841 | |
| 10842 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10843 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10845 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10846 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10847 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10848 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10849 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10850 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10851 | {} |
| 10852 | }; |
| 10853 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10854 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10855 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10856 | struct alc_spec *spec = codec->spec; |
| 10857 | |
| 10858 | spec->autocfg.hp_pins[0] = 0x15; |
| 10859 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10860 | spec->ext_mic.pin = 0x18; |
| 10861 | spec->ext_mic.mux_idx = 0; |
| 10862 | spec->int_mic.pin = 0x12; |
| 10863 | spec->int_mic.mux_idx = 9; |
| 10864 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10865 | } |
| 10866 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10867 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10868 | * nec model |
| 10869 | * 0x15 = headphone |
| 10870 | * 0x16 = internal speaker |
| 10871 | * 0x18 = external mic |
| 10872 | */ |
| 10873 | |
| 10874 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10875 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10876 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10877 | |
| 10878 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10879 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10880 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10881 | |
| 10882 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10884 | { } /* end */ |
| 10885 | }; |
| 10886 | |
| 10887 | static struct hda_verb alc262_nec_verbs[] = { |
| 10888 | /* Unmute Speaker */ |
| 10889 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10890 | |
| 10891 | /* Headphone */ |
| 10892 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10893 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10894 | |
| 10895 | /* External mic to headphone */ |
| 10896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10897 | /* External mic to speaker */ |
| 10898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10899 | {} |
| 10900 | }; |
| 10901 | |
| 10902 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10903 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10904 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10905 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10906 | */ |
| 10907 | |
| 10908 | #define ALC_HP_EVENT 0x37 |
| 10909 | |
| 10910 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10911 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10912 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10913 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10914 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10915 | {} |
| 10916 | }; |
| 10917 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10918 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10919 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10920 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10921 | {} |
| 10922 | }; |
| 10923 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 10924 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 10925 | /* Front Mic pin: input vref at 50% */ |
| 10926 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 10927 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10928 | {} |
| 10929 | }; |
| 10930 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10931 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10932 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10933 | .items = { |
| 10934 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10935 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10936 | { "CD", 0x4 }, |
| 10937 | }, |
| 10938 | }; |
| 10939 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10940 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10941 | .num_items = 5, |
| 10942 | .items = { |
| 10943 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10944 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10945 | { "Line", 0x2 }, |
| 10946 | { "CD", 0x4 }, |
| 10947 | { "AUX IN", 0x6 }, |
| 10948 | }, |
| 10949 | }; |
| 10950 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10951 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10952 | .num_items = 4, |
| 10953 | .items = { |
| 10954 | { "Mic", 0x0 }, |
| 10955 | { "Front Mic", 0x2 }, |
| 10956 | { "Line", 0x1 }, |
| 10957 | { "CD", 0x4 }, |
| 10958 | }, |
| 10959 | }; |
| 10960 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10961 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10962 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10963 | { |
| 10964 | struct alc_spec *spec = codec->spec; |
| 10965 | unsigned int mute; |
| 10966 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10967 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10968 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 10969 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10970 | spec->sense_updated = 1; |
| 10971 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10972 | /* unmute internal speaker only if both HPs are unplugged and |
| 10973 | * master switch is on |
| 10974 | */ |
| 10975 | if (spec->jack_present) |
| 10976 | mute = HDA_AMP_MUTE; |
| 10977 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10978 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10979 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10980 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10981 | } |
| 10982 | |
| 10983 | /* unsolicited event for HP jack sensing */ |
| 10984 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10985 | unsigned int res) |
| 10986 | { |
| 10987 | if ((res >> 26) != ALC_HP_EVENT) |
| 10988 | return; |
| 10989 | alc262_fujitsu_automute(codec, 1); |
| 10990 | } |
| 10991 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10992 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10993 | { |
| 10994 | alc262_fujitsu_automute(codec, 1); |
| 10995 | } |
| 10996 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10997 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10998 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10999 | .ops = &snd_hda_bind_vol, |
| 11000 | .values = { |
| 11001 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11002 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11003 | 0 |
| 11004 | }, |
| 11005 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11006 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11007 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11008 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11009 | { |
| 11010 | struct alc_spec *spec = codec->spec; |
| 11011 | unsigned int mute; |
| 11012 | |
| 11013 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11014 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11015 | spec->sense_updated = 1; |
| 11016 | } |
| 11017 | if (spec->jack_present) { |
| 11018 | /* mute internal speaker */ |
| 11019 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11020 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11021 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11022 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11023 | } else { |
| 11024 | /* unmute internal speaker if necessary */ |
| 11025 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11026 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11027 | HDA_AMP_MUTE, mute); |
| 11028 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11029 | HDA_AMP_MUTE, mute); |
| 11030 | } |
| 11031 | } |
| 11032 | |
| 11033 | /* unsolicited event for HP jack sensing */ |
| 11034 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11035 | unsigned int res) |
| 11036 | { |
| 11037 | if ((res >> 26) != ALC_HP_EVENT) |
| 11038 | return; |
| 11039 | alc262_lenovo_3000_automute(codec, 1); |
| 11040 | } |
| 11041 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11042 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11043 | int dir, int idx, long *valp) |
| 11044 | { |
| 11045 | int i, change = 0; |
| 11046 | |
| 11047 | for (i = 0; i < 2; i++, valp++) |
| 11048 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11049 | HDA_AMP_MUTE, |
| 11050 | *valp ? 0 : HDA_AMP_MUTE); |
| 11051 | return change; |
| 11052 | } |
| 11053 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11054 | /* bind hp and internal speaker mute (with plug check) */ |
| 11055 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11056 | struct snd_ctl_elem_value *ucontrol) |
| 11057 | { |
| 11058 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11059 | long *valp = ucontrol->value.integer.value; |
| 11060 | int change; |
| 11061 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11062 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11063 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11064 | if (change) |
| 11065 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11066 | return change; |
| 11067 | } |
| 11068 | |
| 11069 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11070 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11071 | { |
| 11072 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11073 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11074 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11075 | .info = snd_hda_mixer_amp_switch_info, |
| 11076 | .get = snd_hda_mixer_amp_switch_get, |
| 11077 | .put = alc262_fujitsu_master_sw_put, |
| 11078 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11079 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11080 | { |
| 11081 | .iface = NID_MAPPING, |
| 11082 | .name = "Master Playback Switch", |
| 11083 | .private_value = 0x1b, |
| 11084 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11085 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11086 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11087 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11088 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11090 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11091 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11092 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11093 | { } /* end */ |
| 11094 | }; |
| 11095 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11096 | /* bind hp and internal speaker mute (with plug check) */ |
| 11097 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11098 | struct snd_ctl_elem_value *ucontrol) |
| 11099 | { |
| 11100 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11101 | long *valp = ucontrol->value.integer.value; |
| 11102 | int change; |
| 11103 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11104 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11105 | if (change) |
| 11106 | alc262_lenovo_3000_automute(codec, 0); |
| 11107 | return change; |
| 11108 | } |
| 11109 | |
| 11110 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11111 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11112 | { |
| 11113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11114 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11115 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11116 | .info = snd_hda_mixer_amp_switch_info, |
| 11117 | .get = snd_hda_mixer_amp_switch_get, |
| 11118 | .put = alc262_lenovo_3000_master_sw_put, |
| 11119 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11120 | }, |
| 11121 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11122 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11123 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11124 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11125 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11126 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11127 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11128 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11129 | { } /* end */ |
| 11130 | }; |
| 11131 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11132 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11133 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11134 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11137 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11138 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11139 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11140 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11141 | { } /* end */ |
| 11142 | }; |
| 11143 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11144 | /* additional init verbs for Benq laptops */ |
| 11145 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11146 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11147 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11148 | {} |
| 11149 | }; |
| 11150 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11151 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11152 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11153 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11154 | |
| 11155 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11156 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11157 | {} |
| 11158 | }; |
| 11159 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11160 | /* Samsung Q1 Ultra Vista model setup */ |
| 11161 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11162 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11163 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11164 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11165 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11166 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11167 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11168 | { } /* end */ |
| 11169 | }; |
| 11170 | |
| 11171 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11172 | /* output mixer */ |
| 11173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11174 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11175 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11176 | /* speaker */ |
| 11177 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11178 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11179 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11180 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11181 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11182 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11183 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11184 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11185 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11186 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11187 | /* internal mic */ |
| 11188 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11189 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11190 | /* ADC, choose mic */ |
| 11191 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11200 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11201 | {} |
| 11202 | }; |
| 11203 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11204 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11205 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11206 | { |
| 11207 | struct alc_spec *spec = codec->spec; |
| 11208 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11209 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11210 | mute = 0; |
| 11211 | /* auto-mute only when HP is used as HP */ |
| 11212 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11213 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11214 | if (spec->jack_present) |
| 11215 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11216 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11217 | /* mute/unmute internal speaker */ |
| 11218 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11219 | HDA_AMP_MUTE, mute); |
| 11220 | /* mute/unmute HP */ |
| 11221 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11222 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11223 | } |
| 11224 | |
| 11225 | /* unsolicited event for HP jack sensing */ |
| 11226 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11227 | unsigned int res) |
| 11228 | { |
| 11229 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11230 | return; |
| 11231 | alc262_ultra_automute(codec); |
| 11232 | } |
| 11233 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11234 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11235 | .num_items = 2, |
| 11236 | .items = { |
| 11237 | { "Mic", 0x1 }, |
| 11238 | { "Headphone", 0x7 }, |
| 11239 | }, |
| 11240 | }; |
| 11241 | |
| 11242 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11243 | struct snd_ctl_elem_value *ucontrol) |
| 11244 | { |
| 11245 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11246 | struct alc_spec *spec = codec->spec; |
| 11247 | int ret; |
| 11248 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11249 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11250 | if (!ret) |
| 11251 | return 0; |
| 11252 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11253 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11254 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11255 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11256 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11257 | return ret; |
| 11258 | } |
| 11259 | |
| 11260 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11261 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11262 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11263 | { |
| 11264 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11265 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11266 | .info = alc_mux_enum_info, |
| 11267 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11268 | .put = alc262_ultra_mux_enum_put, |
| 11269 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11270 | { |
| 11271 | .iface = NID_MAPPING, |
| 11272 | .name = "Capture Source", |
| 11273 | .private_value = 0x15, |
| 11274 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11275 | { } /* end */ |
| 11276 | }; |
| 11277 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11278 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11279 | * and thus it's bound with a different mixer. |
| 11280 | * This function returns which mixer amp should be used. |
| 11281 | */ |
| 11282 | static int alc262_check_volbit(hda_nid_t nid) |
| 11283 | { |
| 11284 | if (!nid) |
| 11285 | return 0; |
| 11286 | else if (nid == 0x16) |
| 11287 | return 2; |
| 11288 | else |
| 11289 | return 1; |
| 11290 | } |
| 11291 | |
| 11292 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11293 | const char *pfx, int *vbits) |
| 11294 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11295 | unsigned long val; |
| 11296 | int vbit; |
| 11297 | |
| 11298 | vbit = alc262_check_volbit(nid); |
| 11299 | if (!vbit) |
| 11300 | return 0; |
| 11301 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11302 | return 0; |
| 11303 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11304 | if (vbit == 2) |
| 11305 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11306 | else |
| 11307 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11308 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11309 | } |
| 11310 | |
| 11311 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11312 | const char *pfx) |
| 11313 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11314 | unsigned long val; |
| 11315 | |
| 11316 | if (!nid) |
| 11317 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11318 | if (nid == 0x16) |
| 11319 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11320 | else |
| 11321 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11322 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11323 | } |
| 11324 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11325 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11326 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11327 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11328 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11329 | const char *pfx; |
| 11330 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11331 | int err; |
| 11332 | |
| 11333 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11334 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11335 | spec->multiout.dac_nids[0] = 2; |
| 11336 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11337 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11338 | pfx = "Master"; |
| 11339 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11340 | pfx = "Speaker"; |
| 11341 | else |
| 11342 | pfx = "Front"; |
| 11343 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11344 | if (err < 0) |
| 11345 | return err; |
| 11346 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11347 | if (err < 0) |
| 11348 | return err; |
| 11349 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11350 | if (err < 0) |
| 11351 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11352 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11353 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11354 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11355 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11356 | if (vbits == 1 || vbits == 2) |
| 11357 | pfx = "Master"; /* only one mixer is used */ |
| 11358 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11359 | pfx = "Speaker"; |
| 11360 | else |
| 11361 | pfx = "Front"; |
| 11362 | vbits = 0; |
| 11363 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11364 | if (err < 0) |
| 11365 | return err; |
| 11366 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11367 | &vbits); |
| 11368 | if (err < 0) |
| 11369 | return err; |
| 11370 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11371 | &vbits); |
| 11372 | if (err < 0) |
| 11373 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11374 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11375 | } |
| 11376 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11377 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11378 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11379 | |
| 11380 | /* |
| 11381 | * generic initialization of ADC, input mixers and output mixers |
| 11382 | */ |
| 11383 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11384 | /* |
| 11385 | * Unmute ADC0-2 and set the default input to mic-in |
| 11386 | */ |
| 11387 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11388 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11389 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11391 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11393 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11394 | /* 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] | 11395 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11396 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11397 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11398 | */ |
| 11399 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11400 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11401 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11402 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11403 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11404 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11405 | |
| 11406 | /* |
| 11407 | * Set up output mixers (0x0c - 0x0f) |
| 11408 | */ |
| 11409 | /* set vol=0 to output mixers */ |
| 11410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11411 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11412 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11413 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11414 | /* set up input amps for analog loopback */ |
| 11415 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11416 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11418 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11419 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11420 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11421 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11422 | |
| 11423 | /* FIXME: use matrix-type input source selection */ |
| 11424 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11425 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11426 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11428 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11429 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11430 | /* Input mixer2 */ |
| 11431 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11432 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11433 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11434 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11435 | /* Input mixer3 */ |
| 11436 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11437 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11438 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11439 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11440 | |
| 11441 | { } |
| 11442 | }; |
| 11443 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11444 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11445 | /* |
| 11446 | * Unmute ADC0-2 and set the default input to mic-in |
| 11447 | */ |
| 11448 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11449 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11450 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11451 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11452 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11453 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11454 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11455 | /* 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] | 11456 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11457 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11458 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11459 | */ |
| 11460 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11461 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11462 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11463 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11464 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11465 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11466 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11467 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11468 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11469 | /* |
| 11470 | * Set up output mixers (0x0c - 0x0e) |
| 11471 | */ |
| 11472 | /* set vol=0 to output mixers */ |
| 11473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11474 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11475 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11476 | |
| 11477 | /* set up input amps for analog loopback */ |
| 11478 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11479 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11481 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11482 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11483 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11484 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11485 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11488 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11489 | |
| 11490 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11491 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11492 | |
| 11493 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11494 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11495 | |
| 11496 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11497 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11498 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11499 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11500 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11501 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11504 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11505 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11506 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11507 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11508 | |
| 11509 | |
| 11510 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11511 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11512 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11513 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11514 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11515 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11516 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11517 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11518 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11519 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11521 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11522 | /* Input mixer2 */ |
| 11523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11524 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11525 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11526 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11527 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11528 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11529 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11530 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11532 | /* Input mixer3 */ |
| 11533 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11534 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11535 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11539 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11541 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11542 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11543 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11544 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11545 | { } |
| 11546 | }; |
| 11547 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11548 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11549 | /* |
| 11550 | * Unmute ADC0-2 and set the default input to mic-in |
| 11551 | */ |
| 11552 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11554 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11555 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11556 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11557 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11558 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11559 | /* 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] | 11560 | * mixer widget |
| 11561 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11562 | * panel mic (mic 2) |
| 11563 | */ |
| 11564 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11573 | /* |
| 11574 | * Set up output mixers (0x0c - 0x0e) |
| 11575 | */ |
| 11576 | /* set vol=0 to output mixers */ |
| 11577 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11578 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11579 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11580 | |
| 11581 | /* set up input amps for analog loopback */ |
| 11582 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11587 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11588 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11589 | |
| 11590 | |
| 11591 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11592 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11594 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11595 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11596 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11597 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11598 | |
| 11599 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11600 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11601 | |
| 11602 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11603 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11604 | |
| 11605 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11606 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11607 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11608 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11609 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11610 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11611 | |
| 11612 | /* FIXME: use matrix-type input source selection */ |
| 11613 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11614 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11615 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11616 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11617 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11618 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11619 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11620 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11621 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11622 | /* Input mixer2 */ |
| 11623 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11626 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11627 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11628 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11629 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11630 | /* Input mixer3 */ |
| 11631 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11632 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11633 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11634 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11635 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11636 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11637 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11638 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11639 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11640 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11641 | { } |
| 11642 | }; |
| 11643 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11644 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11645 | |
| 11646 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11647 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11648 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11649 | |
| 11650 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11651 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11652 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11654 | |
| 11655 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11656 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11657 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11658 | {} |
| 11659 | }; |
| 11660 | |
| 11661 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11662 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11663 | #define alc262_loopbacks alc880_loopbacks |
| 11664 | #endif |
| 11665 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11666 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11667 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11668 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11669 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11670 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11671 | |
| 11672 | /* |
| 11673 | * BIOS auto configuration |
| 11674 | */ |
| 11675 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11676 | { |
| 11677 | struct alc_spec *spec = codec->spec; |
| 11678 | int err; |
| 11679 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11680 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11681 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11682 | alc262_ignore); |
| 11683 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11684 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11685 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11686 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11687 | spec->multiout.max_channels = 2; |
| 11688 | spec->no_analog = 1; |
| 11689 | goto dig_only; |
| 11690 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11691 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11692 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11693 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11694 | if (err < 0) |
| 11695 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11696 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11697 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11698 | return err; |
| 11699 | |
| 11700 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11701 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11702 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11703 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11704 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11705 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11706 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11707 | if (spec->autocfg.dig_in_pin) |
| 11708 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11709 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11710 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11711 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11712 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11713 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11714 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11715 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11716 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11717 | err = alc_auto_add_mic_boost(codec); |
| 11718 | if (err < 0) |
| 11719 | return err; |
| 11720 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11721 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11722 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11723 | return 1; |
| 11724 | } |
| 11725 | |
| 11726 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11727 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11728 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11729 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11730 | |
| 11731 | |
| 11732 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11733 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11734 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11735 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11736 | alc262_auto_init_multi_out(codec); |
| 11737 | alc262_auto_init_hp_out(codec); |
| 11738 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11739 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11740 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11741 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | } |
| 11743 | |
| 11744 | /* |
| 11745 | * configuration and preset |
| 11746 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11747 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11748 | [ALC262_BASIC] = "basic", |
| 11749 | [ALC262_HIPPO] = "hippo", |
| 11750 | [ALC262_HIPPO_1] = "hippo_1", |
| 11751 | [ALC262_FUJITSU] = "fujitsu", |
| 11752 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11753 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11754 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11755 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11756 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11757 | [ALC262_BENQ_T31] = "benq-t31", |
| 11758 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11759 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11760 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11761 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11762 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11763 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11764 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11765 | [ALC262_AUTO] = "auto", |
| 11766 | }; |
| 11767 | |
| 11768 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11769 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11770 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11771 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11772 | ALC262_HP_BPC), |
| 11773 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11774 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11775 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11776 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11777 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11778 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11779 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11780 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11781 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11782 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11783 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11784 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11785 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11786 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11787 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11788 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11789 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11790 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11791 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11792 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11793 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11794 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11795 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 11796 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 11797 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11798 | #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] | 11799 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11800 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 11801 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11802 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11803 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11804 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11805 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11806 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11807 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11808 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11809 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11810 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11811 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11812 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11813 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11814 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11815 | {} |
| 11816 | }; |
| 11817 | |
| 11818 | static struct alc_config_preset alc262_presets[] = { |
| 11819 | [ALC262_BASIC] = { |
| 11820 | .mixers = { alc262_base_mixer }, |
| 11821 | .init_verbs = { alc262_init_verbs }, |
| 11822 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11823 | .dac_nids = alc262_dac_nids, |
| 11824 | .hp_nid = 0x03, |
| 11825 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11826 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11827 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11828 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11829 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11830 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11831 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11832 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11833 | .dac_nids = alc262_dac_nids, |
| 11834 | .hp_nid = 0x03, |
| 11835 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11836 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11837 | .channel_mode = alc262_modes, |
| 11838 | .input_mux = &alc262_capture_source, |
| 11839 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11840 | .setup = alc262_hippo_setup, |
| 11841 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11842 | }, |
| 11843 | [ALC262_HIPPO_1] = { |
| 11844 | .mixers = { alc262_hippo1_mixer }, |
| 11845 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11846 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11847 | .dac_nids = alc262_dac_nids, |
| 11848 | .hp_nid = 0x02, |
| 11849 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11850 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11851 | .channel_mode = alc262_modes, |
| 11852 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11853 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11854 | .setup = alc262_hippo1_setup, |
| 11855 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11856 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11857 | [ALC262_FUJITSU] = { |
| 11858 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11859 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11860 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11861 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11862 | .dac_nids = alc262_dac_nids, |
| 11863 | .hp_nid = 0x03, |
| 11864 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11865 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11866 | .channel_mode = alc262_modes, |
| 11867 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11868 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11869 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11870 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11871 | [ALC262_HP_BPC] = { |
| 11872 | .mixers = { alc262_HP_BPC_mixer }, |
| 11873 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11874 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11875 | .dac_nids = alc262_dac_nids, |
| 11876 | .hp_nid = 0x03, |
| 11877 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11878 | .channel_mode = alc262_modes, |
| 11879 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11880 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11881 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11882 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11883 | [ALC262_HP_BPC_D7000_WF] = { |
| 11884 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11885 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11886 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11887 | .dac_nids = alc262_dac_nids, |
| 11888 | .hp_nid = 0x03, |
| 11889 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11890 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11891 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11892 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11893 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11894 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11895 | [ALC262_HP_BPC_D7000_WL] = { |
| 11896 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11897 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11898 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11899 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11900 | .dac_nids = alc262_dac_nids, |
| 11901 | .hp_nid = 0x03, |
| 11902 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11903 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11904 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11905 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11906 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11907 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11908 | [ALC262_HP_TC_T5735] = { |
| 11909 | .mixers = { alc262_hp_t5735_mixer }, |
| 11910 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11911 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11912 | .dac_nids = alc262_dac_nids, |
| 11913 | .hp_nid = 0x03, |
| 11914 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11915 | .channel_mode = alc262_modes, |
| 11916 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11917 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11918 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 11919 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11920 | }, |
| 11921 | [ALC262_HP_RP5700] = { |
| 11922 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11923 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11924 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11925 | .dac_nids = alc262_dac_nids, |
| 11926 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11927 | .channel_mode = alc262_modes, |
| 11928 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11929 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11930 | [ALC262_BENQ_ED8] = { |
| 11931 | .mixers = { alc262_base_mixer }, |
| 11932 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11933 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11934 | .dac_nids = alc262_dac_nids, |
| 11935 | .hp_nid = 0x03, |
| 11936 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11937 | .channel_mode = alc262_modes, |
| 11938 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11939 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11940 | [ALC262_SONY_ASSAMD] = { |
| 11941 | .mixers = { alc262_sony_mixer }, |
| 11942 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11943 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11944 | .dac_nids = alc262_dac_nids, |
| 11945 | .hp_nid = 0x02, |
| 11946 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11947 | .channel_mode = alc262_modes, |
| 11948 | .input_mux = &alc262_capture_source, |
| 11949 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11950 | .setup = alc262_hippo_setup, |
| 11951 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11952 | }, |
| 11953 | [ALC262_BENQ_T31] = { |
| 11954 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11955 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11956 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11957 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11958 | .dac_nids = alc262_dac_nids, |
| 11959 | .hp_nid = 0x03, |
| 11960 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11961 | .channel_mode = alc262_modes, |
| 11962 | .input_mux = &alc262_capture_source, |
| 11963 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11964 | .setup = alc262_hippo_setup, |
| 11965 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11966 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11967 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11968 | .mixers = { alc262_ultra_mixer }, |
| 11969 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11970 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11971 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11972 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11973 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11974 | .channel_mode = alc262_modes, |
| 11975 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11976 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11977 | .capsrc_nids = alc262_capsrc_nids, |
| 11978 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11979 | .unsol_event = alc262_ultra_unsol_event, |
| 11980 | .init_hook = alc262_ultra_automute, |
| 11981 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11982 | [ALC262_LENOVO_3000] = { |
| 11983 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11984 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11985 | alc262_lenovo_3000_unsol_verbs, |
| 11986 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11987 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11988 | .dac_nids = alc262_dac_nids, |
| 11989 | .hp_nid = 0x03, |
| 11990 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11991 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11992 | .channel_mode = alc262_modes, |
| 11993 | .input_mux = &alc262_fujitsu_capture_source, |
| 11994 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11995 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11996 | [ALC262_NEC] = { |
| 11997 | .mixers = { alc262_nec_mixer }, |
| 11998 | .init_verbs = { alc262_nec_verbs }, |
| 11999 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12000 | .dac_nids = alc262_dac_nids, |
| 12001 | .hp_nid = 0x03, |
| 12002 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12003 | .channel_mode = alc262_modes, |
| 12004 | .input_mux = &alc262_capture_source, |
| 12005 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12006 | [ALC262_TOSHIBA_S06] = { |
| 12007 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12008 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12009 | alc262_eapd_verbs }, |
| 12010 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12011 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12012 | .dac_nids = alc262_dac_nids, |
| 12013 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12014 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12015 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12016 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12017 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12018 | .unsol_event = alc_sku_unsol_event, |
| 12019 | .setup = alc262_toshiba_s06_setup, |
| 12020 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12021 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12022 | [ALC262_TOSHIBA_RX1] = { |
| 12023 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12024 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12025 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12026 | .dac_nids = alc262_dac_nids, |
| 12027 | .hp_nid = 0x03, |
| 12028 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12029 | .channel_mode = alc262_modes, |
| 12030 | .input_mux = &alc262_capture_source, |
| 12031 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12032 | .setup = alc262_hippo_setup, |
| 12033 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12034 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12035 | [ALC262_TYAN] = { |
| 12036 | .mixers = { alc262_tyan_mixer }, |
| 12037 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12038 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12039 | .dac_nids = alc262_dac_nids, |
| 12040 | .hp_nid = 0x02, |
| 12041 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12042 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12043 | .channel_mode = alc262_modes, |
| 12044 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12045 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12046 | .setup = alc262_tyan_setup, |
| 12047 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12048 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12049 | }; |
| 12050 | |
| 12051 | static int patch_alc262(struct hda_codec *codec) |
| 12052 | { |
| 12053 | struct alc_spec *spec; |
| 12054 | int board_config; |
| 12055 | int err; |
| 12056 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12057 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12058 | if (spec == NULL) |
| 12059 | return -ENOMEM; |
| 12060 | |
| 12061 | codec->spec = spec; |
| 12062 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12063 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12064 | * under-run |
| 12065 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12066 | { |
| 12067 | int tmp; |
| 12068 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12069 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12070 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12071 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12072 | } |
| 12073 | #endif |
| 12074 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12075 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12076 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12077 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12078 | alc262_models, |
| 12079 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12080 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12081 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12082 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12083 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12084 | board_config = ALC262_AUTO; |
| 12085 | } |
| 12086 | |
| 12087 | if (board_config == ALC262_AUTO) { |
| 12088 | /* automatic parse from the BIOS config */ |
| 12089 | err = alc262_parse_auto_config(codec); |
| 12090 | if (err < 0) { |
| 12091 | alc_free(codec); |
| 12092 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12093 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12094 | printk(KERN_INFO |
| 12095 | "hda_codec: Cannot set up configuration " |
| 12096 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12097 | board_config = ALC262_BASIC; |
| 12098 | } |
| 12099 | } |
| 12100 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12101 | if (!spec->no_analog) { |
| 12102 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12103 | if (err < 0) { |
| 12104 | alc_free(codec); |
| 12105 | return err; |
| 12106 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12107 | } |
| 12108 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12109 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12110 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12111 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12112 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12113 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12114 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12115 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12116 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12117 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12118 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12119 | int i; |
| 12120 | /* check whether the digital-mic has to be supported */ |
| 12121 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12122 | if (spec->input_mux->items[i].index >= 9) |
| 12123 | break; |
| 12124 | } |
| 12125 | if (i < spec->input_mux->num_items) { |
| 12126 | /* use only ADC0 */ |
| 12127 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12128 | spec->num_adc_nids = 1; |
| 12129 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12130 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12131 | /* all analog inputs */ |
| 12132 | /* check whether NID 0x07 is valid */ |
| 12133 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12134 | |
| 12135 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12136 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12137 | if (wcap != AC_WID_AUD_IN) { |
| 12138 | spec->adc_nids = alc262_adc_nids_alt; |
| 12139 | spec->num_adc_nids = |
| 12140 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12141 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12142 | } else { |
| 12143 | spec->adc_nids = alc262_adc_nids; |
| 12144 | spec->num_adc_nids = |
| 12145 | ARRAY_SIZE(alc262_adc_nids); |
| 12146 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12147 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12148 | } |
| 12149 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12150 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12151 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12152 | if (!spec->no_analog) |
| 12153 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12154 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12155 | spec->vmaster_nid = 0x0c; |
| 12156 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12157 | codec->patch_ops = alc_patch_ops; |
| 12158 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12159 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12160 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12161 | if (!spec->loopback.amplist) |
| 12162 | spec->loopback.amplist = alc262_loopbacks; |
| 12163 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12165 | return 0; |
| 12166 | } |
| 12167 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12168 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12169 | * ALC268 channel source setting (2 channel) |
| 12170 | */ |
| 12171 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12172 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12173 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12174 | static hda_nid_t alc268_dac_nids[2] = { |
| 12175 | /* front, hp */ |
| 12176 | 0x02, 0x03 |
| 12177 | }; |
| 12178 | |
| 12179 | static hda_nid_t alc268_adc_nids[2] = { |
| 12180 | /* ADC0-1 */ |
| 12181 | 0x08, 0x07 |
| 12182 | }; |
| 12183 | |
| 12184 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12185 | /* ADC0 */ |
| 12186 | 0x08 |
| 12187 | }; |
| 12188 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12189 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12190 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12191 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12192 | /* output mixer control */ |
| 12193 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12194 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12195 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12196 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12197 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12198 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12199 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12200 | { } |
| 12201 | }; |
| 12202 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12203 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12204 | /* output mixer control */ |
| 12205 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12206 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12207 | ALC262_HIPPO_MASTER_SWITCH, |
| 12208 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12209 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12210 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12211 | { } |
| 12212 | }; |
| 12213 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12214 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12215 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12216 | .ops = &snd_hda_bind_sw, |
| 12217 | .values = { |
| 12218 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12219 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12220 | 0 |
| 12221 | }, |
| 12222 | }; |
| 12223 | |
| 12224 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12225 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12226 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12227 | { } |
| 12228 | }; |
| 12229 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12230 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12231 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12232 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12233 | { } |
| 12234 | }; |
| 12235 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12236 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12237 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12238 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12239 | { } /* end */ |
| 12240 | }; |
| 12241 | |
| 12242 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12243 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12244 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12245 | .ops = &snd_hda_bind_vol, |
| 12246 | .values = { |
| 12247 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12248 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12249 | 0 |
| 12250 | }, |
| 12251 | }; |
| 12252 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12253 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12254 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12255 | { |
| 12256 | struct alc_spec *spec = codec->spec; |
| 12257 | unsigned int mute; |
| 12258 | |
| 12259 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12260 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12261 | spec->sense_updated = 1; |
| 12262 | } |
| 12263 | if (spec->jack_present) |
| 12264 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12265 | else /* unmute internal speaker if necessary */ |
| 12266 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12267 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12268 | HDA_AMP_MUTE, mute); |
| 12269 | } |
| 12270 | |
| 12271 | |
| 12272 | /* bind hp and internal speaker mute (with plug check) */ |
| 12273 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12274 | struct snd_ctl_elem_value *ucontrol) |
| 12275 | { |
| 12276 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12277 | long *valp = ucontrol->value.integer.value; |
| 12278 | int change; |
| 12279 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12280 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12281 | if (change) |
| 12282 | alc268_acer_automute(codec, 0); |
| 12283 | return change; |
| 12284 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12285 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12286 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12287 | /* output mixer control */ |
| 12288 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12289 | { |
| 12290 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12291 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12292 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12293 | .info = snd_hda_mixer_amp_switch_info, |
| 12294 | .get = snd_hda_mixer_amp_switch_get, |
| 12295 | .put = alc268_acer_master_sw_put, |
| 12296 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12297 | }, |
| 12298 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12299 | { } |
| 12300 | }; |
| 12301 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12302 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12303 | /* output mixer control */ |
| 12304 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12305 | { |
| 12306 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12307 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12308 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12309 | .info = snd_hda_mixer_amp_switch_info, |
| 12310 | .get = snd_hda_mixer_amp_switch_get, |
| 12311 | .put = alc268_acer_master_sw_put, |
| 12312 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12313 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12314 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12315 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12316 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12317 | { } |
| 12318 | }; |
| 12319 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12320 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12321 | /* output mixer control */ |
| 12322 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12323 | { |
| 12324 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12325 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12326 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12327 | .info = snd_hda_mixer_amp_switch_info, |
| 12328 | .get = snd_hda_mixer_amp_switch_get, |
| 12329 | .put = alc268_acer_master_sw_put, |
| 12330 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12331 | }, |
| 12332 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12333 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12334 | { } |
| 12335 | }; |
| 12336 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12337 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12338 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12339 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12340 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12341 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12342 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12343 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12344 | { } |
| 12345 | }; |
| 12346 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12347 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12348 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12349 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12350 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12351 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12352 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12353 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12354 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12355 | { } |
| 12356 | }; |
| 12357 | |
| 12358 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12359 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12360 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12361 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12362 | |
| 12363 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12364 | unsigned int res) |
| 12365 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12366 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12367 | return; |
| 12368 | alc268_acer_automute(codec, 1); |
| 12369 | } |
| 12370 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12371 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12372 | { |
| 12373 | alc268_acer_automute(codec, 1); |
| 12374 | } |
| 12375 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12376 | /* toggle speaker-output according to the hp-jack state */ |
| 12377 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12378 | { |
| 12379 | unsigned int present; |
| 12380 | unsigned char bits; |
| 12381 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12382 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12383 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12384 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12385 | AMP_IN_MUTE(0), bits); |
| 12386 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12387 | AMP_IN_MUTE(0), bits); |
| 12388 | } |
| 12389 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12390 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12391 | unsigned int res) |
| 12392 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12393 | switch (res >> 26) { |
| 12394 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12395 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12396 | break; |
| 12397 | case ALC880_MIC_EVENT: |
| 12398 | alc_mic_automute(codec); |
| 12399 | break; |
| 12400 | } |
| 12401 | } |
| 12402 | |
| 12403 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12404 | { |
| 12405 | struct alc_spec *spec = codec->spec; |
| 12406 | spec->ext_mic.pin = 0x18; |
| 12407 | spec->ext_mic.mux_idx = 0; |
| 12408 | spec->int_mic.pin = 0x12; |
| 12409 | spec->int_mic.mux_idx = 6; |
| 12410 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12411 | } |
| 12412 | |
| 12413 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12414 | { |
| 12415 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12416 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12417 | } |
| 12418 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12419 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12420 | /* output mixer control */ |
| 12421 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12422 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12423 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12424 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12425 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12426 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12427 | { } |
| 12428 | }; |
| 12429 | |
| 12430 | static struct hda_verb alc268_dell_verbs[] = { |
| 12431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12432 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12433 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12434 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12435 | { } |
| 12436 | }; |
| 12437 | |
| 12438 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12439 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12440 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12441 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12442 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12443 | spec->autocfg.hp_pins[0] = 0x15; |
| 12444 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12445 | spec->ext_mic.pin = 0x18; |
| 12446 | spec->ext_mic.mux_idx = 0; |
| 12447 | spec->int_mic.pin = 0x19; |
| 12448 | spec->int_mic.mux_idx = 1; |
| 12449 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12450 | } |
| 12451 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12452 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12453 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12454 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12455 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12456 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12457 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12458 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12459 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12460 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12461 | { } |
| 12462 | }; |
| 12463 | |
| 12464 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12465 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12466 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12467 | { } |
| 12468 | }; |
| 12469 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12470 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12471 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12472 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12473 | spec->autocfg.hp_pins[0] = 0x15; |
| 12474 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12475 | spec->ext_mic.pin = 0x18; |
| 12476 | spec->ext_mic.mux_idx = 0; |
| 12477 | spec->int_mic.pin = 0x19; |
| 12478 | spec->int_mic.mux_idx = 1; |
| 12479 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12480 | } |
| 12481 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12482 | /* |
| 12483 | * generic initialization of ADC, input mixers and output mixers |
| 12484 | */ |
| 12485 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12486 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12487 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12488 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12489 | |
| 12490 | /* |
| 12491 | * Set up output mixers (0x0c - 0x0e) |
| 12492 | */ |
| 12493 | /* set vol=0 to output mixers */ |
| 12494 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12495 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12496 | |
| 12497 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12498 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12499 | |
| 12500 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12501 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12502 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12503 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12504 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12505 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12506 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12507 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12508 | |
| 12509 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12510 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12511 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12512 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12514 | |
| 12515 | /* set PCBEEP vol = 0, mute connections */ |
| 12516 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12518 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12519 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12520 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12521 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12522 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12524 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12525 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12526 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12527 | { } |
| 12528 | }; |
| 12529 | |
| 12530 | /* |
| 12531 | * generic initialization of ADC, input mixers and output mixers |
| 12532 | */ |
| 12533 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12534 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12535 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12536 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12537 | |
| 12538 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12539 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12540 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12541 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12542 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12543 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12545 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12546 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12547 | |
| 12548 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12549 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12550 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12551 | /* set PCBEEP vol = 0, mute connections */ |
| 12552 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12553 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12554 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12555 | |
| 12556 | { } |
| 12557 | }; |
| 12558 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12559 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12560 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12561 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12562 | { } /* end */ |
| 12563 | }; |
| 12564 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12565 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12566 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12567 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12568 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12569 | { } /* end */ |
| 12570 | }; |
| 12571 | |
| 12572 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12573 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12574 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12575 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12576 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12577 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12578 | { } /* end */ |
| 12579 | }; |
| 12580 | |
| 12581 | static struct hda_input_mux alc268_capture_source = { |
| 12582 | .num_items = 4, |
| 12583 | .items = { |
| 12584 | { "Mic", 0x0 }, |
| 12585 | { "Front Mic", 0x1 }, |
| 12586 | { "Line", 0x2 }, |
| 12587 | { "CD", 0x3 }, |
| 12588 | }, |
| 12589 | }; |
| 12590 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12591 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12592 | .num_items = 3, |
| 12593 | .items = { |
| 12594 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12595 | { "Internal Mic", 0x1 }, |
| 12596 | { "Line", 0x2 }, |
| 12597 | }, |
| 12598 | }; |
| 12599 | |
| 12600 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12601 | .num_items = 3, |
| 12602 | .items = { |
| 12603 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12604 | { "Internal Mic", 0x6 }, |
| 12605 | { "Line", 0x2 }, |
| 12606 | }, |
| 12607 | }; |
| 12608 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12609 | #ifdef CONFIG_SND_DEBUG |
| 12610 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12611 | /* Volume widgets */ |
| 12612 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12613 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12614 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12615 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12616 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12617 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12618 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12619 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12620 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12621 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12622 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12623 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12624 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12625 | /* The below appears problematic on some hardwares */ |
| 12626 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12627 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12628 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12629 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12630 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12631 | |
| 12632 | /* Modes for retasking pin widgets */ |
| 12633 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12634 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12635 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12636 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12637 | |
| 12638 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12639 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12640 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12641 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12642 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12643 | |
| 12644 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12645 | * The ALC268 does not have an SPDIF input. |
| 12646 | */ |
| 12647 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12648 | |
| 12649 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12650 | * this output to turn on an external amplifier. |
| 12651 | */ |
| 12652 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12653 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12654 | |
| 12655 | { } /* end */ |
| 12656 | }; |
| 12657 | #endif |
| 12658 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12659 | /* create input playback/capture controls for the given pin */ |
| 12660 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12661 | const char *ctlname, int idx) |
| 12662 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12663 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12664 | int err; |
| 12665 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12666 | switch (nid) { |
| 12667 | case 0x14: |
| 12668 | case 0x16: |
| 12669 | dac = 0x02; |
| 12670 | break; |
| 12671 | case 0x15: |
Takashi Iwai | 4feabef | 2010-01-19 15:38:44 +0100 | [diff] [blame] | 12672 | case 0x21: |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12673 | dac = 0x03; |
| 12674 | break; |
| 12675 | default: |
| 12676 | return 0; |
| 12677 | } |
| 12678 | if (spec->multiout.dac_nids[0] != dac && |
| 12679 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12680 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12681 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12682 | HDA_OUTPUT)); |
| 12683 | if (err < 0) |
| 12684 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12685 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12686 | } |
| 12687 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12688 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12689 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12690 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12691 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12692 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12693 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12694 | if (err < 0) |
| 12695 | return err; |
| 12696 | return 0; |
| 12697 | } |
| 12698 | |
| 12699 | /* add playback controls from the parsed DAC table */ |
| 12700 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12701 | const struct auto_pin_cfg *cfg) |
| 12702 | { |
| 12703 | hda_nid_t nid; |
| 12704 | int err; |
| 12705 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12706 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12707 | |
| 12708 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12709 | if (nid) { |
| 12710 | const char *name; |
| 12711 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12712 | name = "Speaker"; |
| 12713 | else |
| 12714 | name = "Front"; |
| 12715 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12716 | if (err < 0) |
| 12717 | return err; |
| 12718 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12719 | |
| 12720 | nid = cfg->speaker_pins[0]; |
| 12721 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12722 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12723 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12724 | if (err < 0) |
| 12725 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12726 | } else { |
| 12727 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12728 | if (err < 0) |
| 12729 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12730 | } |
| 12731 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12732 | if (nid) { |
| 12733 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12734 | if (err < 0) |
| 12735 | return err; |
| 12736 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12737 | |
| 12738 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12739 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12740 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12741 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12742 | if (err < 0) |
| 12743 | return err; |
| 12744 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12745 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12746 | } |
| 12747 | |
| 12748 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12749 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12750 | const struct auto_pin_cfg *cfg) |
| 12751 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12752 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12753 | } |
| 12754 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12755 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12756 | hda_nid_t nid, int pin_type) |
| 12757 | { |
| 12758 | int idx; |
| 12759 | |
| 12760 | alc_set_pin_output(codec, nid, pin_type); |
| 12761 | if (nid == 0x14 || nid == 0x16) |
| 12762 | idx = 0; |
| 12763 | else |
| 12764 | idx = 1; |
| 12765 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12766 | } |
| 12767 | |
| 12768 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12769 | { |
| 12770 | struct alc_spec *spec = codec->spec; |
| 12771 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12772 | if (nid) { |
| 12773 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12774 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12775 | } |
| 12776 | } |
| 12777 | |
| 12778 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12779 | { |
| 12780 | struct alc_spec *spec = codec->spec; |
| 12781 | hda_nid_t pin; |
| 12782 | |
| 12783 | pin = spec->autocfg.hp_pins[0]; |
| 12784 | if (pin) |
| 12785 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12786 | pin = spec->autocfg.speaker_pins[0]; |
| 12787 | if (pin) |
| 12788 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12789 | } |
| 12790 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12791 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12792 | { |
| 12793 | struct alc_spec *spec = codec->spec; |
| 12794 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12795 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12796 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12797 | unsigned int dac_vol1, dac_vol2; |
| 12798 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12799 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12800 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12801 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12802 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12803 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12804 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12805 | AMP_IN_UNMUTE(1)); |
| 12806 | snd_hda_codec_write(codec, 0x10, 0, |
| 12807 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12808 | AMP_IN_UNMUTE(1)); |
| 12809 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12810 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12811 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12812 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12813 | snd_hda_codec_write(codec, 0x10, 0, |
| 12814 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12815 | } |
| 12816 | |
| 12817 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12818 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12819 | dac_vol2 = AMP_OUT_ZERO; |
| 12820 | else if (line_nid == 0x15) |
| 12821 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12822 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12823 | dac_vol2 = AMP_OUT_ZERO; |
| 12824 | else if (hp_nid == 0x15) |
| 12825 | dac_vol1 = AMP_OUT_ZERO; |
| 12826 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12827 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12828 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12829 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12830 | |
| 12831 | snd_hda_codec_write(codec, 0x02, 0, |
| 12832 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12833 | snd_hda_codec_write(codec, 0x03, 0, |
| 12834 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12835 | } |
| 12836 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12837 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12838 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12839 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12840 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12841 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12842 | |
| 12843 | /* |
| 12844 | * BIOS auto configuration |
| 12845 | */ |
| 12846 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12847 | { |
| 12848 | struct alc_spec *spec = codec->spec; |
| 12849 | int err; |
| 12850 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12851 | |
| 12852 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12853 | alc268_ignore); |
| 12854 | if (err < 0) |
| 12855 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12856 | if (!spec->autocfg.line_outs) { |
| 12857 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12858 | spec->multiout.max_channels = 2; |
| 12859 | spec->no_analog = 1; |
| 12860 | goto dig_only; |
| 12861 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12862 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12863 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12864 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12865 | if (err < 0) |
| 12866 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12867 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12868 | if (err < 0) |
| 12869 | return err; |
| 12870 | |
| 12871 | spec->multiout.max_channels = 2; |
| 12872 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12873 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12874 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12875 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12876 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12877 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12878 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12879 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12880 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12881 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12882 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12883 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12884 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12885 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12886 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12887 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12888 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12889 | err = alc_auto_add_mic_boost(codec); |
| 12890 | if (err < 0) |
| 12891 | return err; |
| 12892 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12893 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12894 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12895 | return 1; |
| 12896 | } |
| 12897 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12898 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12899 | |
| 12900 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12901 | static void alc268_auto_init(struct hda_codec *codec) |
| 12902 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12903 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12904 | alc268_auto_init_multi_out(codec); |
| 12905 | alc268_auto_init_hp_out(codec); |
| 12906 | alc268_auto_init_mono_speaker_out(codec); |
| 12907 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12908 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12909 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12910 | } |
| 12911 | |
| 12912 | /* |
| 12913 | * configuration and preset |
| 12914 | */ |
| 12915 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12916 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12917 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12918 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12919 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12920 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12921 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12922 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12923 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12924 | #ifdef CONFIG_SND_DEBUG |
| 12925 | [ALC268_TEST] = "test", |
| 12926 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12927 | [ALC268_AUTO] = "auto", |
| 12928 | }; |
| 12929 | |
| 12930 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12931 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12932 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12933 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12934 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12935 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12936 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12937 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12938 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 12939 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 12940 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12941 | /* almost compatible with toshiba but with optional digital outs; |
| 12942 | * auto-probing seems working fine |
| 12943 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12944 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 12945 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12946 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12947 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12948 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12949 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12950 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12951 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12952 | {} |
| 12953 | }; |
| 12954 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12955 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12956 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12957 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12958 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12959 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12960 | ALC268_TOSHIBA), |
| 12961 | {} |
| 12962 | }; |
| 12963 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12964 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12965 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12966 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12967 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12968 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12969 | alc267_quanta_il1_verbs }, |
| 12970 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12971 | .dac_nids = alc268_dac_nids, |
| 12972 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12973 | .adc_nids = alc268_adc_nids_alt, |
| 12974 | .hp_nid = 0x03, |
| 12975 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12976 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12977 | .unsol_event = alc_sku_unsol_event, |
| 12978 | .setup = alc267_quanta_il1_setup, |
| 12979 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12980 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12981 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12982 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12983 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12984 | .init_verbs = { alc268_base_init_verbs }, |
| 12985 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12986 | .dac_nids = alc268_dac_nids, |
| 12987 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12988 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12989 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12990 | .hp_nid = 0x03, |
| 12991 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12992 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12993 | .channel_mode = alc268_modes, |
| 12994 | .input_mux = &alc268_capture_source, |
| 12995 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12996 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12997 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12998 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12999 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13000 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13001 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13002 | .dac_nids = alc268_dac_nids, |
| 13003 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13004 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13005 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13006 | .hp_nid = 0x03, |
| 13007 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13008 | .channel_mode = alc268_modes, |
| 13009 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13010 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13011 | .setup = alc268_toshiba_setup, |
| 13012 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13013 | }, |
| 13014 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13015 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13016 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13017 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13018 | alc268_acer_verbs }, |
| 13019 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13020 | .dac_nids = alc268_dac_nids, |
| 13021 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13022 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13023 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13024 | .hp_nid = 0x02, |
| 13025 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13026 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13027 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13028 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13029 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13030 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13031 | [ALC268_ACER_DMIC] = { |
| 13032 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13033 | alc268_beep_mixer }, |
| 13034 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13035 | alc268_acer_verbs }, |
| 13036 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13037 | .dac_nids = alc268_dac_nids, |
| 13038 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13039 | .adc_nids = alc268_adc_nids_alt, |
| 13040 | .capsrc_nids = alc268_capsrc_nids, |
| 13041 | .hp_nid = 0x02, |
| 13042 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13043 | .channel_mode = alc268_modes, |
| 13044 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13045 | .unsol_event = alc268_acer_unsol_event, |
| 13046 | .init_hook = alc268_acer_init_hook, |
| 13047 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13048 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13049 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13050 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13051 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13052 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13053 | alc268_acer_aspire_one_verbs }, |
| 13054 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13055 | .dac_nids = alc268_dac_nids, |
| 13056 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13057 | .adc_nids = alc268_adc_nids_alt, |
| 13058 | .capsrc_nids = alc268_capsrc_nids, |
| 13059 | .hp_nid = 0x03, |
| 13060 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13061 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13062 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13063 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13064 | .init_hook = alc268_acer_lc_init_hook, |
| 13065 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13066 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13067 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13068 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13069 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13070 | alc268_dell_verbs }, |
| 13071 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13072 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13073 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13074 | .adc_nids = alc268_adc_nids_alt, |
| 13075 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13076 | .hp_nid = 0x02, |
| 13077 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13078 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13079 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13080 | .setup = alc268_dell_setup, |
| 13081 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13082 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13083 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13084 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13085 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13086 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13087 | alc268_toshiba_verbs }, |
| 13088 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13089 | .dac_nids = alc268_dac_nids, |
| 13090 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13091 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13092 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13093 | .hp_nid = 0x03, |
| 13094 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13095 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13096 | .channel_mode = alc268_modes, |
| 13097 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13098 | .setup = alc268_toshiba_setup, |
| 13099 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13100 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13101 | #ifdef CONFIG_SND_DEBUG |
| 13102 | [ALC268_TEST] = { |
| 13103 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13104 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13105 | alc268_volume_init_verbs }, |
| 13106 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13107 | .dac_nids = alc268_dac_nids, |
| 13108 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13109 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13110 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13111 | .hp_nid = 0x03, |
| 13112 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13113 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13114 | .channel_mode = alc268_modes, |
| 13115 | .input_mux = &alc268_capture_source, |
| 13116 | }, |
| 13117 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13118 | }; |
| 13119 | |
| 13120 | static int patch_alc268(struct hda_codec *codec) |
| 13121 | { |
| 13122 | struct alc_spec *spec; |
| 13123 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13124 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13125 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13126 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13127 | if (spec == NULL) |
| 13128 | return -ENOMEM; |
| 13129 | |
| 13130 | codec->spec = spec; |
| 13131 | |
| 13132 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13133 | alc268_models, |
| 13134 | alc268_cfg_tbl); |
| 13135 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13136 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13137 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 13138 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 13139 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13140 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13141 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13142 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13143 | board_config = ALC268_AUTO; |
| 13144 | } |
| 13145 | |
| 13146 | if (board_config == ALC268_AUTO) { |
| 13147 | /* automatic parse from the BIOS config */ |
| 13148 | err = alc268_parse_auto_config(codec); |
| 13149 | if (err < 0) { |
| 13150 | alc_free(codec); |
| 13151 | return err; |
| 13152 | } else if (!err) { |
| 13153 | printk(KERN_INFO |
| 13154 | "hda_codec: Cannot set up configuration " |
| 13155 | "from BIOS. Using base mode...\n"); |
| 13156 | board_config = ALC268_3ST; |
| 13157 | } |
| 13158 | } |
| 13159 | |
| 13160 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13161 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13162 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13163 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13164 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13165 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13166 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13167 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13168 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13169 | has_beep = 0; |
| 13170 | for (i = 0; i < spec->num_mixers; i++) { |
| 13171 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13172 | has_beep = 1; |
| 13173 | break; |
| 13174 | } |
| 13175 | } |
| 13176 | |
| 13177 | if (has_beep) { |
| 13178 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13179 | if (err < 0) { |
| 13180 | alc_free(codec); |
| 13181 | return err; |
| 13182 | } |
| 13183 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13184 | /* override the amp caps for beep generator */ |
| 13185 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13186 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13187 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13188 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13189 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13190 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13191 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13192 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13193 | /* check whether NID 0x07 is valid */ |
| 13194 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13195 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13196 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13197 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13198 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13199 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13200 | if (spec->auto_mic || |
| 13201 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13202 | spec->adc_nids = alc268_adc_nids_alt; |
| 13203 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13204 | if (spec->auto_mic) |
| 13205 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13206 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13207 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13208 | else |
| 13209 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13210 | } else { |
| 13211 | spec->adc_nids = alc268_adc_nids; |
| 13212 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13213 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13214 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13215 | /* set default input source */ |
| 13216 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13217 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13218 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13219 | i < spec->num_mux_defs ? |
| 13220 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13221 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13222 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13223 | |
| 13224 | spec->vmaster_nid = 0x02; |
| 13225 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13226 | codec->patch_ops = alc_patch_ops; |
| 13227 | if (board_config == ALC268_AUTO) |
| 13228 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13229 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13230 | return 0; |
| 13231 | } |
| 13232 | |
| 13233 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13234 | * ALC269 channel source setting (2 channel) |
| 13235 | */ |
| 13236 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13237 | |
| 13238 | #define alc269_dac_nids alc260_dac_nids |
| 13239 | |
| 13240 | static hda_nid_t alc269_adc_nids[1] = { |
| 13241 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13242 | 0x08, |
| 13243 | }; |
| 13244 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13245 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13246 | 0x23, |
| 13247 | }; |
| 13248 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13249 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13250 | /* ADC1 */ |
| 13251 | 0x09, |
| 13252 | }; |
| 13253 | |
| 13254 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13255 | 0x22, |
| 13256 | }; |
| 13257 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13258 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 13259 | * not a mux! |
| 13260 | */ |
| 13261 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13262 | #define alc269_modes alc260_modes |
| 13263 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13264 | |
| 13265 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13266 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13267 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13268 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13269 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13270 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13271 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13272 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13273 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13274 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13275 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13276 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13277 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13278 | { } /* end */ |
| 13279 | }; |
| 13280 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13281 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13282 | /* output mixer control */ |
| 13283 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13284 | { |
| 13285 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13286 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13287 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13288 | .info = snd_hda_mixer_amp_switch_info, |
| 13289 | .get = snd_hda_mixer_amp_switch_get, |
| 13290 | .put = alc268_acer_master_sw_put, |
| 13291 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13292 | }, |
| 13293 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13294 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13295 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13296 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13297 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13298 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13299 | { } |
| 13300 | }; |
| 13301 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13302 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13303 | /* output mixer control */ |
| 13304 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13305 | { |
| 13306 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13307 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13308 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13309 | .info = snd_hda_mixer_amp_switch_info, |
| 13310 | .get = snd_hda_mixer_amp_switch_get, |
| 13311 | .put = alc268_acer_master_sw_put, |
| 13312 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13313 | }, |
| 13314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13316 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13317 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13318 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13319 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13320 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13321 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13322 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13323 | { } |
| 13324 | }; |
| 13325 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13326 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13327 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13328 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13329 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13330 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13331 | { } /* end */ |
| 13332 | }; |
| 13333 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13334 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13335 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13336 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13337 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13338 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13339 | { } /* end */ |
| 13340 | }; |
| 13341 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13342 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13343 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13344 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13345 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13346 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13347 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13348 | { } /* end */ |
| 13349 | }; |
| 13350 | |
| 13351 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13352 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13353 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13354 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13355 | { } /* end */ |
| 13356 | }; |
| 13357 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13358 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13359 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13360 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13361 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13362 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13363 | { } /* end */ |
| 13364 | }; |
| 13365 | |
| 13366 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13367 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13368 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13369 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13370 | { } /* end */ |
| 13371 | }; |
| 13372 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13373 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13374 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13375 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13376 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13377 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13378 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13379 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13380 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13381 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13382 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13383 | { } |
| 13384 | }; |
| 13385 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13386 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13387 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13388 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13389 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13390 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13391 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13392 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13393 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13394 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13395 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13396 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13397 | { } |
| 13398 | }; |
| 13399 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13400 | /* toggle speaker-output according to the hp-jack state */ |
| 13401 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13402 | { |
| 13403 | unsigned int present; |
| 13404 | unsigned char bits; |
| 13405 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13406 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13407 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13408 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13409 | AMP_IN_MUTE(0), bits); |
| 13410 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13411 | AMP_IN_MUTE(0), bits); |
| 13412 | |
| 13413 | snd_hda_codec_write(codec, 0x20, 0, |
| 13414 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13415 | snd_hda_codec_write(codec, 0x20, 0, |
| 13416 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13417 | |
| 13418 | snd_hda_codec_write(codec, 0x20, 0, |
| 13419 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13420 | snd_hda_codec_write(codec, 0x20, 0, |
| 13421 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13422 | } |
| 13423 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13424 | /* toggle speaker-output according to the hp-jacks state */ |
| 13425 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13426 | { |
| 13427 | unsigned int present; |
| 13428 | unsigned char bits; |
| 13429 | |
| 13430 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13431 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13432 | |
| 13433 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13434 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13435 | |
| 13436 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13437 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13438 | AMP_IN_MUTE(0), bits); |
| 13439 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13440 | AMP_IN_MUTE(0), bits); |
| 13441 | |
| 13442 | snd_hda_codec_write(codec, 0x20, 0, |
| 13443 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13444 | snd_hda_codec_write(codec, 0x20, 0, |
| 13445 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13446 | |
| 13447 | snd_hda_codec_write(codec, 0x20, 0, |
| 13448 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13449 | snd_hda_codec_write(codec, 0x20, 0, |
| 13450 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13451 | } |
| 13452 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13453 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13454 | { |
| 13455 | unsigned int present_laptop; |
| 13456 | unsigned int present_dock; |
| 13457 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13458 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13459 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13460 | |
| 13461 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13462 | if (present_dock) |
| 13463 | snd_hda_codec_write(codec, 0x23, 0, |
| 13464 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13465 | if (present_laptop) |
| 13466 | snd_hda_codec_write(codec, 0x23, 0, |
| 13467 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13468 | if (!present_dock && !present_laptop) |
| 13469 | snd_hda_codec_write(codec, 0x23, 0, |
| 13470 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13471 | } |
| 13472 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13473 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13474 | unsigned int res) |
| 13475 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13476 | switch (res >> 26) { |
| 13477 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13478 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13479 | break; |
| 13480 | case ALC880_MIC_EVENT: |
| 13481 | alc_mic_automute(codec); |
| 13482 | break; |
| 13483 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13484 | } |
| 13485 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13486 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13487 | unsigned int res) |
| 13488 | { |
| 13489 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13490 | alc269_lifebook_speaker_automute(codec); |
| 13491 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13492 | alc269_lifebook_mic_autoswitch(codec); |
| 13493 | } |
| 13494 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13495 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13496 | { |
| 13497 | struct alc_spec *spec = codec->spec; |
| 13498 | spec->ext_mic.pin = 0x18; |
| 13499 | spec->ext_mic.mux_idx = 0; |
| 13500 | spec->int_mic.pin = 0x19; |
| 13501 | spec->int_mic.mux_idx = 1; |
| 13502 | spec->auto_mic = 1; |
| 13503 | } |
| 13504 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13505 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13506 | { |
| 13507 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13508 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13509 | } |
| 13510 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13511 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13512 | { |
| 13513 | alc269_lifebook_speaker_automute(codec); |
| 13514 | alc269_lifebook_mic_autoswitch(codec); |
| 13515 | } |
| 13516 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13517 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13519 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13520 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13521 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13522 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13523 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13524 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13525 | {} |
| 13526 | }; |
| 13527 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13528 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13529 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13530 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13531 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13532 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13533 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13534 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13535 | {} |
| 13536 | }; |
| 13537 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13538 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13539 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13540 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13541 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13542 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13543 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13544 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13545 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13546 | {} |
| 13547 | }; |
| 13548 | |
| 13549 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13550 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13551 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13552 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13553 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13554 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13555 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13556 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13557 | {} |
| 13558 | }; |
| 13559 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13560 | /* toggle speaker-output according to the hp-jack state */ |
| 13561 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13562 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13563 | struct alc_spec *spec = codec->spec; |
| 13564 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13565 | unsigned int present; |
| 13566 | unsigned char bits; |
| 13567 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13568 | present = snd_hda_jack_detect(codec, nid); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13569 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13570 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13571 | AMP_IN_MUTE(0), bits); |
| 13572 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13573 | AMP_IN_MUTE(0), bits); |
| 13574 | } |
| 13575 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13576 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13577 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13578 | unsigned int res) |
| 13579 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13580 | switch (res >> 26) { |
| 13581 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13582 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13583 | break; |
| 13584 | case ALC880_MIC_EVENT: |
| 13585 | alc_mic_automute(codec); |
| 13586 | break; |
| 13587 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13588 | } |
| 13589 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13590 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13591 | { |
| 13592 | struct alc_spec *spec = codec->spec; |
| 13593 | spec->ext_mic.pin = 0x18; |
| 13594 | spec->ext_mic.mux_idx = 0; |
| 13595 | spec->int_mic.pin = 0x12; |
| 13596 | spec->int_mic.mux_idx = 5; |
| 13597 | spec->auto_mic = 1; |
| 13598 | } |
| 13599 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13600 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 13601 | { |
| 13602 | struct alc_spec *spec = codec->spec; |
| 13603 | spec->ext_mic.pin = 0x18; |
| 13604 | spec->ext_mic.mux_idx = 0; |
| 13605 | spec->int_mic.pin = 0x12; |
| 13606 | spec->int_mic.mux_idx = 6; |
| 13607 | spec->auto_mic = 1; |
| 13608 | } |
| 13609 | |
| 13610 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13611 | { |
| 13612 | struct alc_spec *spec = codec->spec; |
| 13613 | spec->ext_mic.pin = 0x18; |
| 13614 | spec->ext_mic.mux_idx = 0; |
| 13615 | spec->int_mic.pin = 0x19; |
| 13616 | spec->int_mic.mux_idx = 1; |
| 13617 | spec->auto_mic = 1; |
| 13618 | } |
| 13619 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13620 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13621 | { |
| 13622 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13623 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13624 | } |
| 13625 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13626 | /* |
| 13627 | * generic initialization of ADC, input mixers and output mixers |
| 13628 | */ |
| 13629 | static struct hda_verb alc269_init_verbs[] = { |
| 13630 | /* |
| 13631 | * Unmute ADC0 and set the default input to mic-in |
| 13632 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13633 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13634 | |
| 13635 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13636 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13637 | */ |
| 13638 | /* set vol=0 to output mixers */ |
| 13639 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13640 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13641 | |
| 13642 | /* set up input amps for analog loopback */ |
| 13643 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13644 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13647 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13648 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13649 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13650 | |
| 13651 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13653 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13654 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13655 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13656 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13657 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13658 | |
| 13659 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13660 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13661 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13662 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13663 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13664 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13665 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13666 | |
| 13667 | /* set EAPD */ |
| 13668 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13669 | { } |
| 13670 | }; |
| 13671 | |
| 13672 | static struct hda_verb alc269vb_init_verbs[] = { |
| 13673 | /* |
| 13674 | * Unmute ADC0 and set the default input to mic-in |
| 13675 | */ |
| 13676 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13677 | |
| 13678 | /* |
| 13679 | * Set up output mixers (0x02 - 0x03) |
| 13680 | */ |
| 13681 | /* set vol=0 to output mixers */ |
| 13682 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13683 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13684 | |
| 13685 | /* set up input amps for analog loopback */ |
| 13686 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13688 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13689 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13690 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13691 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13692 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13693 | |
| 13694 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13695 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13696 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13697 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13698 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13699 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13700 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13701 | |
| 13702 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13703 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13704 | |
| 13705 | /* FIXME: use Mux-type input source selection */ |
| 13706 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13707 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 13708 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13709 | |
| 13710 | /* set EAPD */ |
| 13711 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13712 | { } |
| 13713 | }; |
| 13714 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13715 | #define alc269_auto_create_multi_out_ctls \ |
| 13716 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13717 | #define alc269_auto_create_input_ctls \ |
| 13718 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13719 | |
| 13720 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13721 | #define alc269_loopbacks alc880_loopbacks |
| 13722 | #endif |
| 13723 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13724 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13725 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13726 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13727 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13728 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13729 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13730 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13731 | .substreams = 1, |
| 13732 | .channels_min = 2, |
| 13733 | .channels_max = 8, |
| 13734 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13735 | /* NID is set in alc_build_pcms */ |
| 13736 | .ops = { |
| 13737 | .open = alc880_playback_pcm_open, |
| 13738 | .prepare = alc880_playback_pcm_prepare, |
| 13739 | .cleanup = alc880_playback_pcm_cleanup |
| 13740 | }, |
| 13741 | }; |
| 13742 | |
| 13743 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13744 | .substreams = 1, |
| 13745 | .channels_min = 2, |
| 13746 | .channels_max = 2, |
| 13747 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13748 | /* NID is set in alc_build_pcms */ |
| 13749 | }; |
| 13750 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13751 | /* |
| 13752 | * BIOS auto configuration |
| 13753 | */ |
| 13754 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13755 | { |
| 13756 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13757 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13758 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13759 | hda_nid_t real_capsrc_nids; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13760 | |
| 13761 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13762 | alc269_ignore); |
| 13763 | if (err < 0) |
| 13764 | return err; |
| 13765 | |
| 13766 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13767 | if (err < 0) |
| 13768 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13769 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13770 | if (err < 0) |
| 13771 | return err; |
| 13772 | |
| 13773 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13774 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13775 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13776 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13777 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13778 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13779 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13780 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13781 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 13782 | add_verb(spec, alc269vb_init_verbs); |
| 13783 | real_capsrc_nids = alc269vb_capsrc_nids[0]; |
| 13784 | alc_ssid_check(codec, 0x21, 0x1b, 0x14); |
| 13785 | } else { |
| 13786 | add_verb(spec, alc269_init_verbs); |
| 13787 | real_capsrc_nids = alc269_capsrc_nids[0]; |
| 13788 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13789 | } |
| 13790 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13791 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13792 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13793 | /* set default input source */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13794 | snd_hda_codec_write_cache(codec, real_capsrc_nids, |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13795 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13796 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13797 | |
| 13798 | err = alc_auto_add_mic_boost(codec); |
| 13799 | if (err < 0) |
| 13800 | return err; |
| 13801 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13802 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13803 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13804 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13805 | return 1; |
| 13806 | } |
| 13807 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13808 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13809 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13810 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13811 | |
| 13812 | |
| 13813 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13814 | static void alc269_auto_init(struct hda_codec *codec) |
| 13815 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13816 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13817 | alc269_auto_init_multi_out(codec); |
| 13818 | alc269_auto_init_hp_out(codec); |
| 13819 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13820 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13821 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13822 | } |
| 13823 | |
| 13824 | /* |
| 13825 | * configuration and preset |
| 13826 | */ |
| 13827 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13828 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13829 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13830 | [ALC269_AMIC] = "laptop-amic", |
| 13831 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13832 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 13833 | [ALC269_LIFEBOOK] = "lifebook", |
| 13834 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13835 | }; |
| 13836 | |
| 13837 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13838 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13839 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13840 | ALC269_AMIC), |
| 13841 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 13842 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 13843 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 13844 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 13845 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 13846 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 13847 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 13848 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 13849 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 13850 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 13851 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 13852 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 13853 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 13854 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 13855 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 13856 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 13857 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 13858 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 13859 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 13860 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 13861 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 13862 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 13863 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 13864 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 13865 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 13866 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 13867 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 13868 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 13869 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 13870 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 13871 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 13872 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 13873 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 13874 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 13875 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 13876 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13877 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13878 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13879 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13880 | ALC269_DMIC), |
| 13881 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 13882 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13883 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13884 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13885 | {} |
| 13886 | }; |
| 13887 | |
| 13888 | static struct alc_config_preset alc269_presets[] = { |
| 13889 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13890 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13891 | .init_verbs = { alc269_init_verbs }, |
| 13892 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13893 | .dac_nids = alc269_dac_nids, |
| 13894 | .hp_nid = 0x03, |
| 13895 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13896 | .channel_mode = alc269_modes, |
| 13897 | .input_mux = &alc269_capture_source, |
| 13898 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13899 | [ALC269_QUANTA_FL1] = { |
| 13900 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13901 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13902 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13903 | .dac_nids = alc269_dac_nids, |
| 13904 | .hp_nid = 0x03, |
| 13905 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13906 | .channel_mode = alc269_modes, |
| 13907 | .input_mux = &alc269_capture_source, |
| 13908 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13909 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13910 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13911 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13912 | [ALC269_AMIC] = { |
| 13913 | .mixers = { alc269_laptop_mixer }, |
| 13914 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13915 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13916 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13917 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13918 | .dac_nids = alc269_dac_nids, |
| 13919 | .hp_nid = 0x03, |
| 13920 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13921 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13922 | .unsol_event = alc269_laptop_unsol_event, |
| 13923 | .setup = alc269_laptop_amic_setup, |
| 13924 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13925 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13926 | [ALC269_DMIC] = { |
| 13927 | .mixers = { alc269_laptop_mixer }, |
| 13928 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13929 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13930 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13931 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13932 | .dac_nids = alc269_dac_nids, |
| 13933 | .hp_nid = 0x03, |
| 13934 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13935 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13936 | .unsol_event = alc269_laptop_unsol_event, |
| 13937 | .setup = alc269_laptop_dmic_setup, |
| 13938 | .init_hook = alc269_laptop_inithook, |
| 13939 | }, |
| 13940 | [ALC269VB_AMIC] = { |
| 13941 | .mixers = { alc269vb_laptop_mixer }, |
| 13942 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 13943 | .init_verbs = { alc269vb_init_verbs, |
| 13944 | alc269vb_laptop_amic_init_verbs }, |
| 13945 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13946 | .dac_nids = alc269_dac_nids, |
| 13947 | .hp_nid = 0x03, |
| 13948 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13949 | .channel_mode = alc269_modes, |
| 13950 | .unsol_event = alc269_laptop_unsol_event, |
| 13951 | .setup = alc269_laptop_amic_setup, |
| 13952 | .init_hook = alc269_laptop_inithook, |
| 13953 | }, |
| 13954 | [ALC269VB_DMIC] = { |
| 13955 | .mixers = { alc269vb_laptop_mixer }, |
| 13956 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 13957 | .init_verbs = { alc269vb_init_verbs, |
| 13958 | alc269vb_laptop_dmic_init_verbs }, |
| 13959 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13960 | .dac_nids = alc269_dac_nids, |
| 13961 | .hp_nid = 0x03, |
| 13962 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13963 | .channel_mode = alc269_modes, |
| 13964 | .unsol_event = alc269_laptop_unsol_event, |
| 13965 | .setup = alc269vb_laptop_dmic_setup, |
| 13966 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13967 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13968 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13969 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13970 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13971 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13972 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13973 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13974 | .dac_nids = alc269_dac_nids, |
| 13975 | .hp_nid = 0x03, |
| 13976 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13977 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13978 | .unsol_event = alc269_laptop_unsol_event, |
| 13979 | .setup = alc269_laptop_dmic_setup, |
| 13980 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13981 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13982 | [ALC269_LIFEBOOK] = { |
| 13983 | .mixers = { alc269_lifebook_mixer }, |
| 13984 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13985 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13986 | .dac_nids = alc269_dac_nids, |
| 13987 | .hp_nid = 0x03, |
| 13988 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13989 | .channel_mode = alc269_modes, |
| 13990 | .input_mux = &alc269_capture_source, |
| 13991 | .unsol_event = alc269_lifebook_unsol_event, |
| 13992 | .init_hook = alc269_lifebook_init_hook, |
| 13993 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13994 | }; |
| 13995 | |
| 13996 | static int patch_alc269(struct hda_codec *codec) |
| 13997 | { |
| 13998 | struct alc_spec *spec; |
| 13999 | int board_config; |
| 14000 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14001 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14002 | |
| 14003 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14004 | if (spec == NULL) |
| 14005 | return -ENOMEM; |
| 14006 | |
| 14007 | codec->spec = spec; |
| 14008 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 14009 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 14010 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14011 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
| 14012 | kfree(codec->chip_name); |
| 14013 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 14014 | if (!codec->chip_name) { |
| 14015 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14016 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 14017 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14018 | is_alc269vb = 1; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14019 | } |
| 14020 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14021 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14022 | alc269_models, |
| 14023 | alc269_cfg_tbl); |
| 14024 | |
| 14025 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14026 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14027 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14028 | board_config = ALC269_AUTO; |
| 14029 | } |
| 14030 | |
| 14031 | if (board_config == ALC269_AUTO) { |
| 14032 | /* automatic parse from the BIOS config */ |
| 14033 | err = alc269_parse_auto_config(codec); |
| 14034 | if (err < 0) { |
| 14035 | alc_free(codec); |
| 14036 | return err; |
| 14037 | } else if (!err) { |
| 14038 | printk(KERN_INFO |
| 14039 | "hda_codec: Cannot set up configuration " |
| 14040 | "from BIOS. Using base mode...\n"); |
| 14041 | board_config = ALC269_BASIC; |
| 14042 | } |
| 14043 | } |
| 14044 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14045 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14046 | if (err < 0) { |
| 14047 | alc_free(codec); |
| 14048 | return err; |
| 14049 | } |
| 14050 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14051 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14052 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14053 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14054 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14055 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14056 | * fix the sample rate of analog I/O to 44.1kHz |
| 14057 | */ |
| 14058 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14059 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 14060 | } else { |
| 14061 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14062 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14063 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14064 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14065 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14066 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14067 | if (!is_alc269vb) { |
| 14068 | spec->adc_nids = alc269_adc_nids; |
| 14069 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14070 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14071 | } else { |
| 14072 | spec->adc_nids = alc269vb_adc_nids; |
| 14073 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14074 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14075 | } |
| 14076 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14077 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14078 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14079 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14080 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14081 | spec->vmaster_nid = 0x02; |
| 14082 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14083 | codec->patch_ops = alc_patch_ops; |
| 14084 | if (board_config == ALC269_AUTO) |
| 14085 | spec->init_hook = alc269_auto_init; |
| 14086 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14087 | if (!spec->loopback.amplist) |
| 14088 | spec->loopback.amplist = alc269_loopbacks; |
| 14089 | #endif |
| 14090 | |
| 14091 | return 0; |
| 14092 | } |
| 14093 | |
| 14094 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14095 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14096 | */ |
| 14097 | |
| 14098 | /* |
| 14099 | * set the path ways for 2 channel output |
| 14100 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14101 | */ |
| 14102 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14103 | /* set pin widget 1Ah (line in) for input */ |
| 14104 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14105 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14106 | * the vref |
| 14107 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14108 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14109 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14110 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14111 | #if 0 |
| 14112 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14113 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14114 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14115 | { } /* end */ |
| 14116 | }; |
| 14117 | /* |
| 14118 | * 6ch mode |
| 14119 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14120 | */ |
| 14121 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14122 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14123 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14124 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14125 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14126 | |
| 14127 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14128 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14129 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14130 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14131 | #if 0 |
| 14132 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14133 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14134 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14135 | { } /* end */ |
| 14136 | }; |
| 14137 | |
| 14138 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14139 | { 2, alc861_threestack_ch2_init }, |
| 14140 | { 6, alc861_threestack_ch6_init }, |
| 14141 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14142 | /* Set mic1 as input and unmute the mixer */ |
| 14143 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14144 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14145 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14146 | { } /* end */ |
| 14147 | }; |
| 14148 | /* Set mic1 as output and mute mixer */ |
| 14149 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14150 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14151 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14152 | { } /* end */ |
| 14153 | }; |
| 14154 | |
| 14155 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14156 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14157 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14158 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14159 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14160 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14161 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14162 | /* set pin widget 1Ah (line in) for input */ |
| 14163 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14164 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14165 | * the vref |
| 14166 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14167 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14168 | |
| 14169 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14170 | #if 0 |
| 14171 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14172 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14173 | #endif |
| 14174 | { } /* end */ |
| 14175 | }; |
| 14176 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14177 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14178 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14179 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14180 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14181 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14182 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14183 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14184 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14185 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14186 | |
| 14187 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14188 | #if 0 |
| 14189 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14190 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14191 | #endif |
| 14192 | { } /* end */ |
| 14193 | }; |
| 14194 | |
| 14195 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14196 | { 2, alc861_asus_ch2_init }, |
| 14197 | { 6, alc861_asus_ch6_init }, |
| 14198 | }; |
| 14199 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14200 | /* patch-ALC861 */ |
| 14201 | |
| 14202 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14203 | /* output mixer control */ |
| 14204 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14205 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14206 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14207 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14208 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14209 | |
| 14210 | /*Input mixer control */ |
| 14211 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14212 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14213 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14214 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14215 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14216 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14219 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14220 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14222 | { } /* end */ |
| 14223 | }; |
| 14224 | |
| 14225 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14226 | /* output mixer control */ |
| 14227 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14228 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14229 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14230 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14231 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14232 | |
| 14233 | /* Input mixer control */ |
| 14234 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14235 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14236 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14237 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14238 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14239 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14240 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14241 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14242 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14243 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14245 | { |
| 14246 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14247 | .name = "Channel Mode", |
| 14248 | .info = alc_ch_mode_info, |
| 14249 | .get = alc_ch_mode_get, |
| 14250 | .put = alc_ch_mode_put, |
| 14251 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14252 | }, |
| 14253 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14254 | }; |
| 14255 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14256 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14257 | /* output mixer control */ |
| 14258 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14259 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14260 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14261 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14262 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14263 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14264 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14265 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14266 | /* output mixer control */ |
| 14267 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14268 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14269 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14270 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14271 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14272 | |
| 14273 | /* Input mixer control */ |
| 14274 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14275 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14276 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14277 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14278 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14279 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14282 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14283 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14284 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14285 | { |
| 14286 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14287 | .name = "Channel Mode", |
| 14288 | .info = alc_ch_mode_info, |
| 14289 | .get = alc_ch_mode_get, |
| 14290 | .put = alc_ch_mode_put, |
| 14291 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14292 | }, |
| 14293 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14294 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14295 | |
| 14296 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14297 | /* output mixer control */ |
| 14298 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14299 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14300 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14301 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14302 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14303 | |
| 14304 | /* Input mixer control */ |
| 14305 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14306 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14307 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14308 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14309 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14310 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14311 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14312 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14313 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14314 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14315 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14316 | { |
| 14317 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14318 | .name = "Channel Mode", |
| 14319 | .info = alc_ch_mode_info, |
| 14320 | .get = alc_ch_mode_get, |
| 14321 | .put = alc_ch_mode_put, |
| 14322 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14323 | }, |
| 14324 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14325 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14326 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14327 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14328 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14329 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14330 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14331 | { } |
| 14332 | }; |
| 14333 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14334 | /* |
| 14335 | * generic initialization of ADC, input mixers and output mixers |
| 14336 | */ |
| 14337 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14338 | /* |
| 14339 | * Unmute ADC0 and set the default input to mic-in |
| 14340 | */ |
| 14341 | /* port-A for surround (rear panel) */ |
| 14342 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14343 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14344 | /* port-B for mic-in (rear panel) with vref */ |
| 14345 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14346 | /* port-C for line-in (rear panel) */ |
| 14347 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14348 | /* port-D for Front */ |
| 14349 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14350 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14351 | /* port-E for HP out (front panel) */ |
| 14352 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14353 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14354 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14355 | /* port-F for mic-in (front panel) with vref */ |
| 14356 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14357 | /* port-G for CLFE (rear panel) */ |
| 14358 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14359 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14360 | /* port-H for side (rear panel) */ |
| 14361 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14362 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14363 | /* CD-in */ |
| 14364 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14365 | /* route front mic to ADC1*/ |
| 14366 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14367 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14368 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14369 | /* Unmute DAC0~3 & spdif out*/ |
| 14370 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14371 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14372 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14373 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14374 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14375 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14376 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14377 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14378 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14379 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14380 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14381 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14382 | /* Unmute Stereo Mixer 15 */ |
| 14383 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14384 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14385 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14386 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14387 | |
| 14388 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14389 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14390 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14391 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14392 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14393 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14394 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14395 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14396 | /* hp used DAC 3 (Front) */ |
| 14397 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14398 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14399 | |
| 14400 | { } |
| 14401 | }; |
| 14402 | |
| 14403 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14404 | /* |
| 14405 | * Unmute ADC0 and set the default input to mic-in |
| 14406 | */ |
| 14407 | /* port-A for surround (rear panel) */ |
| 14408 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14409 | /* port-B for mic-in (rear panel) with vref */ |
| 14410 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14411 | /* port-C for line-in (rear panel) */ |
| 14412 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14413 | /* port-D for Front */ |
| 14414 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14415 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14416 | /* port-E for HP out (front panel) */ |
| 14417 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14418 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14419 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14420 | /* port-F for mic-in (front panel) with vref */ |
| 14421 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14422 | /* port-G for CLFE (rear panel) */ |
| 14423 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14424 | /* port-H for side (rear panel) */ |
| 14425 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14426 | /* CD-in */ |
| 14427 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14428 | /* route front mic to ADC1*/ |
| 14429 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14430 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14431 | /* Unmute DAC0~3 & spdif out*/ |
| 14432 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14433 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14434 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14435 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14437 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14438 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14439 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14440 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14441 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14442 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14444 | /* Unmute Stereo Mixer 15 */ |
| 14445 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14446 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14447 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14449 | |
| 14450 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14451 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14452 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14453 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14454 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14455 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14456 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14457 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14458 | /* hp used DAC 3 (Front) */ |
| 14459 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14460 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14461 | { } |
| 14462 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14463 | |
| 14464 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14465 | /* |
| 14466 | * Unmute ADC0 and set the default input to mic-in |
| 14467 | */ |
| 14468 | /* port-A for surround (rear panel) */ |
| 14469 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14470 | /* port-B for mic-in (rear panel) with vref */ |
| 14471 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14472 | /* port-C for line-in (rear panel) */ |
| 14473 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14474 | /* port-D for Front */ |
| 14475 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14476 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14477 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14478 | /* this has to be set to VREF80 */ |
| 14479 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14480 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14481 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14482 | /* port-F for mic-in (front panel) with vref */ |
| 14483 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14484 | /* port-G for CLFE (rear panel) */ |
| 14485 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14486 | /* port-H for side (rear panel) */ |
| 14487 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14488 | /* CD-in */ |
| 14489 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14490 | /* route front mic to ADC1*/ |
| 14491 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14492 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14493 | /* Unmute DAC0~3 & spdif out*/ |
| 14494 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14495 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14496 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14497 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14499 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14500 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14501 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14502 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14503 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14504 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14505 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14506 | /* Unmute Stereo Mixer 15 */ |
| 14507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14508 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14509 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14510 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14511 | |
| 14512 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14513 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14514 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14515 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14516 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14517 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14518 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14519 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14520 | /* hp used DAC 3 (Front) */ |
| 14521 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14522 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14523 | { } |
| 14524 | }; |
| 14525 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14526 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14527 | /* |
| 14528 | * Unmute ADC0 and set the default input to mic-in |
| 14529 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14530 | /* port-A for surround (rear panel) |
| 14531 | * according to codec#0 this is the HP jack |
| 14532 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14533 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14534 | /* route front PCM to HP */ |
| 14535 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14536 | /* port-B for mic-in (rear panel) with vref */ |
| 14537 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14538 | /* port-C for line-in (rear panel) */ |
| 14539 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14540 | /* port-D for Front */ |
| 14541 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14542 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14543 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14544 | /* this has to be set to VREF80 */ |
| 14545 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14546 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14547 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14548 | /* port-F for mic-in (front panel) with vref */ |
| 14549 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14550 | /* port-G for CLFE (rear panel) */ |
| 14551 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14552 | /* port-H for side (rear panel) */ |
| 14553 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14554 | /* CD-in */ |
| 14555 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14556 | /* route front mic to ADC1*/ |
| 14557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14559 | /* Unmute DAC0~3 & spdif out*/ |
| 14560 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14561 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14562 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14563 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14565 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14566 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14567 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14568 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14569 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14570 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14571 | /* Unmute Stereo Mixer 15 */ |
| 14572 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14573 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14575 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14576 | |
| 14577 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14579 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14581 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14583 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14584 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14585 | /* hp used DAC 3 (Front) */ |
| 14586 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14587 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14588 | { } |
| 14589 | }; |
| 14590 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14591 | /* additional init verbs for ASUS laptops */ |
| 14592 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14593 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14594 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14595 | { } |
| 14596 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14597 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14598 | /* |
| 14599 | * generic initialization of ADC, input mixers and output mixers |
| 14600 | */ |
| 14601 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14602 | /* |
| 14603 | * Unmute ADC0 and set the default input to mic-in |
| 14604 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14605 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14606 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14607 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14608 | /* Unmute DAC0~3 & spdif out*/ |
| 14609 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14610 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14611 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14612 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14614 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14615 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14616 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14617 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14618 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14619 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14621 | /* Unmute Stereo Mixer 15 */ |
| 14622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14626 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14627 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14629 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14635 | |
| 14636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14638 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14639 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14640 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14641 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14642 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14643 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14644 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14645 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14646 | |
| 14647 | { } |
| 14648 | }; |
| 14649 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14650 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14651 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14652 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14653 | { } |
| 14654 | }; |
| 14655 | |
| 14656 | /* toggle speaker-output according to the hp-jack state */ |
| 14657 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14658 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14659 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14660 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14661 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14662 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14663 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14664 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14665 | } |
| 14666 | |
| 14667 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14668 | unsigned int res) |
| 14669 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14670 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14671 | alc861_toshiba_automute(codec); |
| 14672 | } |
| 14673 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14674 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14675 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14676 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14677 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14678 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14679 | |
| 14680 | |
| 14681 | #define ALC861_DIGOUT_NID 0x07 |
| 14682 | |
| 14683 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14684 | { 8, NULL } |
| 14685 | }; |
| 14686 | |
| 14687 | static hda_nid_t alc861_dac_nids[4] = { |
| 14688 | /* front, surround, clfe, side */ |
| 14689 | 0x03, 0x06, 0x05, 0x04 |
| 14690 | }; |
| 14691 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14692 | static hda_nid_t alc660_dac_nids[3] = { |
| 14693 | /* front, clfe, surround */ |
| 14694 | 0x03, 0x05, 0x06 |
| 14695 | }; |
| 14696 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14697 | static hda_nid_t alc861_adc_nids[1] = { |
| 14698 | /* ADC0-2 */ |
| 14699 | 0x08, |
| 14700 | }; |
| 14701 | |
| 14702 | static struct hda_input_mux alc861_capture_source = { |
| 14703 | .num_items = 5, |
| 14704 | .items = { |
| 14705 | { "Mic", 0x0 }, |
| 14706 | { "Front Mic", 0x3 }, |
| 14707 | { "Line", 0x1 }, |
| 14708 | { "CD", 0x4 }, |
| 14709 | { "Mixer", 0x5 }, |
| 14710 | }, |
| 14711 | }; |
| 14712 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14713 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14714 | { |
| 14715 | struct alc_spec *spec = codec->spec; |
| 14716 | hda_nid_t mix, srcs[5]; |
| 14717 | int i, j, num; |
| 14718 | |
| 14719 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14720 | return 0; |
| 14721 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14722 | if (num < 0) |
| 14723 | return 0; |
| 14724 | for (i = 0; i < num; i++) { |
| 14725 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14726 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14727 | if (type != AC_WID_AUD_OUT) |
| 14728 | continue; |
| 14729 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14730 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14731 | break; |
| 14732 | if (j >= spec->multiout.num_dacs) |
| 14733 | return srcs[i]; |
| 14734 | } |
| 14735 | return 0; |
| 14736 | } |
| 14737 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14738 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14739 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14740 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14741 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14742 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14743 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14744 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14745 | |
| 14746 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14747 | for (i = 0; i < cfg->line_outs; i++) { |
| 14748 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14749 | dac = alc861_look_for_dac(codec, nid); |
| 14750 | if (!dac) |
| 14751 | continue; |
| 14752 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14753 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14754 | return 0; |
| 14755 | } |
| 14756 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14757 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14758 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14759 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 14760 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14761 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14762 | } |
| 14763 | |
| 14764 | /* add playback controls from the parsed DAC table */ |
| 14765 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14766 | const struct auto_pin_cfg *cfg) |
| 14767 | { |
| 14768 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14769 | static const char *chname[4] = { |
| 14770 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14771 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14772 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14773 | int i, err; |
| 14774 | |
| 14775 | if (cfg->line_outs == 1) { |
| 14776 | const char *pfx = NULL; |
| 14777 | if (!cfg->hp_outs) |
| 14778 | pfx = "Master"; |
| 14779 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14780 | pfx = "Speaker"; |
| 14781 | if (pfx) { |
| 14782 | nid = spec->multiout.dac_nids[0]; |
| 14783 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14784 | } |
| 14785 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14786 | |
| 14787 | for (i = 0; i < cfg->line_outs; i++) { |
| 14788 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14789 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14790 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14791 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14792 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14793 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14794 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14795 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14796 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14797 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14798 | return err; |
| 14799 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14800 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14801 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14802 | return err; |
| 14803 | } |
| 14804 | } |
| 14805 | return 0; |
| 14806 | } |
| 14807 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14808 | 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] | 14809 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14810 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14811 | int err; |
| 14812 | hda_nid_t nid; |
| 14813 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14814 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14815 | return 0; |
| 14816 | |
| 14817 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14818 | nid = alc861_look_for_dac(codec, pin); |
| 14819 | if (nid) { |
| 14820 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14821 | if (err < 0) |
| 14822 | return err; |
| 14823 | spec->multiout.hp_nid = nid; |
| 14824 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14825 | } |
| 14826 | return 0; |
| 14827 | } |
| 14828 | |
| 14829 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14830 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14831 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14832 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14833 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14834 | } |
| 14835 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14836 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14837 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14838 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14839 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14840 | hda_nid_t mix, srcs[5]; |
| 14841 | int i, num; |
| 14842 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14843 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14844 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14845 | 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] | 14846 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14847 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14848 | return; |
| 14849 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14850 | if (num < 0) |
| 14851 | return; |
| 14852 | for (i = 0; i < num; i++) { |
| 14853 | unsigned int mute; |
| 14854 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14855 | mute = AMP_IN_UNMUTE(i); |
| 14856 | else |
| 14857 | mute = AMP_IN_MUTE(i); |
| 14858 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14859 | mute); |
| 14860 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14861 | } |
| 14862 | |
| 14863 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14864 | { |
| 14865 | struct alc_spec *spec = codec->spec; |
| 14866 | int i; |
| 14867 | |
| 14868 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14869 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14870 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14871 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14872 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14873 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14874 | } |
| 14875 | } |
| 14876 | |
| 14877 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14878 | { |
| 14879 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14880 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14881 | if (spec->autocfg.hp_outs) |
| 14882 | alc861_auto_set_output_and_unmute(codec, |
| 14883 | spec->autocfg.hp_pins[0], |
| 14884 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14885 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 14886 | if (spec->autocfg.speaker_outs) |
| 14887 | alc861_auto_set_output_and_unmute(codec, |
| 14888 | spec->autocfg.speaker_pins[0], |
| 14889 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14890 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14891 | } |
| 14892 | |
| 14893 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14894 | { |
| 14895 | struct alc_spec *spec = codec->spec; |
| 14896 | int i; |
| 14897 | |
| 14898 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14899 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14900 | if (nid >= 0x0c && nid <= 0x11) |
| 14901 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14902 | } |
| 14903 | } |
| 14904 | |
| 14905 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14906 | /* return 1 if successful, 0 if the proper config is not found, |
| 14907 | * or a negative error code |
| 14908 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14909 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14910 | { |
| 14911 | struct alc_spec *spec = codec->spec; |
| 14912 | int err; |
| 14913 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14914 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14915 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14916 | alc861_ignore); |
| 14917 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14918 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14919 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14920 | return 0; /* can't find valid BIOS pin config */ |
| 14921 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14922 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14923 | if (err < 0) |
| 14924 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14925 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14926 | if (err < 0) |
| 14927 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14928 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14929 | if (err < 0) |
| 14930 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14931 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14932 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14933 | return err; |
| 14934 | |
| 14935 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14936 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14937 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14938 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14939 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14940 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14941 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14942 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14943 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14944 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14945 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14946 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14947 | |
| 14948 | spec->adc_nids = alc861_adc_nids; |
| 14949 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14950 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14951 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14952 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14953 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14954 | return 1; |
| 14955 | } |
| 14956 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14957 | /* additional initialization for auto-configuration model */ |
| 14958 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14959 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14960 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14961 | alc861_auto_init_multi_out(codec); |
| 14962 | alc861_auto_init_hp_out(codec); |
| 14963 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14964 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14965 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14966 | } |
| 14967 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14968 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14969 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14970 | { 0x15, HDA_INPUT, 0 }, |
| 14971 | { 0x15, HDA_INPUT, 1 }, |
| 14972 | { 0x15, HDA_INPUT, 2 }, |
| 14973 | { 0x15, HDA_INPUT, 3 }, |
| 14974 | { } /* end */ |
| 14975 | }; |
| 14976 | #endif |
| 14977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14978 | |
| 14979 | /* |
| 14980 | * configuration and preset |
| 14981 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14982 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14983 | [ALC861_3ST] = "3stack", |
| 14984 | [ALC660_3ST] = "3stack-660", |
| 14985 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14986 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14987 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14988 | [ALC861_TOSHIBA] = "toshiba", |
| 14989 | [ALC861_ASUS] = "asus", |
| 14990 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14991 | [ALC861_AUTO] = "auto", |
| 14992 | }; |
| 14993 | |
| 14994 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14995 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14996 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14997 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14998 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14999 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15000 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15001 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15002 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15003 | * Any other models that need this preset? |
| 15004 | */ |
| 15005 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15006 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15007 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15008 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15009 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15010 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15011 | /* FIXME: the below seems conflict */ |
| 15012 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15013 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15014 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15015 | {} |
| 15016 | }; |
| 15017 | |
| 15018 | static struct alc_config_preset alc861_presets[] = { |
| 15019 | [ALC861_3ST] = { |
| 15020 | .mixers = { alc861_3ST_mixer }, |
| 15021 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15022 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15023 | .dac_nids = alc861_dac_nids, |
| 15024 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15025 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15026 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15027 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15028 | .adc_nids = alc861_adc_nids, |
| 15029 | .input_mux = &alc861_capture_source, |
| 15030 | }, |
| 15031 | [ALC861_3ST_DIG] = { |
| 15032 | .mixers = { alc861_base_mixer }, |
| 15033 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15034 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15035 | .dac_nids = alc861_dac_nids, |
| 15036 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15037 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15038 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15039 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15040 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15041 | .adc_nids = alc861_adc_nids, |
| 15042 | .input_mux = &alc861_capture_source, |
| 15043 | }, |
| 15044 | [ALC861_6ST_DIG] = { |
| 15045 | .mixers = { alc861_base_mixer }, |
| 15046 | .init_verbs = { alc861_base_init_verbs }, |
| 15047 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15048 | .dac_nids = alc861_dac_nids, |
| 15049 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15050 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15051 | .channel_mode = alc861_8ch_modes, |
| 15052 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15053 | .adc_nids = alc861_adc_nids, |
| 15054 | .input_mux = &alc861_capture_source, |
| 15055 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15056 | [ALC660_3ST] = { |
| 15057 | .mixers = { alc861_3ST_mixer }, |
| 15058 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15059 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15060 | .dac_nids = alc660_dac_nids, |
| 15061 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15062 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15063 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15064 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15065 | .adc_nids = alc861_adc_nids, |
| 15066 | .input_mux = &alc861_capture_source, |
| 15067 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15068 | [ALC861_UNIWILL_M31] = { |
| 15069 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15070 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15071 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15072 | .dac_nids = alc861_dac_nids, |
| 15073 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15074 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15075 | .channel_mode = alc861_uniwill_m31_modes, |
| 15076 | .need_dac_fix = 1, |
| 15077 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15078 | .adc_nids = alc861_adc_nids, |
| 15079 | .input_mux = &alc861_capture_source, |
| 15080 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15081 | [ALC861_TOSHIBA] = { |
| 15082 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15083 | .init_verbs = { alc861_base_init_verbs, |
| 15084 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15085 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15086 | .dac_nids = alc861_dac_nids, |
| 15087 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15088 | .channel_mode = alc883_3ST_2ch_modes, |
| 15089 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15090 | .adc_nids = alc861_adc_nids, |
| 15091 | .input_mux = &alc861_capture_source, |
| 15092 | .unsol_event = alc861_toshiba_unsol_event, |
| 15093 | .init_hook = alc861_toshiba_automute, |
| 15094 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15095 | [ALC861_ASUS] = { |
| 15096 | .mixers = { alc861_asus_mixer }, |
| 15097 | .init_verbs = { alc861_asus_init_verbs }, |
| 15098 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15099 | .dac_nids = alc861_dac_nids, |
| 15100 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15101 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15102 | .channel_mode = alc861_asus_modes, |
| 15103 | .need_dac_fix = 1, |
| 15104 | .hp_nid = 0x06, |
| 15105 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15106 | .adc_nids = alc861_adc_nids, |
| 15107 | .input_mux = &alc861_capture_source, |
| 15108 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15109 | [ALC861_ASUS_LAPTOP] = { |
| 15110 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15111 | .init_verbs = { alc861_asus_init_verbs, |
| 15112 | alc861_asus_laptop_init_verbs }, |
| 15113 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15114 | .dac_nids = alc861_dac_nids, |
| 15115 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15116 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15117 | .channel_mode = alc883_3ST_2ch_modes, |
| 15118 | .need_dac_fix = 1, |
| 15119 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15120 | .adc_nids = alc861_adc_nids, |
| 15121 | .input_mux = &alc861_capture_source, |
| 15122 | }, |
| 15123 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15124 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15125 | /* Pin config fixes */ |
| 15126 | enum { |
| 15127 | PINFIX_FSC_AMILO_PI1505, |
| 15128 | }; |
| 15129 | |
| 15130 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15131 | { 0x0b, 0x0221101f }, /* HP */ |
| 15132 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15133 | { } |
| 15134 | }; |
| 15135 | |
| 15136 | static const struct alc_fixup alc861_fixups[] = { |
| 15137 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15138 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15139 | }, |
| 15140 | }; |
| 15141 | |
| 15142 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15143 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15144 | {} |
| 15145 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15146 | |
| 15147 | static int patch_alc861(struct hda_codec *codec) |
| 15148 | { |
| 15149 | struct alc_spec *spec; |
| 15150 | int board_config; |
| 15151 | int err; |
| 15152 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15153 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15154 | if (spec == NULL) |
| 15155 | return -ENOMEM; |
| 15156 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15157 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15158 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15159 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15160 | alc861_models, |
| 15161 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15162 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15163 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15164 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15165 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15166 | board_config = ALC861_AUTO; |
| 15167 | } |
| 15168 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15169 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); |
| 15170 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15171 | if (board_config == ALC861_AUTO) { |
| 15172 | /* automatic parse from the BIOS config */ |
| 15173 | err = alc861_parse_auto_config(codec); |
| 15174 | if (err < 0) { |
| 15175 | alc_free(codec); |
| 15176 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15177 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15178 | printk(KERN_INFO |
| 15179 | "hda_codec: Cannot set up configuration " |
| 15180 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15181 | board_config = ALC861_3ST_DIG; |
| 15182 | } |
| 15183 | } |
| 15184 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15185 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15186 | if (err < 0) { |
| 15187 | alc_free(codec); |
| 15188 | return err; |
| 15189 | } |
| 15190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15191 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15192 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15193 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15194 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15195 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15196 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15197 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15198 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15199 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15200 | if (!spec->cap_mixer) |
| 15201 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15202 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15203 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15204 | spec->vmaster_nid = 0x03; |
| 15205 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15206 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15207 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15208 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15209 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15210 | spec->power_hook = alc_power_eapd; |
| 15211 | #endif |
| 15212 | } |
| 15213 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15214 | if (!spec->loopback.amplist) |
| 15215 | spec->loopback.amplist = alc861_loopbacks; |
| 15216 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15217 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15218 | return 0; |
| 15219 | } |
| 15220 | |
| 15221 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15222 | * ALC861-VD support |
| 15223 | * |
| 15224 | * Based on ALC882 |
| 15225 | * |
| 15226 | * In addition, an independent DAC |
| 15227 | */ |
| 15228 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15229 | |
| 15230 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15231 | /* front, surr, clfe, side surr */ |
| 15232 | 0x02, 0x03, 0x04, 0x05 |
| 15233 | }; |
| 15234 | |
| 15235 | /* dac_nids for ALC660vd are in a different order - according to |
| 15236 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15237 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15238 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15239 | * - and it is the same as in 861vd. |
| 15240 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15241 | */ |
| 15242 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15243 | /* front, rear, clfe, rear_surr */ |
| 15244 | 0x02, 0x04, 0x03 |
| 15245 | }; |
| 15246 | |
| 15247 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15248 | /* ADC0 */ |
| 15249 | 0x09, |
| 15250 | }; |
| 15251 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15252 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15253 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15254 | /* input MUX */ |
| 15255 | /* FIXME: should be a matrix-type input source selection */ |
| 15256 | static struct hda_input_mux alc861vd_capture_source = { |
| 15257 | .num_items = 4, |
| 15258 | .items = { |
| 15259 | { "Mic", 0x0 }, |
| 15260 | { "Front Mic", 0x1 }, |
| 15261 | { "Line", 0x2 }, |
| 15262 | { "CD", 0x4 }, |
| 15263 | }, |
| 15264 | }; |
| 15265 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15266 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15267 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15268 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15269 | { "Ext Mic", 0x0 }, |
| 15270 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15271 | }, |
| 15272 | }; |
| 15273 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15274 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15275 | .num_items = 2, |
| 15276 | .items = { |
| 15277 | { "Front Mic", 0x0 }, |
| 15278 | { "ATAPI Mic", 0x1 }, |
| 15279 | }, |
| 15280 | }; |
| 15281 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15282 | /* |
| 15283 | * 2ch mode |
| 15284 | */ |
| 15285 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15286 | { 2, NULL } |
| 15287 | }; |
| 15288 | |
| 15289 | /* |
| 15290 | * 6ch mode |
| 15291 | */ |
| 15292 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15293 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15294 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15295 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15296 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15297 | { } /* end */ |
| 15298 | }; |
| 15299 | |
| 15300 | /* |
| 15301 | * 8ch mode |
| 15302 | */ |
| 15303 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15304 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15305 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15306 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15307 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15308 | { } /* end */ |
| 15309 | }; |
| 15310 | |
| 15311 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15312 | { 6, alc861vd_6stack_ch6_init }, |
| 15313 | { 8, alc861vd_6stack_ch8_init }, |
| 15314 | }; |
| 15315 | |
| 15316 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15317 | { |
| 15318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15319 | .name = "Channel Mode", |
| 15320 | .info = alc_ch_mode_info, |
| 15321 | .get = alc_ch_mode_get, |
| 15322 | .put = alc_ch_mode_put, |
| 15323 | }, |
| 15324 | { } /* end */ |
| 15325 | }; |
| 15326 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15327 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15328 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15329 | */ |
| 15330 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15331 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15332 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15333 | |
| 15334 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15335 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15336 | |
| 15337 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15338 | HDA_OUTPUT), |
| 15339 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15340 | HDA_OUTPUT), |
| 15341 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15342 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15343 | |
| 15344 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15345 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15346 | |
| 15347 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15348 | |
| 15349 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15350 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15351 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15352 | |
| 15353 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15354 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15355 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15356 | |
| 15357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15359 | |
| 15360 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15361 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15362 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15363 | { } /* end */ |
| 15364 | }; |
| 15365 | |
| 15366 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15367 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15368 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15369 | |
| 15370 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15371 | |
| 15372 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15373 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15374 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15375 | |
| 15376 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15377 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15378 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15379 | |
| 15380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15381 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15382 | |
| 15383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15384 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15385 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15386 | { } /* end */ |
| 15387 | }; |
| 15388 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15389 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15390 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15391 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15392 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15393 | |
| 15394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15395 | |
| 15396 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15397 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15398 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15399 | |
| 15400 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15401 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15402 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15403 | |
| 15404 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15405 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15406 | |
| 15407 | { } /* end */ |
| 15408 | }; |
| 15409 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15410 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15411 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15412 | */ |
| 15413 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15414 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15415 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15416 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15417 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15418 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15419 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15420 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15421 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15422 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15423 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15424 | { } /* end */ |
| 15425 | }; |
| 15426 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15427 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15428 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15429 | */ |
| 15430 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15431 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15432 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15433 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15434 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15436 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15437 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15438 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15439 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15440 | { } /* end */ |
| 15441 | }; |
| 15442 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15443 | /* |
| 15444 | * generic initialization of ADC, input mixers and output mixers |
| 15445 | */ |
| 15446 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15447 | /* |
| 15448 | * Unmute ADC0 and set the default input to mic-in |
| 15449 | */ |
| 15450 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15451 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15452 | |
| 15453 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15454 | * the analog-loopback mixer widget |
| 15455 | */ |
| 15456 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15457 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15458 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15459 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15460 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15461 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15462 | |
| 15463 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15464 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15465 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15466 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15468 | |
| 15469 | /* |
| 15470 | * Set up output mixers (0x02 - 0x05) |
| 15471 | */ |
| 15472 | /* set vol=0 to output mixers */ |
| 15473 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15474 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15475 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15476 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15477 | |
| 15478 | /* set up input amps for analog loopback */ |
| 15479 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15480 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15481 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15482 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15483 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15484 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15485 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15486 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15487 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15488 | |
| 15489 | { } |
| 15490 | }; |
| 15491 | |
| 15492 | /* |
| 15493 | * 3-stack pin configuration: |
| 15494 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15495 | */ |
| 15496 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15497 | /* |
| 15498 | * Set pin mode and muting |
| 15499 | */ |
| 15500 | /* set front pin widgets 0x14 for output */ |
| 15501 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15503 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15504 | |
| 15505 | /* Mic (rear) pin: input vref at 80% */ |
| 15506 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15507 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15508 | /* Front Mic pin: input vref at 80% */ |
| 15509 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15510 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15511 | /* Line In pin: input */ |
| 15512 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15513 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15514 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15515 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15516 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15517 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15518 | /* CD pin widget for input */ |
| 15519 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15520 | |
| 15521 | { } |
| 15522 | }; |
| 15523 | |
| 15524 | /* |
| 15525 | * 6-stack pin configuration: |
| 15526 | */ |
| 15527 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15528 | /* |
| 15529 | * Set pin mode and muting |
| 15530 | */ |
| 15531 | /* set front pin widgets 0x14 for output */ |
| 15532 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15533 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15534 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15535 | |
| 15536 | /* Rear Pin: output 1 (0x0d) */ |
| 15537 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15538 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15539 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15540 | /* CLFE Pin: output 2 (0x0e) */ |
| 15541 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15542 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15543 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15544 | /* Side Pin: output 3 (0x0f) */ |
| 15545 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15546 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15547 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15548 | |
| 15549 | /* Mic (rear) pin: input vref at 80% */ |
| 15550 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15551 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15552 | /* Front Mic pin: input vref at 80% */ |
| 15553 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15554 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15555 | /* Line In pin: input */ |
| 15556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15558 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15560 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15561 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15562 | /* CD pin widget for input */ |
| 15563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15564 | |
| 15565 | { } |
| 15566 | }; |
| 15567 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15568 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15569 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15570 | { } |
| 15571 | }; |
| 15572 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15573 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15574 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15575 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15576 | { } |
| 15577 | }; |
| 15578 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15579 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15583 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15584 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15585 | {} |
| 15586 | }; |
| 15587 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15588 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15589 | { |
| 15590 | unsigned int present; |
| 15591 | unsigned char bits; |
| 15592 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15593 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15594 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15595 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15596 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15597 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15598 | } |
| 15599 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15600 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15601 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15602 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15603 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15604 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15605 | } |
| 15606 | |
| 15607 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15608 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15609 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15610 | alc861vd_lenovo_mic_automute(codec); |
| 15611 | } |
| 15612 | |
| 15613 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15614 | unsigned int res) |
| 15615 | { |
| 15616 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15617 | case ALC880_MIC_EVENT: |
| 15618 | alc861vd_lenovo_mic_automute(codec); |
| 15619 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15620 | default: |
| 15621 | alc_automute_amp_unsol_event(codec, res); |
| 15622 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15623 | } |
| 15624 | } |
| 15625 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15626 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15627 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15628 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15629 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15630 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15631 | |
| 15632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15634 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15636 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15637 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15638 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15639 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15640 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15642 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15643 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15644 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15645 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15646 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15647 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15648 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15649 | |
| 15650 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15651 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15652 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15653 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15654 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15655 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15656 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15657 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15658 | |
| 15659 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15660 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15661 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15662 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15663 | |
| 15664 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15665 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15666 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15667 | |
| 15668 | { } /* end */ |
| 15669 | }; |
| 15670 | |
| 15671 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15672 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15673 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15674 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15675 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15676 | spec->autocfg.hp_pins[0] = 0x15; |
| 15677 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15678 | } |
| 15679 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15680 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15681 | #define alc861vd_loopbacks alc880_loopbacks |
| 15682 | #endif |
| 15683 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15684 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15685 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15686 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15687 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15688 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15689 | |
| 15690 | /* |
| 15691 | * configuration and preset |
| 15692 | */ |
| 15693 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15694 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15695 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15696 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15697 | [ALC861VD_3ST] = "3stack", |
| 15698 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15699 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15700 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15701 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15702 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15703 | [ALC861VD_AUTO] = "auto", |
| 15704 | }; |
| 15705 | |
| 15706 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15707 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15708 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15709 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15710 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15711 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15712 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15713 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15714 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15715 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15716 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15717 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15718 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15719 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15720 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15721 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15722 | {} |
| 15723 | }; |
| 15724 | |
| 15725 | static struct alc_config_preset alc861vd_presets[] = { |
| 15726 | [ALC660VD_3ST] = { |
| 15727 | .mixers = { alc861vd_3st_mixer }, |
| 15728 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15729 | alc861vd_3stack_init_verbs }, |
| 15730 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15731 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15732 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15733 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15734 | .input_mux = &alc861vd_capture_source, |
| 15735 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15736 | [ALC660VD_3ST_DIG] = { |
| 15737 | .mixers = { alc861vd_3st_mixer }, |
| 15738 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15739 | alc861vd_3stack_init_verbs }, |
| 15740 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15741 | .dac_nids = alc660vd_dac_nids, |
| 15742 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15743 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15744 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15745 | .input_mux = &alc861vd_capture_source, |
| 15746 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15747 | [ALC861VD_3ST] = { |
| 15748 | .mixers = { alc861vd_3st_mixer }, |
| 15749 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15750 | alc861vd_3stack_init_verbs }, |
| 15751 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15752 | .dac_nids = alc861vd_dac_nids, |
| 15753 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15754 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15755 | .input_mux = &alc861vd_capture_source, |
| 15756 | }, |
| 15757 | [ALC861VD_3ST_DIG] = { |
| 15758 | .mixers = { alc861vd_3st_mixer }, |
| 15759 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15760 | alc861vd_3stack_init_verbs }, |
| 15761 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15762 | .dac_nids = alc861vd_dac_nids, |
| 15763 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15764 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15765 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15766 | .input_mux = &alc861vd_capture_source, |
| 15767 | }, |
| 15768 | [ALC861VD_6ST_DIG] = { |
| 15769 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15770 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15771 | alc861vd_6stack_init_verbs }, |
| 15772 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15773 | .dac_nids = alc861vd_dac_nids, |
| 15774 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15775 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15776 | .channel_mode = alc861vd_6stack_modes, |
| 15777 | .input_mux = &alc861vd_capture_source, |
| 15778 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15779 | [ALC861VD_LENOVO] = { |
| 15780 | .mixers = { alc861vd_lenovo_mixer }, |
| 15781 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15782 | alc861vd_3stack_init_verbs, |
| 15783 | alc861vd_eapd_verbs, |
| 15784 | alc861vd_lenovo_unsol_verbs }, |
| 15785 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15786 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15787 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15788 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15789 | .input_mux = &alc861vd_capture_source, |
| 15790 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15791 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15792 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15793 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15794 | [ALC861VD_DALLAS] = { |
| 15795 | .mixers = { alc861vd_dallas_mixer }, |
| 15796 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15797 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15798 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15799 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15800 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15801 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15802 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15803 | .setup = alc861vd_dallas_setup, |
| 15804 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15805 | }, |
| 15806 | [ALC861VD_HP] = { |
| 15807 | .mixers = { alc861vd_hp_mixer }, |
| 15808 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15809 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15810 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15811 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15812 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15813 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15814 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15815 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15816 | .setup = alc861vd_dallas_setup, |
| 15817 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15818 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15819 | [ALC660VD_ASUS_V1S] = { |
| 15820 | .mixers = { alc861vd_lenovo_mixer }, |
| 15821 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15822 | alc861vd_3stack_init_verbs, |
| 15823 | alc861vd_eapd_verbs, |
| 15824 | alc861vd_lenovo_unsol_verbs }, |
| 15825 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15826 | .dac_nids = alc660vd_dac_nids, |
| 15827 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15828 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15829 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15830 | .input_mux = &alc861vd_capture_source, |
| 15831 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15832 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15833 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15834 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15835 | }; |
| 15836 | |
| 15837 | /* |
| 15838 | * BIOS auto configuration |
| 15839 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15840 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15841 | const struct auto_pin_cfg *cfg) |
| 15842 | { |
Takashi Iwai | 9c0afc8 | 2010-01-12 14:00:11 +0100 | [diff] [blame] | 15843 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15844 | } |
| 15845 | |
| 15846 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15847 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15848 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15849 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15850 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15851 | } |
| 15852 | |
| 15853 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15854 | { |
| 15855 | struct alc_spec *spec = codec->spec; |
| 15856 | int i; |
| 15857 | |
| 15858 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15859 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15860 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15861 | if (nid) |
| 15862 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15863 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15864 | } |
| 15865 | } |
| 15866 | |
| 15867 | |
| 15868 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15869 | { |
| 15870 | struct alc_spec *spec = codec->spec; |
| 15871 | hda_nid_t pin; |
| 15872 | |
| 15873 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15874 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15875 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15876 | pin = spec->autocfg.speaker_pins[0]; |
| 15877 | if (pin) |
| 15878 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15879 | } |
| 15880 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15881 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15882 | |
| 15883 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15884 | { |
| 15885 | struct alc_spec *spec = codec->spec; |
| 15886 | int i; |
| 15887 | |
| 15888 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15889 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15890 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15891 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15892 | if (nid != ALC861VD_PIN_CD_NID && |
| 15893 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15894 | snd_hda_codec_write(codec, nid, 0, |
| 15895 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15896 | AMP_OUT_MUTE); |
| 15897 | } |
| 15898 | } |
| 15899 | } |
| 15900 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15901 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15902 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15903 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15904 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15905 | |
| 15906 | /* add playback controls from the parsed DAC table */ |
| 15907 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15908 | * different NIDs for mute/unmute switch and volume control */ |
| 15909 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15910 | const struct auto_pin_cfg *cfg) |
| 15911 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15912 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15913 | hda_nid_t nid_v, nid_s; |
| 15914 | int i, err; |
| 15915 | |
| 15916 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15917 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15918 | continue; |
| 15919 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15920 | alc880_dac_to_idx( |
| 15921 | spec->multiout.dac_nids[i])); |
| 15922 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15923 | alc880_dac_to_idx( |
| 15924 | spec->multiout.dac_nids[i])); |
| 15925 | |
| 15926 | if (i == 2) { |
| 15927 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15928 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15929 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15930 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15931 | HDA_OUTPUT)); |
| 15932 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15933 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15934 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 15935 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15936 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15937 | HDA_OUTPUT)); |
| 15938 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15939 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15940 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15941 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15942 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15943 | HDA_INPUT)); |
| 15944 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15945 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15946 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 15947 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15948 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15949 | HDA_INPUT)); |
| 15950 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15951 | return err; |
| 15952 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15953 | const char *pfx; |
| 15954 | if (cfg->line_outs == 1 && |
| 15955 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15956 | if (!cfg->hp_pins) |
| 15957 | pfx = "Speaker"; |
| 15958 | else |
| 15959 | pfx = "PCM"; |
| 15960 | } else |
| 15961 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15962 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15963 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15964 | HDA_OUTPUT)); |
| 15965 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15966 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15967 | if (cfg->line_outs == 1 && |
| 15968 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15969 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15970 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15971 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15972 | HDA_INPUT)); |
| 15973 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15974 | return err; |
| 15975 | } |
| 15976 | } |
| 15977 | return 0; |
| 15978 | } |
| 15979 | |
| 15980 | /* add playback controls for speaker and HP outputs */ |
| 15981 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15982 | * different NIDs for mute/unmute switch and volume control */ |
| 15983 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15984 | hda_nid_t pin, const char *pfx) |
| 15985 | { |
| 15986 | hda_nid_t nid_v, nid_s; |
| 15987 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15988 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15989 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15990 | return 0; |
| 15991 | |
| 15992 | if (alc880_is_fixed_pin(pin)) { |
| 15993 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15994 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15995 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15996 | spec->multiout.hp_nid = nid_v; |
| 15997 | else |
| 15998 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15999 | /* control HP volume/switch on the output mixer amp */ |
| 16000 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16001 | alc880_fixed_pin_idx(pin)); |
| 16002 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16003 | alc880_fixed_pin_idx(pin)); |
| 16004 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16005 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16006 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16007 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16008 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16009 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16010 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16011 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16012 | return err; |
| 16013 | } else if (alc880_is_multi_pin(pin)) { |
| 16014 | /* set manual connection */ |
| 16015 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16016 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16017 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16018 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16019 | return err; |
| 16020 | } |
| 16021 | return 0; |
| 16022 | } |
| 16023 | |
| 16024 | /* parse the BIOS configuration and set up the alc_spec |
| 16025 | * return 1 if successful, 0 if the proper config is not found, |
| 16026 | * or a negative error code |
| 16027 | * Based on ALC880 version - had to change it to override |
| 16028 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16029 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16030 | { |
| 16031 | struct alc_spec *spec = codec->spec; |
| 16032 | int err; |
| 16033 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16034 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16035 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16036 | alc861vd_ignore); |
| 16037 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16038 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16039 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16040 | return 0; /* can't find valid BIOS pin config */ |
| 16041 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16042 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16043 | if (err < 0) |
| 16044 | return err; |
| 16045 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16046 | if (err < 0) |
| 16047 | return err; |
| 16048 | err = alc861vd_auto_create_extra_out(spec, |
| 16049 | spec->autocfg.speaker_pins[0], |
| 16050 | "Speaker"); |
| 16051 | if (err < 0) |
| 16052 | return err; |
| 16053 | err = alc861vd_auto_create_extra_out(spec, |
| 16054 | spec->autocfg.hp_pins[0], |
| 16055 | "Headphone"); |
| 16056 | if (err < 0) |
| 16057 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16058 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16059 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16060 | return err; |
| 16061 | |
| 16062 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16063 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16064 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16065 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16066 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16067 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16068 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16069 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16070 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16071 | |
| 16072 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16073 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16074 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16075 | err = alc_auto_add_mic_boost(codec); |
| 16076 | if (err < 0) |
| 16077 | return err; |
| 16078 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16079 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 16080 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16081 | return 1; |
| 16082 | } |
| 16083 | |
| 16084 | /* additional initialization for auto-configuration model */ |
| 16085 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16086 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16087 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16088 | alc861vd_auto_init_multi_out(codec); |
| 16089 | alc861vd_auto_init_hp_out(codec); |
| 16090 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16091 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16092 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16093 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16094 | } |
| 16095 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16096 | enum { |
| 16097 | ALC660VD_FIX_ASUS_GPIO1 |
| 16098 | }; |
| 16099 | |
| 16100 | /* reset GPIO1 */ |
| 16101 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16102 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16103 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16104 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16105 | { } |
| 16106 | }; |
| 16107 | |
| 16108 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16109 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16110 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16111 | }, |
| 16112 | }; |
| 16113 | |
| 16114 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16115 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16116 | {} |
| 16117 | }; |
| 16118 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16119 | static int patch_alc861vd(struct hda_codec *codec) |
| 16120 | { |
| 16121 | struct alc_spec *spec; |
| 16122 | int err, board_config; |
| 16123 | |
| 16124 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16125 | if (spec == NULL) |
| 16126 | return -ENOMEM; |
| 16127 | |
| 16128 | codec->spec = spec; |
| 16129 | |
| 16130 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16131 | alc861vd_models, |
| 16132 | alc861vd_cfg_tbl); |
| 16133 | |
| 16134 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16135 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16136 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16137 | board_config = ALC861VD_AUTO; |
| 16138 | } |
| 16139 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16140 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 16141 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16142 | if (board_config == ALC861VD_AUTO) { |
| 16143 | /* automatic parse from the BIOS config */ |
| 16144 | err = alc861vd_parse_auto_config(codec); |
| 16145 | if (err < 0) { |
| 16146 | alc_free(codec); |
| 16147 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16148 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16149 | printk(KERN_INFO |
| 16150 | "hda_codec: Cannot set up configuration " |
| 16151 | "from BIOS. Using base mode...\n"); |
| 16152 | board_config = ALC861VD_3ST; |
| 16153 | } |
| 16154 | } |
| 16155 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16156 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16157 | if (err < 0) { |
| 16158 | alc_free(codec); |
| 16159 | return err; |
| 16160 | } |
| 16161 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16162 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16163 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16164 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16165 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16166 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16167 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16168 | } |
| 16169 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16170 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16171 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16172 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16173 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16174 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16175 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16176 | if (!spec->adc_nids) { |
| 16177 | spec->adc_nids = alc861vd_adc_nids; |
| 16178 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16179 | } |
| 16180 | if (!spec->capsrc_nids) |
| 16181 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16182 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16183 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16184 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16185 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16186 | spec->vmaster_nid = 0x02; |
| 16187 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16188 | codec->patch_ops = alc_patch_ops; |
| 16189 | |
| 16190 | if (board_config == ALC861VD_AUTO) |
| 16191 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16192 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16193 | if (!spec->loopback.amplist) |
| 16194 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16195 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16196 | |
| 16197 | return 0; |
| 16198 | } |
| 16199 | |
| 16200 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16201 | * ALC662 support |
| 16202 | * |
| 16203 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16204 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16205 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16206 | * 6-channel independent captures. |
| 16207 | * |
| 16208 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16209 | * driver yet). |
| 16210 | */ |
| 16211 | #define ALC662_DIGOUT_NID 0x06 |
| 16212 | #define ALC662_DIGIN_NID 0x0a |
| 16213 | |
| 16214 | static hda_nid_t alc662_dac_nids[4] = { |
| 16215 | /* front, rear, clfe, rear_surr */ |
| 16216 | 0x02, 0x03, 0x04 |
| 16217 | }; |
| 16218 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16219 | static hda_nid_t alc272_dac_nids[2] = { |
| 16220 | 0x02, 0x03 |
| 16221 | }; |
| 16222 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16223 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16224 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16225 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16226 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16227 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16228 | static hda_nid_t alc272_adc_nids[1] = { |
| 16229 | /* ADC1-2 */ |
| 16230 | 0x08, |
| 16231 | }; |
| 16232 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16233 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16234 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16235 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16236 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16237 | /* input MUX */ |
| 16238 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16239 | static struct hda_input_mux alc662_capture_source = { |
| 16240 | .num_items = 4, |
| 16241 | .items = { |
| 16242 | { "Mic", 0x0 }, |
| 16243 | { "Front Mic", 0x1 }, |
| 16244 | { "Line", 0x2 }, |
| 16245 | { "CD", 0x4 }, |
| 16246 | }, |
| 16247 | }; |
| 16248 | |
| 16249 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16250 | .num_items = 2, |
| 16251 | .items = { |
| 16252 | { "Mic", 0x1 }, |
| 16253 | { "Line", 0x2 }, |
| 16254 | }, |
| 16255 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16256 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16257 | static struct hda_input_mux alc663_capture_source = { |
| 16258 | .num_items = 3, |
| 16259 | .items = { |
| 16260 | { "Mic", 0x0 }, |
| 16261 | { "Front Mic", 0x1 }, |
| 16262 | { "Line", 0x2 }, |
| 16263 | }, |
| 16264 | }; |
| 16265 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16266 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16267 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16268 | .num_items = 16, |
| 16269 | .items = { |
| 16270 | { "Autoselect Mic", 0x0 }, |
| 16271 | { "Internal Mic", 0x1 }, |
| 16272 | { "In-0x02", 0x2 }, |
| 16273 | { "In-0x03", 0x3 }, |
| 16274 | { "In-0x04", 0x4 }, |
| 16275 | { "In-0x05", 0x5 }, |
| 16276 | { "In-0x06", 0x6 }, |
| 16277 | { "In-0x07", 0x7 }, |
| 16278 | { "In-0x08", 0x8 }, |
| 16279 | { "In-0x09", 0x9 }, |
| 16280 | { "In-0x0a", 0x0a }, |
| 16281 | { "In-0x0b", 0x0b }, |
| 16282 | { "In-0x0c", 0x0c }, |
| 16283 | { "In-0x0d", 0x0d }, |
| 16284 | { "In-0x0e", 0x0e }, |
| 16285 | { "In-0x0f", 0x0f }, |
| 16286 | }, |
| 16287 | }; |
| 16288 | #endif |
| 16289 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16290 | /* |
| 16291 | * 2ch mode |
| 16292 | */ |
| 16293 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16294 | { 2, NULL } |
| 16295 | }; |
| 16296 | |
| 16297 | /* |
| 16298 | * 2ch mode |
| 16299 | */ |
| 16300 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16301 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16302 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16303 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16304 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16305 | { } /* end */ |
| 16306 | }; |
| 16307 | |
| 16308 | /* |
| 16309 | * 6ch mode |
| 16310 | */ |
| 16311 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16312 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16313 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16314 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16315 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16316 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16317 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16318 | { } /* end */ |
| 16319 | }; |
| 16320 | |
| 16321 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16322 | { 2, alc662_3ST_ch2_init }, |
| 16323 | { 6, alc662_3ST_ch6_init }, |
| 16324 | }; |
| 16325 | |
| 16326 | /* |
| 16327 | * 2ch mode |
| 16328 | */ |
| 16329 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16330 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16331 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16332 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16333 | { } /* end */ |
| 16334 | }; |
| 16335 | |
| 16336 | /* |
| 16337 | * 6ch mode |
| 16338 | */ |
| 16339 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16340 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16341 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16342 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16343 | { } /* end */ |
| 16344 | }; |
| 16345 | |
| 16346 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16347 | { 2, alc662_sixstack_ch6_init }, |
| 16348 | { 6, alc662_sixstack_ch8_init }, |
| 16349 | }; |
| 16350 | |
| 16351 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16352 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16353 | */ |
| 16354 | |
| 16355 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16356 | /* output mixer control */ |
| 16357 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16358 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16359 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16360 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16361 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16362 | 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] | 16363 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16364 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16365 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16366 | |
| 16367 | /*Input mixer control */ |
| 16368 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16369 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16370 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16371 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16372 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16373 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16374 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16375 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16376 | { } /* end */ |
| 16377 | }; |
| 16378 | |
| 16379 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16380 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16381 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16382 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16383 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16384 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16385 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16386 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16389 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16390 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16391 | { } /* end */ |
| 16392 | }; |
| 16393 | |
| 16394 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16396 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16397 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16398 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16399 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16400 | 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] | 16401 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16402 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16403 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16404 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16405 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16406 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16407 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16408 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16409 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16410 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16411 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16412 | { } /* end */ |
| 16413 | }; |
| 16414 | |
| 16415 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16416 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16417 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16418 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16419 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16420 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16421 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16422 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16425 | { } /* end */ |
| 16426 | }; |
| 16427 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16428 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16429 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16430 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16431 | |
| 16432 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16433 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16434 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16435 | |
| 16436 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16437 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16438 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16439 | { } /* end */ |
| 16440 | }; |
| 16441 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16442 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16443 | ALC262_HIPPO_MASTER_SWITCH, |
| 16444 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16445 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16446 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16447 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16448 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16449 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16450 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16451 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16453 | { } /* end */ |
| 16454 | }; |
| 16455 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16456 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16457 | .ops = &snd_hda_bind_vol, |
| 16458 | .values = { |
| 16459 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16460 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16461 | 0 |
| 16462 | }, |
| 16463 | }; |
| 16464 | |
| 16465 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16466 | .ops = &snd_hda_bind_sw, |
| 16467 | .values = { |
| 16468 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16469 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16470 | 0 |
| 16471 | }, |
| 16472 | }; |
| 16473 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16474 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16475 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16476 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16477 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16478 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16479 | { } /* end */ |
| 16480 | }; |
| 16481 | |
| 16482 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16483 | .ops = &snd_hda_bind_sw, |
| 16484 | .values = { |
| 16485 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16486 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16487 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16488 | 0 |
| 16489 | }, |
| 16490 | }; |
| 16491 | |
| 16492 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16493 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16494 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16496 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16497 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16498 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16499 | |
| 16500 | { } /* end */ |
| 16501 | }; |
| 16502 | |
| 16503 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16504 | .ops = &snd_hda_bind_sw, |
| 16505 | .values = { |
| 16506 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16507 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16508 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16509 | 0 |
| 16510 | }, |
| 16511 | }; |
| 16512 | |
| 16513 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16514 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16515 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16516 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16517 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16518 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16519 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16520 | { } /* end */ |
| 16521 | }; |
| 16522 | |
| 16523 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16524 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16525 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16526 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16527 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16528 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16529 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16530 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16531 | { } /* end */ |
| 16532 | }; |
| 16533 | |
| 16534 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16535 | .ops = &snd_hda_bind_vol, |
| 16536 | .values = { |
| 16537 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16538 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16539 | 0 |
| 16540 | }, |
| 16541 | }; |
| 16542 | |
| 16543 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16544 | .ops = &snd_hda_bind_sw, |
| 16545 | .values = { |
| 16546 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16547 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16548 | 0 |
| 16549 | }, |
| 16550 | }; |
| 16551 | |
| 16552 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16553 | HDA_BIND_VOL("Master Playback Volume", |
| 16554 | &alc663_asus_two_bind_master_vol), |
| 16555 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16556 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16557 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16558 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16559 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16560 | { } /* end */ |
| 16561 | }; |
| 16562 | |
| 16563 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16564 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16565 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16566 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16567 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16568 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16569 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16570 | { } /* end */ |
| 16571 | }; |
| 16572 | |
| 16573 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16574 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16575 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16577 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16579 | |
| 16580 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16581 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16582 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16583 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16584 | { } /* end */ |
| 16585 | }; |
| 16586 | |
| 16587 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16588 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16589 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16590 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16591 | |
| 16592 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16593 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16594 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16595 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16597 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16598 | { } /* end */ |
| 16599 | }; |
| 16600 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16601 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16602 | .ops = &snd_hda_bind_sw, |
| 16603 | .values = { |
| 16604 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16605 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16606 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16607 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16608 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16609 | 0 |
| 16610 | }, |
| 16611 | }; |
| 16612 | |
| 16613 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16614 | .ops = &snd_hda_bind_sw, |
| 16615 | .values = { |
| 16616 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16617 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16618 | 0 |
| 16619 | }, |
| 16620 | }; |
| 16621 | |
| 16622 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16623 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16624 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16625 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16626 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16627 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16628 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16629 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16631 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16632 | { } /* end */ |
| 16633 | }; |
| 16634 | |
| 16635 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16636 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16637 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16638 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16639 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16640 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16643 | { } /* end */ |
| 16644 | }; |
| 16645 | |
| 16646 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16647 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16648 | { |
| 16649 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16650 | .name = "Channel Mode", |
| 16651 | .info = alc_ch_mode_info, |
| 16652 | .get = alc_ch_mode_get, |
| 16653 | .put = alc_ch_mode_put, |
| 16654 | }, |
| 16655 | { } /* end */ |
| 16656 | }; |
| 16657 | |
| 16658 | static struct hda_verb alc662_init_verbs[] = { |
| 16659 | /* ADC: mute amp left and right */ |
| 16660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16661 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16662 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16663 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16664 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16665 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16666 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16667 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16668 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16669 | |
| 16670 | /* Front Pin: output 0 (0x0c) */ |
| 16671 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16673 | |
| 16674 | /* Rear Pin: output 1 (0x0d) */ |
| 16675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16677 | |
| 16678 | /* CLFE Pin: output 2 (0x0e) */ |
| 16679 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16680 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16681 | |
| 16682 | /* Mic (rear) pin: input vref at 80% */ |
| 16683 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16684 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16685 | /* Front Mic pin: input vref at 80% */ |
| 16686 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16687 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16688 | /* Line In pin: input */ |
| 16689 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16691 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16692 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16693 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16694 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16695 | /* CD pin widget for input */ |
| 16696 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16697 | |
| 16698 | /* FIXME: use matrix-type input source selection */ |
| 16699 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16700 | /* Input mixer */ |
| 16701 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16702 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16703 | |
| 16704 | /* always trun on EAPD */ |
| 16705 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16706 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16707 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16708 | { } |
| 16709 | }; |
| 16710 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 16711 | static struct hda_verb alc663_init_verbs[] = { |
| 16712 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16713 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16714 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16715 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16716 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16717 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16718 | { } |
| 16719 | }; |
| 16720 | |
| 16721 | static struct hda_verb alc272_init_verbs[] = { |
| 16722 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16723 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16724 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16725 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16726 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16727 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16729 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16730 | { } |
| 16731 | }; |
| 16732 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16733 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16734 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16735 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16736 | {} |
| 16737 | }; |
| 16738 | |
| 16739 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16740 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16741 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16742 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16743 | }; |
| 16744 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16745 | /* Set Unsolicited Event*/ |
| 16746 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16747 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16748 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16749 | {} |
| 16750 | }; |
| 16751 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16752 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16753 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16754 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16755 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16756 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16757 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16760 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16761 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16762 | {} |
| 16763 | }; |
| 16764 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16765 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16766 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16767 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16768 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16771 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16772 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16773 | {} |
| 16774 | }; |
| 16775 | |
| 16776 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16777 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16778 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16779 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16780 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16782 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16783 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16784 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16785 | {} |
| 16786 | }; |
| 16787 | |
| 16788 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16791 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16795 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16796 | {} |
| 16797 | }; |
| 16798 | |
| 16799 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16800 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16801 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16802 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16803 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16804 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16805 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16806 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16807 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16808 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16809 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16810 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16811 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16812 | {} |
| 16813 | }; |
| 16814 | |
| 16815 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16816 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16817 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16818 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16819 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16822 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16823 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16824 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16825 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16826 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16827 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16828 | {} |
| 16829 | }; |
| 16830 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16831 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16832 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16833 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16834 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16835 | |
| 16836 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16837 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16838 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16839 | |
| 16840 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16841 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16842 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16843 | {} |
| 16844 | }; |
| 16845 | |
| 16846 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16847 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16848 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16849 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16850 | |
| 16851 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16852 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16853 | {} |
| 16854 | }; |
| 16855 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16856 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16857 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16859 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16860 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16861 | {} |
| 16862 | }; |
| 16863 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16864 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16865 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16866 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16867 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16868 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16869 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16870 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16871 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16874 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16875 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16876 | {} |
| 16877 | }; |
| 16878 | |
| 16879 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16880 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16881 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16882 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16883 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16884 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16885 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16886 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16888 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16889 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16890 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16891 | {} |
| 16892 | }; |
| 16893 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16894 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 16895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16896 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16897 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16898 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16899 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16900 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16901 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16902 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16903 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16904 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16907 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16908 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16909 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16910 | {} |
| 16911 | }; |
| 16912 | |
| 16913 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 16914 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16917 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 16918 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16919 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16921 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16922 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16923 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16924 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16927 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16928 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16929 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16930 | {} |
| 16931 | }; |
| 16932 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16933 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16934 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16935 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16936 | { } /* end */ |
| 16937 | }; |
| 16938 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16939 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16940 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16941 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16942 | { } /* end */ |
| 16943 | }; |
| 16944 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16946 | { |
| 16947 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16948 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16949 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16950 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16951 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16952 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16953 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16954 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16955 | } |
| 16956 | |
| 16957 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16958 | { |
| 16959 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16960 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16961 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16962 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16963 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 16964 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16965 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16966 | HDA_AMP_MUTE, bits); |
| 16967 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16968 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16969 | } |
| 16970 | |
| 16971 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16972 | unsigned int res) |
| 16973 | { |
| 16974 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16975 | alc662_lenovo_101e_all_automute(codec); |
| 16976 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16977 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16978 | } |
| 16979 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16980 | /* unsolicited event for HP jack sensing */ |
| 16981 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16982 | unsigned int res) |
| 16983 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16984 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16985 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16986 | else |
| 16987 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16988 | } |
| 16989 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16990 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16991 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16992 | struct alc_spec *spec = codec->spec; |
| 16993 | |
| 16994 | alc262_hippo1_setup(codec); |
| 16995 | spec->ext_mic.pin = 0x18; |
| 16996 | spec->ext_mic.mux_idx = 0; |
| 16997 | spec->int_mic.pin = 0x19; |
| 16998 | spec->int_mic.mux_idx = 1; |
| 16999 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17000 | } |
| 17001 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17002 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17003 | { |
| 17004 | alc262_hippo_automute(codec); |
| 17005 | alc_mic_automute(codec); |
| 17006 | } |
| 17007 | |
| 17008 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17009 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17010 | struct alc_spec *spec = codec->spec; |
| 17011 | |
| 17012 | spec->autocfg.hp_pins[0] = 0x14; |
| 17013 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17014 | } |
| 17015 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17016 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17017 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17018 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17019 | { |
| 17020 | unsigned int present; |
| 17021 | unsigned char bits; |
| 17022 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17023 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17024 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17025 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 17026 | AMP_IN_MUTE(0), bits); |
| 17027 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 17028 | AMP_IN_MUTE(0), bits); |
| 17029 | } |
| 17030 | |
| 17031 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17032 | { |
| 17033 | unsigned int present; |
| 17034 | unsigned char bits; |
| 17035 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17036 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17037 | bits = present ? HDA_AMP_MUTE : 0; |
| 17038 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 17039 | AMP_IN_MUTE(0), bits); |
| 17040 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 17041 | AMP_IN_MUTE(0), bits); |
| 17042 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 17043 | AMP_IN_MUTE(0), bits); |
| 17044 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 17045 | AMP_IN_MUTE(0), bits); |
| 17046 | } |
| 17047 | |
| 17048 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17049 | { |
| 17050 | unsigned int present; |
| 17051 | unsigned char bits; |
| 17052 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17053 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17054 | bits = present ? HDA_AMP_MUTE : 0; |
| 17055 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 17056 | AMP_IN_MUTE(0), bits); |
| 17057 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 17058 | AMP_IN_MUTE(0), bits); |
| 17059 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 17060 | AMP_IN_MUTE(0), bits); |
| 17061 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 17062 | AMP_IN_MUTE(0), bits); |
| 17063 | } |
| 17064 | |
| 17065 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17066 | { |
| 17067 | unsigned int present; |
| 17068 | unsigned char bits; |
| 17069 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17070 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17071 | bits = present ? 0 : PIN_OUT; |
| 17072 | snd_hda_codec_write(codec, 0x14, 0, |
| 17073 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17074 | } |
| 17075 | |
| 17076 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17077 | { |
| 17078 | unsigned int present1, present2; |
| 17079 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17080 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17081 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17082 | |
| 17083 | if (present1 || present2) { |
| 17084 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17085 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17086 | } else { |
| 17087 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17088 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17089 | } |
| 17090 | } |
| 17091 | |
| 17092 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17093 | { |
| 17094 | unsigned int present1, present2; |
| 17095 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17096 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17097 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17098 | |
| 17099 | if (present1 || present2) { |
| 17100 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 17101 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 17102 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 17103 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 17104 | } else { |
| 17105 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 17106 | AMP_IN_MUTE(0), 0); |
| 17107 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 17108 | AMP_IN_MUTE(0), 0); |
| 17109 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17110 | } |
| 17111 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17112 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17113 | { |
| 17114 | unsigned int present1, present2; |
| 17115 | |
| 17116 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17117 | AC_VERB_GET_PIN_SENSE, 0) |
| 17118 | & AC_PINSENSE_PRESENCE; |
| 17119 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17120 | AC_VERB_GET_PIN_SENSE, 0) |
| 17121 | & AC_PINSENSE_PRESENCE; |
| 17122 | |
| 17123 | if (present1 || present2) { |
| 17124 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17125 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17126 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17127 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17128 | } else { |
| 17129 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17130 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17131 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17132 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17133 | } |
| 17134 | } |
| 17135 | |
| 17136 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17137 | { |
| 17138 | unsigned int present1, present2; |
| 17139 | |
| 17140 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17141 | AC_VERB_GET_PIN_SENSE, 0) |
| 17142 | & AC_PINSENSE_PRESENCE; |
| 17143 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17144 | AC_VERB_GET_PIN_SENSE, 0) |
| 17145 | & AC_PINSENSE_PRESENCE; |
| 17146 | |
| 17147 | if (present1 || present2) { |
| 17148 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17149 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17150 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17151 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17152 | } else { |
| 17153 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17154 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17155 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17156 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17157 | } |
| 17158 | } |
| 17159 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17160 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17161 | unsigned int res) |
| 17162 | { |
| 17163 | switch (res >> 26) { |
| 17164 | case ALC880_HP_EVENT: |
| 17165 | alc663_m51va_speaker_automute(codec); |
| 17166 | break; |
| 17167 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17168 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17169 | break; |
| 17170 | } |
| 17171 | } |
| 17172 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17173 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17174 | { |
| 17175 | struct alc_spec *spec = codec->spec; |
| 17176 | spec->ext_mic.pin = 0x18; |
| 17177 | spec->ext_mic.mux_idx = 0; |
| 17178 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17179 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17180 | spec->auto_mic = 1; |
| 17181 | } |
| 17182 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17183 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17184 | { |
| 17185 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17186 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17187 | } |
| 17188 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17189 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17190 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17191 | |
| 17192 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17193 | { |
| 17194 | struct alc_spec *spec = codec->spec; |
| 17195 | spec->ext_mic.pin = 0x18; |
| 17196 | spec->ext_mic.mux_idx = 0; |
| 17197 | spec->int_mic.pin = 0x19; |
| 17198 | spec->int_mic.mux_idx = 1; |
| 17199 | spec->auto_mic = 1; |
| 17200 | } |
| 17201 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17202 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17203 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17204 | /* ***************** Mode2 ******************************/ |
| 17205 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17206 | unsigned int res) |
| 17207 | { |
| 17208 | switch (res >> 26) { |
| 17209 | case ALC880_HP_EVENT: |
| 17210 | alc662_f5z_speaker_automute(codec); |
| 17211 | break; |
| 17212 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17213 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17214 | break; |
| 17215 | } |
| 17216 | } |
| 17217 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17218 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17219 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17220 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17221 | { |
| 17222 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17223 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17224 | } |
| 17225 | /* ***************** Mode3 ******************************/ |
| 17226 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17227 | unsigned int res) |
| 17228 | { |
| 17229 | switch (res >> 26) { |
| 17230 | case ALC880_HP_EVENT: |
| 17231 | alc663_two_hp_m1_speaker_automute(codec); |
| 17232 | break; |
| 17233 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17234 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17235 | break; |
| 17236 | } |
| 17237 | } |
| 17238 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17239 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17240 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17241 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17242 | { |
| 17243 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17244 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17245 | } |
| 17246 | /* ***************** Mode4 ******************************/ |
| 17247 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17248 | unsigned int res) |
| 17249 | { |
| 17250 | switch (res >> 26) { |
| 17251 | case ALC880_HP_EVENT: |
| 17252 | alc663_21jd_two_speaker_automute(codec); |
| 17253 | break; |
| 17254 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17255 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17256 | break; |
| 17257 | } |
| 17258 | } |
| 17259 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17260 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17261 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17262 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17263 | { |
| 17264 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17265 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17266 | } |
| 17267 | /* ***************** Mode5 ******************************/ |
| 17268 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17269 | unsigned int res) |
| 17270 | { |
| 17271 | switch (res >> 26) { |
| 17272 | case ALC880_HP_EVENT: |
| 17273 | alc663_15jd_two_speaker_automute(codec); |
| 17274 | break; |
| 17275 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17276 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17277 | break; |
| 17278 | } |
| 17279 | } |
| 17280 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17281 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17282 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17283 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17284 | { |
| 17285 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17286 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17287 | } |
| 17288 | /* ***************** Mode6 ******************************/ |
| 17289 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17290 | unsigned int res) |
| 17291 | { |
| 17292 | switch (res >> 26) { |
| 17293 | case ALC880_HP_EVENT: |
| 17294 | alc663_two_hp_m2_speaker_automute(codec); |
| 17295 | break; |
| 17296 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17297 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17298 | break; |
| 17299 | } |
| 17300 | } |
| 17301 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17302 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17303 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17304 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17305 | { |
| 17306 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17307 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17308 | } |
| 17309 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17310 | /* ***************** Mode7 ******************************/ |
| 17311 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17312 | unsigned int res) |
| 17313 | { |
| 17314 | switch (res >> 26) { |
| 17315 | case ALC880_HP_EVENT: |
| 17316 | alc663_two_hp_m7_speaker_automute(codec); |
| 17317 | break; |
| 17318 | case ALC880_MIC_EVENT: |
| 17319 | alc_mic_automute(codec); |
| 17320 | break; |
| 17321 | } |
| 17322 | } |
| 17323 | |
| 17324 | #define alc663_mode7_setup alc663_mode1_setup |
| 17325 | |
| 17326 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17327 | { |
| 17328 | alc663_two_hp_m7_speaker_automute(codec); |
| 17329 | alc_mic_automute(codec); |
| 17330 | } |
| 17331 | |
| 17332 | /* ***************** Mode8 ******************************/ |
| 17333 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17334 | unsigned int res) |
| 17335 | { |
| 17336 | switch (res >> 26) { |
| 17337 | case ALC880_HP_EVENT: |
| 17338 | alc663_two_hp_m8_speaker_automute(codec); |
| 17339 | break; |
| 17340 | case ALC880_MIC_EVENT: |
| 17341 | alc_mic_automute(codec); |
| 17342 | break; |
| 17343 | } |
| 17344 | } |
| 17345 | |
| 17346 | #define alc663_mode8_setup alc663_m51va_setup |
| 17347 | |
| 17348 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17349 | { |
| 17350 | alc663_two_hp_m8_speaker_automute(codec); |
| 17351 | alc_mic_automute(codec); |
| 17352 | } |
| 17353 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17354 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17355 | { |
| 17356 | unsigned int present; |
| 17357 | unsigned char bits; |
| 17358 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17359 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17360 | bits = present ? HDA_AMP_MUTE : 0; |
| 17361 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17362 | HDA_AMP_MUTE, bits); |
| 17363 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17364 | HDA_AMP_MUTE, bits); |
| 17365 | } |
| 17366 | |
| 17367 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17368 | { |
| 17369 | unsigned int present; |
| 17370 | unsigned char bits; |
| 17371 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17372 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17373 | bits = present ? HDA_AMP_MUTE : 0; |
| 17374 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17375 | HDA_AMP_MUTE, bits); |
| 17376 | } |
| 17377 | |
| 17378 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17379 | unsigned int res) |
| 17380 | { |
| 17381 | switch (res >> 26) { |
| 17382 | case ALC880_HP_EVENT: |
| 17383 | alc663_g71v_hp_automute(codec); |
| 17384 | break; |
| 17385 | case ALC880_FRONT_EVENT: |
| 17386 | alc663_g71v_front_automute(codec); |
| 17387 | break; |
| 17388 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17389 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17390 | break; |
| 17391 | } |
| 17392 | } |
| 17393 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17394 | #define alc663_g71v_setup alc663_m51va_setup |
| 17395 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17396 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17397 | { |
| 17398 | alc663_g71v_front_automute(codec); |
| 17399 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17400 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17401 | } |
| 17402 | |
| 17403 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17404 | unsigned int res) |
| 17405 | { |
| 17406 | switch (res >> 26) { |
| 17407 | case ALC880_HP_EVENT: |
| 17408 | alc663_m51va_speaker_automute(codec); |
| 17409 | break; |
| 17410 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17411 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17412 | break; |
| 17413 | } |
| 17414 | } |
| 17415 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17416 | #define alc663_g50v_setup alc663_m51va_setup |
| 17417 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17418 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17419 | { |
| 17420 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17421 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17422 | } |
| 17423 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17424 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17425 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17426 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17427 | |
| 17428 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17429 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17430 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17431 | |
| 17432 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17433 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17434 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17435 | { } /* end */ |
| 17436 | }; |
| 17437 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17438 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17439 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17440 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17441 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17442 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17443 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17444 | |
| 17445 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17446 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17447 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17448 | |
| 17449 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17450 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17451 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17452 | { } /* end */ |
| 17453 | }; |
| 17454 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17455 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17456 | #define alc662_loopbacks alc880_loopbacks |
| 17457 | #endif |
| 17458 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17459 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17460 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17461 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17462 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17463 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17464 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17465 | |
| 17466 | /* |
| 17467 | * configuration and preset |
| 17468 | */ |
| 17469 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17470 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17471 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17472 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17473 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17474 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17475 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17476 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17477 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17478 | [ALC663_ASUS_M51VA] = "m51va", |
| 17479 | [ALC663_ASUS_G71V] = "g71v", |
| 17480 | [ALC663_ASUS_H13] = "h13", |
| 17481 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17482 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17483 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17484 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17485 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17486 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17487 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17488 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17489 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17490 | [ALC272_DELL] = "dell", |
| 17491 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17492 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17493 | [ALC662_AUTO] = "auto", |
| 17494 | }; |
| 17495 | |
| 17496 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17497 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17498 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17499 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17500 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17501 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17502 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17503 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17504 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17505 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17506 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17507 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17508 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17509 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17510 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17511 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17512 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17513 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17514 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17515 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17516 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17517 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17518 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17519 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17520 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17521 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17522 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17523 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17524 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17525 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17526 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17527 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17528 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17529 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17530 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17531 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17532 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17533 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17534 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17535 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17536 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17537 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17538 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17539 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17540 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17541 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17542 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17543 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17544 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17545 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17546 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17547 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17548 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17549 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17550 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17551 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17552 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17553 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17554 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17555 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17556 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17557 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17558 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17559 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17560 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17561 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 17562 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17563 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17564 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17565 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17566 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17567 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17568 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17569 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17570 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17571 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17572 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17573 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17574 | {} |
| 17575 | }; |
| 17576 | |
| 17577 | static struct alc_config_preset alc662_presets[] = { |
| 17578 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17579 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17580 | .init_verbs = { alc662_init_verbs }, |
| 17581 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17582 | .dac_nids = alc662_dac_nids, |
| 17583 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17584 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17585 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17586 | .channel_mode = alc662_3ST_2ch_modes, |
| 17587 | .input_mux = &alc662_capture_source, |
| 17588 | }, |
| 17589 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17590 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17591 | .init_verbs = { alc662_init_verbs }, |
| 17592 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17593 | .dac_nids = alc662_dac_nids, |
| 17594 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17595 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17596 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17597 | .channel_mode = alc662_3ST_6ch_modes, |
| 17598 | .need_dac_fix = 1, |
| 17599 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17600 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17601 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17602 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17603 | .init_verbs = { alc662_init_verbs }, |
| 17604 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17605 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17606 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17607 | .channel_mode = alc662_3ST_6ch_modes, |
| 17608 | .need_dac_fix = 1, |
| 17609 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17610 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17611 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17612 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17613 | .init_verbs = { alc662_init_verbs }, |
| 17614 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17615 | .dac_nids = alc662_dac_nids, |
| 17616 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17617 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17618 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17619 | .channel_mode = alc662_5stack_modes, |
| 17620 | .input_mux = &alc662_capture_source, |
| 17621 | }, |
| 17622 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17623 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17624 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17625 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17626 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17627 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17628 | .channel_mode = alc662_3ST_2ch_modes, |
| 17629 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17630 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17631 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17632 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17633 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17634 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17635 | .init_verbs = { alc662_init_verbs, |
| 17636 | alc662_eeepc_sue_init_verbs }, |
| 17637 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17638 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17639 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17640 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17641 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17642 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17643 | .init_hook = alc662_eeepc_inithook, |
| 17644 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17645 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17646 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17647 | alc662_chmode_mixer }, |
| 17648 | .init_verbs = { alc662_init_verbs, |
| 17649 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17650 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17651 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17652 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17653 | .channel_mode = alc662_3ST_6ch_modes, |
| 17654 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17655 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17656 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17657 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17658 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17659 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17660 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17661 | .init_verbs = { alc662_init_verbs, |
| 17662 | alc662_ecs_init_verbs }, |
| 17663 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17664 | .dac_nids = alc662_dac_nids, |
| 17665 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17666 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17667 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17668 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17669 | .init_hook = alc662_eeepc_inithook, |
| 17670 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17671 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17672 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17673 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17674 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17675 | .dac_nids = alc662_dac_nids, |
| 17676 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17677 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17678 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17679 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17680 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17681 | .init_hook = alc663_m51va_inithook, |
| 17682 | }, |
| 17683 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17684 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17685 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17686 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17687 | .dac_nids = alc662_dac_nids, |
| 17688 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17689 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17690 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17691 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17692 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17693 | .init_hook = alc663_g71v_inithook, |
| 17694 | }, |
| 17695 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17696 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17697 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17698 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17699 | .dac_nids = alc662_dac_nids, |
| 17700 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17701 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17702 | .unsol_event = alc663_m51va_unsol_event, |
| 17703 | .init_hook = alc663_m51va_inithook, |
| 17704 | }, |
| 17705 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17706 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17707 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17708 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17709 | .dac_nids = alc662_dac_nids, |
| 17710 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17711 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17712 | .channel_mode = alc662_3ST_6ch_modes, |
| 17713 | .input_mux = &alc663_capture_source, |
| 17714 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17715 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17716 | .init_hook = alc663_g50v_inithook, |
| 17717 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17718 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17719 | .mixers = { alc663_m51va_mixer }, |
| 17720 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17721 | .init_verbs = { alc662_init_verbs, |
| 17722 | alc663_21jd_amic_init_verbs }, |
| 17723 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17724 | .hp_nid = 0x03, |
| 17725 | .dac_nids = alc662_dac_nids, |
| 17726 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17727 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17728 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17729 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17730 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17731 | .init_hook = alc663_mode1_inithook, |
| 17732 | }, |
| 17733 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17734 | .mixers = { alc662_1bjd_mixer }, |
| 17735 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17736 | .init_verbs = { alc662_init_verbs, |
| 17737 | alc662_1bjd_amic_init_verbs }, |
| 17738 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17739 | .dac_nids = alc662_dac_nids, |
| 17740 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17741 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17742 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17743 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17744 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17745 | .init_hook = alc662_mode2_inithook, |
| 17746 | }, |
| 17747 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17748 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17749 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17750 | .init_verbs = { alc662_init_verbs, |
| 17751 | alc663_two_hp_amic_m1_init_verbs }, |
| 17752 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17753 | .hp_nid = 0x03, |
| 17754 | .dac_nids = alc662_dac_nids, |
| 17755 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17756 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17757 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17758 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17759 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17760 | .init_hook = alc663_mode3_inithook, |
| 17761 | }, |
| 17762 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17763 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17764 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17765 | .init_verbs = { alc662_init_verbs, |
| 17766 | alc663_21jd_amic_init_verbs}, |
| 17767 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17768 | .hp_nid = 0x03, |
| 17769 | .dac_nids = alc662_dac_nids, |
| 17770 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17771 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17772 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17773 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17774 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17775 | .init_hook = alc663_mode4_inithook, |
| 17776 | }, |
| 17777 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17778 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17779 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17780 | .init_verbs = { alc662_init_verbs, |
| 17781 | alc663_15jd_amic_init_verbs }, |
| 17782 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17783 | .hp_nid = 0x03, |
| 17784 | .dac_nids = alc662_dac_nids, |
| 17785 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17786 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17787 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17788 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17789 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17790 | .init_hook = alc663_mode5_inithook, |
| 17791 | }, |
| 17792 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17793 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17794 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17795 | .init_verbs = { alc662_init_verbs, |
| 17796 | alc663_two_hp_amic_m2_init_verbs }, |
| 17797 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17798 | .hp_nid = 0x03, |
| 17799 | .dac_nids = alc662_dac_nids, |
| 17800 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17801 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17802 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17803 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17804 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17805 | .init_hook = alc663_mode6_inithook, |
| 17806 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17807 | [ALC663_ASUS_MODE7] = { |
| 17808 | .mixers = { alc663_mode7_mixer }, |
| 17809 | .cap_mixer = alc662_auto_capture_mixer, |
| 17810 | .init_verbs = { alc662_init_verbs, |
| 17811 | alc663_mode7_init_verbs }, |
| 17812 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17813 | .hp_nid = 0x03, |
| 17814 | .dac_nids = alc662_dac_nids, |
| 17815 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17816 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17817 | .channel_mode = alc662_3ST_2ch_modes, |
| 17818 | .unsol_event = alc663_mode7_unsol_event, |
| 17819 | .setup = alc663_mode7_setup, |
| 17820 | .init_hook = alc663_mode7_inithook, |
| 17821 | }, |
| 17822 | [ALC663_ASUS_MODE8] = { |
| 17823 | .mixers = { alc663_mode8_mixer }, |
| 17824 | .cap_mixer = alc662_auto_capture_mixer, |
| 17825 | .init_verbs = { alc662_init_verbs, |
| 17826 | alc663_mode8_init_verbs }, |
| 17827 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17828 | .hp_nid = 0x03, |
| 17829 | .dac_nids = alc662_dac_nids, |
| 17830 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17831 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17832 | .channel_mode = alc662_3ST_2ch_modes, |
| 17833 | .unsol_event = alc663_mode8_unsol_event, |
| 17834 | .setup = alc663_mode8_setup, |
| 17835 | .init_hook = alc663_mode8_inithook, |
| 17836 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17837 | [ALC272_DELL] = { |
| 17838 | .mixers = { alc663_m51va_mixer }, |
| 17839 | .cap_mixer = alc272_auto_capture_mixer, |
| 17840 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17841 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17842 | .dac_nids = alc662_dac_nids, |
| 17843 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17844 | .adc_nids = alc272_adc_nids, |
| 17845 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17846 | .capsrc_nids = alc272_capsrc_nids, |
| 17847 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17848 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17849 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17850 | .init_hook = alc663_m51va_inithook, |
| 17851 | }, |
| 17852 | [ALC272_DELL_ZM1] = { |
| 17853 | .mixers = { alc663_m51va_mixer }, |
| 17854 | .cap_mixer = alc662_auto_capture_mixer, |
| 17855 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17856 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17857 | .dac_nids = alc662_dac_nids, |
| 17858 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17859 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17860 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17861 | .capsrc_nids = alc662_capsrc_nids, |
| 17862 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17863 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17864 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17865 | .init_hook = alc663_m51va_inithook, |
| 17866 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17867 | [ALC272_SAMSUNG_NC10] = { |
| 17868 | .mixers = { alc272_nc10_mixer }, |
| 17869 | .init_verbs = { alc662_init_verbs, |
| 17870 | alc663_21jd_amic_init_verbs }, |
| 17871 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17872 | .dac_nids = alc272_dac_nids, |
| 17873 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17874 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17875 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17876 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17877 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17878 | .init_hook = alc663_mode4_inithook, |
| 17879 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17880 | }; |
| 17881 | |
| 17882 | |
| 17883 | /* |
| 17884 | * BIOS auto configuration |
| 17885 | */ |
| 17886 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17887 | /* convert from MIX nid to DAC */ |
| 17888 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 17889 | { |
| 17890 | if (nid == 0x0f) |
| 17891 | return 0x02; |
| 17892 | else if (nid >= 0x0c && nid <= 0x0e) |
| 17893 | return nid - 0x0c + 0x02; |
| 17894 | else |
| 17895 | return 0; |
| 17896 | } |
| 17897 | |
| 17898 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 17899 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 17900 | hda_nid_t dac) |
| 17901 | { |
| 17902 | hda_nid_t mix[4]; |
| 17903 | int i, num; |
| 17904 | |
| 17905 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 17906 | for (i = 0; i < num; i++) { |
| 17907 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 17908 | return mix[i]; |
| 17909 | } |
| 17910 | return 0; |
| 17911 | } |
| 17912 | |
| 17913 | /* look for an empty DAC slot */ |
| 17914 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 17915 | { |
| 17916 | struct alc_spec *spec = codec->spec; |
| 17917 | hda_nid_t srcs[5]; |
| 17918 | int i, j, num; |
| 17919 | |
| 17920 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 17921 | if (num < 0) |
| 17922 | return 0; |
| 17923 | for (i = 0; i < num; i++) { |
| 17924 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 17925 | if (!nid) |
| 17926 | continue; |
| 17927 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 17928 | if (spec->multiout.dac_nids[j] == nid) |
| 17929 | break; |
| 17930 | if (j >= spec->multiout.num_dacs) |
| 17931 | return nid; |
| 17932 | } |
| 17933 | return 0; |
| 17934 | } |
| 17935 | |
| 17936 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 17937 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 17938 | const struct auto_pin_cfg *cfg) |
| 17939 | { |
| 17940 | struct alc_spec *spec = codec->spec; |
| 17941 | int i; |
| 17942 | hda_nid_t dac; |
| 17943 | |
| 17944 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 17945 | for (i = 0; i < cfg->line_outs; i++) { |
| 17946 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 17947 | if (!dac) |
| 17948 | continue; |
| 17949 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 17950 | } |
| 17951 | return 0; |
| 17952 | } |
| 17953 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17954 | 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] | 17955 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17956 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17957 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17958 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 17959 | } |
| 17960 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17961 | 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] | 17962 | hda_nid_t nid, unsigned int chs) |
| 17963 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 17964 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17965 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 17966 | } |
| 17967 | |
| 17968 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 17969 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 17970 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 17971 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 17972 | |
| 17973 | /* add playback controls from the parsed DAC table */ |
| 17974 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 17975 | const struct auto_pin_cfg *cfg) |
| 17976 | { |
| 17977 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17978 | static const char *chname[4] = { |
| 17979 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17980 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17981 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17982 | int i, err; |
| 17983 | |
| 17984 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17985 | nid = spec->multiout.dac_nids[i]; |
| 17986 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17987 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17988 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 17989 | if (!mix) |
| 17990 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17991 | if (i == 2) { |
| 17992 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17993 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17994 | if (err < 0) |
| 17995 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17996 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17997 | if (err < 0) |
| 17998 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 17999 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18000 | if (err < 0) |
| 18001 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18002 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18003 | if (err < 0) |
| 18004 | return err; |
| 18005 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18006 | const char *pfx; |
| 18007 | if (cfg->line_outs == 1 && |
| 18008 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18009 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18010 | pfx = "Speaker"; |
| 18011 | else |
| 18012 | pfx = "PCM"; |
| 18013 | } else |
| 18014 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18015 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18016 | if (err < 0) |
| 18017 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18018 | if (cfg->line_outs == 1 && |
| 18019 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18020 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18021 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18022 | if (err < 0) |
| 18023 | return err; |
| 18024 | } |
| 18025 | } |
| 18026 | return 0; |
| 18027 | } |
| 18028 | |
| 18029 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18030 | /* return DAC nid if any new DAC is assigned */ |
| 18031 | 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] | 18032 | const char *pfx) |
| 18033 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18034 | struct alc_spec *spec = codec->spec; |
| 18035 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18036 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18037 | |
| 18038 | if (!pin) |
| 18039 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18040 | nid = alc662_look_for_dac(codec, pin); |
| 18041 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18042 | /* the corresponding DAC is already occupied */ |
| 18043 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18044 | return 0; /* no way */ |
| 18045 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18046 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18047 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18048 | } |
| 18049 | |
| 18050 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18051 | if (!mix) |
| 18052 | return 0; |
| 18053 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18054 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18055 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18056 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18057 | if (err < 0) |
| 18058 | return err; |
| 18059 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18060 | } |
| 18061 | |
| 18062 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18063 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18064 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18065 | |
| 18066 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18067 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18068 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18069 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18070 | int i, num; |
| 18071 | hda_nid_t srcs[4]; |
| 18072 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18073 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18074 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18075 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18076 | if (num <= 1) |
| 18077 | return; |
| 18078 | for (i = 0; i < num; i++) { |
| 18079 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18080 | continue; |
| 18081 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18082 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18083 | } |
| 18084 | } |
| 18085 | |
| 18086 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18087 | { |
| 18088 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18089 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18090 | int i; |
| 18091 | |
| 18092 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18093 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18094 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18095 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18096 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18097 | } |
| 18098 | } |
| 18099 | |
| 18100 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18101 | { |
| 18102 | struct alc_spec *spec = codec->spec; |
| 18103 | hda_nid_t pin; |
| 18104 | |
| 18105 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18106 | if (pin) |
| 18107 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18108 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18109 | pin = spec->autocfg.speaker_pins[0]; |
| 18110 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18111 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18112 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18113 | } |
| 18114 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18115 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18116 | |
| 18117 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18118 | { |
| 18119 | struct alc_spec *spec = codec->spec; |
| 18120 | int i; |
| 18121 | |
| 18122 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18123 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18124 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18125 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18126 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18127 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18128 | snd_hda_codec_write(codec, nid, 0, |
| 18129 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18130 | AMP_OUT_MUTE); |
| 18131 | } |
| 18132 | } |
| 18133 | } |
| 18134 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18135 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18136 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18137 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18138 | { |
| 18139 | struct alc_spec *spec = codec->spec; |
| 18140 | int err; |
| 18141 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18142 | |
| 18143 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18144 | alc662_ignore); |
| 18145 | if (err < 0) |
| 18146 | return err; |
| 18147 | if (!spec->autocfg.line_outs) |
| 18148 | return 0; /* can't find valid BIOS pin config */ |
| 18149 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18150 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18151 | if (err < 0) |
| 18152 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18153 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18154 | if (err < 0) |
| 18155 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18156 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18157 | spec->autocfg.speaker_pins[0], |
| 18158 | "Speaker"); |
| 18159 | if (err < 0) |
| 18160 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18161 | if (err) |
| 18162 | spec->multiout.extra_out_nid[0] = err; |
| 18163 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18164 | "Headphone"); |
| 18165 | if (err < 0) |
| 18166 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18167 | if (err) |
| 18168 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18169 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18170 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18171 | return err; |
| 18172 | |
| 18173 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18174 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18175 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18176 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18177 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18178 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18179 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18180 | |
| 18181 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18182 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18183 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18184 | add_verb(spec, alc662_init_verbs); |
| 18185 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18186 | codec->vendor_id == 0x10ec0665) |
| 18187 | add_verb(spec, alc663_init_verbs); |
| 18188 | |
| 18189 | if (codec->vendor_id == 0x10ec0272) |
| 18190 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18191 | |
| 18192 | err = alc_auto_add_mic_boost(codec); |
| 18193 | if (err < 0) |
| 18194 | return err; |
| 18195 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18196 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 18197 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18198 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18199 | } |
| 18200 | |
| 18201 | /* additional initialization for auto-configuration model */ |
| 18202 | static void alc662_auto_init(struct hda_codec *codec) |
| 18203 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18204 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18205 | alc662_auto_init_multi_out(codec); |
| 18206 | alc662_auto_init_hp_out(codec); |
| 18207 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18208 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18209 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18210 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18211 | } |
| 18212 | |
| 18213 | static int patch_alc662(struct hda_codec *codec) |
| 18214 | { |
| 18215 | struct alc_spec *spec; |
| 18216 | int err, board_config; |
| 18217 | |
| 18218 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18219 | if (!spec) |
| 18220 | return -ENOMEM; |
| 18221 | |
| 18222 | codec->spec = spec; |
| 18223 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18224 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18225 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18226 | if (alc_read_coef_idx(codec, 0)==0x8020){ |
| 18227 | kfree(codec->chip_name); |
| 18228 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18229 | if (!codec->chip_name) { |
| 18230 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18231 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18232 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18233 | } |
| 18234 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18235 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18236 | alc662_models, |
| 18237 | alc662_cfg_tbl); |
| 18238 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18239 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18240 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18241 | board_config = ALC662_AUTO; |
| 18242 | } |
| 18243 | |
| 18244 | if (board_config == ALC662_AUTO) { |
| 18245 | /* automatic parse from the BIOS config */ |
| 18246 | err = alc662_parse_auto_config(codec); |
| 18247 | if (err < 0) { |
| 18248 | alc_free(codec); |
| 18249 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18250 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18251 | printk(KERN_INFO |
| 18252 | "hda_codec: Cannot set up configuration " |
| 18253 | "from BIOS. Using base mode...\n"); |
| 18254 | board_config = ALC662_3ST_2ch_DIG; |
| 18255 | } |
| 18256 | } |
| 18257 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18258 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18259 | if (err < 0) { |
| 18260 | alc_free(codec); |
| 18261 | return err; |
| 18262 | } |
| 18263 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18264 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18265 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18266 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18267 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18268 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18269 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18270 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18271 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18272 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18273 | if (!spec->adc_nids) { |
| 18274 | spec->adc_nids = alc662_adc_nids; |
| 18275 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18276 | } |
| 18277 | if (!spec->capsrc_nids) |
| 18278 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18279 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18280 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18281 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18282 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18283 | switch (codec->vendor_id) { |
| 18284 | case 0x10ec0662: |
| 18285 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18286 | break; |
| 18287 | case 0x10ec0272: |
| 18288 | case 0x10ec0663: |
| 18289 | case 0x10ec0665: |
| 18290 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18291 | break; |
| 18292 | case 0x10ec0273: |
| 18293 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18294 | break; |
| 18295 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18296 | spec->vmaster_nid = 0x02; |
| 18297 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18298 | codec->patch_ops = alc_patch_ops; |
| 18299 | if (board_config == ALC662_AUTO) |
| 18300 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18301 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18302 | if (!spec->loopback.amplist) |
| 18303 | spec->loopback.amplist = alc662_loopbacks; |
| 18304 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18305 | |
| 18306 | return 0; |
| 18307 | } |
| 18308 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18309 | static int patch_alc888(struct hda_codec *codec) |
| 18310 | { |
| 18311 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18312 | kfree(codec->chip_name); |
| 18313 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18314 | if (!codec->chip_name) { |
| 18315 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18316 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18317 | } |
| 18318 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18319 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18320 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18321 | } |
| 18322 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18323 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18324 | * patch entries |
| 18325 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18326 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18327 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18328 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18329 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18330 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18331 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18332 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18333 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18334 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18335 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18336 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18337 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18338 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18339 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18340 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18341 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18342 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18343 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18344 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18345 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18346 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18347 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18348 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18349 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18350 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18351 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18352 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18353 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18354 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18355 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18356 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18357 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18358 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18359 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18360 | {} /* terminator */ |
| 18361 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18362 | |
| 18363 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18364 | |
| 18365 | MODULE_LICENSE("GPL"); |
| 18366 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18367 | |
| 18368 | static struct hda_codec_preset_list realtek_list = { |
| 18369 | .preset = snd_hda_preset_realtek, |
| 18370 | .owner = THIS_MODULE, |
| 18371 | }; |
| 18372 | |
| 18373 | static int __init patch_realtek_init(void) |
| 18374 | { |
| 18375 | return snd_hda_add_codec_preset(&realtek_list); |
| 18376 | } |
| 18377 | |
| 18378 | static void __exit patch_realtek_exit(void) |
| 18379 | { |
| 18380 | snd_hda_delete_codec_preset(&realtek_list); |
| 18381 | } |
| 18382 | |
| 18383 | module_init(patch_realtek_init) |
| 18384 | module_exit(patch_realtek_exit) |