Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 33 | #include "hda_beep.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 75 | ALC260_HP_DC7600, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 76 | ALC260_HP_3013, |
| 77 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 78 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 79 | ALC260_WILL, |
| 80 | ALC260_REPLACER_672V, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 81 | ALC260_FAVORIT100, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 82 | #ifdef CONFIG_SND_DEBUG |
| 83 | ALC260_TEST, |
| 84 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 86 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 89 | /* ALC262 models */ |
| 90 | enum { |
| 91 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 92 | ALC262_HIPPO, |
| 93 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 94 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 95 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 96 | ALC262_HP_BPC_D7000_WL, |
| 97 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 98 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 99 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 100 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 101 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 102 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 103 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 104 | ALC262_LENOVO_3000, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 105 | ALC262_NEC, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 106 | ALC262_TOSHIBA_S06, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 107 | ALC262_TOSHIBA_RX1, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 108 | ALC262_TYAN, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 109 | ALC262_AUTO, |
| 110 | ALC262_MODEL_LAST /* last tag */ |
| 111 | }; |
| 112 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | /* ALC268 models */ |
| 114 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 115 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 116 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 117 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 118 | ALC268_ACER, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 119 | ALC268_ACER_DMIC, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 120 | ALC268_ACER_ASPIRE_ONE, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 121 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 122 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_SND_DEBUG |
| 124 | ALC268_TEST, |
| 125 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 126 | ALC268_AUTO, |
| 127 | ALC268_MODEL_LAST /* last tag */ |
| 128 | }; |
| 129 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 130 | /* ALC269 models */ |
| 131 | enum { |
| 132 | ALC269_BASIC, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 133 | ALC269_QUANTA_FL1, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 134 | ALC269_AMIC, |
| 135 | ALC269_DMIC, |
| 136 | ALC269VB_AMIC, |
| 137 | ALC269VB_DMIC, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 138 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 139 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 140 | ALC269_AUTO, |
| 141 | ALC269_MODEL_LAST /* last tag */ |
| 142 | }; |
| 143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 144 | /* ALC861 models */ |
| 145 | enum { |
| 146 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 147 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 148 | ALC861_3ST_DIG, |
| 149 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 150 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 151 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 152 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 153 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 154 | ALC861_AUTO, |
| 155 | ALC861_MODEL_LAST, |
| 156 | }; |
| 157 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 158 | /* ALC861-VD models */ |
| 159 | enum { |
| 160 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 161 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 162 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 163 | ALC861VD_3ST, |
| 164 | ALC861VD_3ST_DIG, |
| 165 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 166 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 167 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 168 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 169 | ALC861VD_AUTO, |
| 170 | ALC861VD_MODEL_LAST, |
| 171 | }; |
| 172 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 173 | /* ALC662 models */ |
| 174 | enum { |
| 175 | ALC662_3ST_2ch_DIG, |
| 176 | ALC662_3ST_6ch_DIG, |
| 177 | ALC662_3ST_6ch, |
| 178 | ALC662_5ST_DIG, |
| 179 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 180 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 181 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 182 | ALC663_ASUS_M51VA, |
| 183 | ALC663_ASUS_G71V, |
| 184 | ALC663_ASUS_H13, |
| 185 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 186 | ALC662_ECS, |
| 187 | ALC663_ASUS_MODE1, |
| 188 | ALC662_ASUS_MODE2, |
| 189 | ALC663_ASUS_MODE3, |
| 190 | ALC663_ASUS_MODE4, |
| 191 | ALC663_ASUS_MODE5, |
| 192 | ALC663_ASUS_MODE6, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 193 | ALC663_ASUS_MODE7, |
| 194 | ALC663_ASUS_MODE8, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 195 | ALC272_DELL, |
| 196 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 197 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 198 | ALC662_AUTO, |
| 199 | ALC662_MODEL_LAST, |
| 200 | }; |
| 201 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 202 | /* ALC882 models */ |
| 203 | enum { |
| 204 | ALC882_3ST_DIG, |
| 205 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 206 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 207 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 208 | ALC882_TARGA, |
| 209 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 210 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 211 | ALC885_MACPRO, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 212 | ALC885_MBA21, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 213 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 214 | ALC885_MB5, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 215 | ALC885_MACMINI3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 216 | ALC885_IMAC24, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 217 | ALC885_IMAC91, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 218 | ALC883_3ST_2ch_DIG, |
| 219 | ALC883_3ST_6ch_DIG, |
| 220 | ALC883_3ST_6ch, |
| 221 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 222 | ALC883_TARGA_DIG, |
| 223 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 224 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 225 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 226 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 227 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 228 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 229 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 230 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 231 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 232 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 233 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 234 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 235 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 236 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 237 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 238 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 239 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 240 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 241 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 242 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 243 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 244 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 245 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 246 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 247 | ALC889A_INTEL, |
| 248 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 249 | ALC888_ASUS_M90V, |
| 250 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 251 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 252 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 253 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 254 | ALC882_AUTO, |
| 255 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 256 | }; |
| 257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 258 | /* for GPIO Poll */ |
| 259 | #define GPIO_MASK 0x03 |
| 260 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 261 | /* extra amp-initialization sequence types */ |
| 262 | enum { |
| 263 | ALC_INIT_NONE, |
| 264 | ALC_INIT_DEFAULT, |
| 265 | ALC_INIT_GPIO1, |
| 266 | ALC_INIT_GPIO2, |
| 267 | ALC_INIT_GPIO3, |
| 268 | }; |
| 269 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 270 | struct alc_mic_route { |
| 271 | hda_nid_t pin; |
| 272 | unsigned char mux_idx; |
| 273 | unsigned char amix_idx; |
| 274 | }; |
| 275 | |
| 276 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 277 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 278 | struct alc_customize_define { |
| 279 | unsigned int sku_cfg; |
| 280 | unsigned char port_connectivity; |
| 281 | unsigned char check_sum; |
| 282 | unsigned char customization; |
| 283 | unsigned char external_amp; |
| 284 | unsigned int enable_pcbeep:1; |
| 285 | unsigned int platform_type:1; |
| 286 | unsigned int swap:1; |
| 287 | unsigned int override:1; |
| 288 | }; |
| 289 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | struct alc_spec { |
| 291 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 292 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 294 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 295 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | |
Takashi Iwai | 2d9c648 | 2009-10-13 08:06:55 +0200 | [diff] [blame] | 297 | const struct hda_verb *init_verbs[10]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 298 | * don't forget NULL |
| 299 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 300 | */ |
| 301 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 303 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | struct hda_pcm_stream *stream_analog_playback; |
| 305 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 306 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 307 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 309 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | struct hda_pcm_stream *stream_digital_playback; |
| 311 | struct hda_pcm_stream *stream_digital_capture; |
| 312 | |
| 313 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 314 | struct hda_multi_out multiout; /* playback set-up |
| 315 | * max_channels, dacs must be set |
| 316 | * dig_out_nid and hp_nid are optional |
| 317 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 318 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 319 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 320 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | |
| 322 | /* capture */ |
| 323 | unsigned int num_adc_nids; |
| 324 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 325 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 326 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | |
| 328 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 329 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | const struct hda_input_mux *input_mux; |
| 331 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 332 | struct alc_mic_route ext_mic; |
| 333 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | |
| 335 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 336 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 338 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 339 | int const_channel_count; |
| 340 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | |
| 342 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 343 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 344 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 345 | /* dynamic controls, init_verbs and input_mux */ |
| 346 | struct auto_pin_cfg autocfg; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 347 | struct alc_customize_define cdefine; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 348 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 349 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 350 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 351 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 352 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 353 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 354 | /* hooks */ |
| 355 | void (*init_hook)(struct hda_codec *codec); |
| 356 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 357 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 358 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 359 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 360 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 361 | /* for pin sensing */ |
| 362 | unsigned int sense_updated: 1; |
| 363 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 364 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 365 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 366 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 367 | /* other flags */ |
| 368 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 369 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 370 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 371 | /* for virtual master */ |
| 372 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 373 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 374 | struct hda_loopback_check loopback; |
| 375 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 376 | |
| 377 | /* for PLL fix */ |
| 378 | hda_nid_t pll_nid; |
| 379 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 380 | }; |
| 381 | |
| 382 | /* |
| 383 | * configuration template - to be copied to the spec instance |
| 384 | */ |
| 385 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 386 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 387 | * with spec |
| 388 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 389 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 390 | const struct hda_verb *init_verbs[5]; |
| 391 | unsigned int num_dacs; |
| 392 | hda_nid_t *dac_nids; |
| 393 | hda_nid_t dig_out_nid; /* optional */ |
| 394 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 395 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 396 | unsigned int num_adc_nids; |
| 397 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 398 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 399 | hda_nid_t dig_in_nid; |
| 400 | unsigned int num_channel_mode; |
| 401 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 402 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 403 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 404 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 405 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 406 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 407 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 408 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 409 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 410 | struct hda_amp_list *loopbacks; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 411 | void (*power_hook)(struct hda_codec *codec); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 412 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | }; |
| 414 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
| 416 | /* |
| 417 | * input MUX handling |
| 418 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 419 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 420 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | { |
| 422 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 423 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 424 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 425 | if (mux_idx >= spec->num_mux_defs) |
| 426 | mux_idx = 0; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 427 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) |
| 428 | mux_idx = 0; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 429 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | } |
| 431 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 432 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 433 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | { |
| 435 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 436 | struct alc_spec *spec = codec->spec; |
| 437 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 438 | |
| 439 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 440 | return 0; |
| 441 | } |
| 442 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 443 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 444 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | { |
| 446 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 447 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 448 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 450 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 451 | hda_nid_t nid = spec->capsrc_nids ? |
| 452 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 453 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 455 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 456 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 457 | if (!imux->num_items && mux_idx > 0) |
| 458 | imux = &spec->input_mux[0]; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 459 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 460 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 461 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 462 | /* Matrix-mixer style (e.g. ALC882) */ |
| 463 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 464 | unsigned int i, idx; |
| 465 | |
| 466 | idx = ucontrol->value.enumerated.item[0]; |
| 467 | if (idx >= imux->num_items) |
| 468 | idx = imux->num_items - 1; |
| 469 | if (*cur_val == idx) |
| 470 | return 0; |
| 471 | for (i = 0; i < imux->num_items; i++) { |
| 472 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 473 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 474 | imux->items[i].index, |
| 475 | HDA_AMP_MUTE, v); |
| 476 | } |
| 477 | *cur_val = idx; |
| 478 | return 1; |
| 479 | } else { |
| 480 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 481 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 482 | &spec->cur_mux[adc_idx]); |
| 483 | } |
| 484 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | /* |
| 487 | * channel mode setting |
| 488 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 489 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 490 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | { |
| 492 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 493 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 494 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 495 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | } |
| 497 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 498 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 499 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | { |
| 501 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 502 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 503 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 504 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 505 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | } |
| 507 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 508 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 509 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | { |
| 511 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 512 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 513 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 514 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 515 | &spec->ext_channel_count); |
| 516 | if (err >= 0 && !spec->const_channel_count) { |
| 517 | spec->multiout.max_channels = spec->ext_channel_count; |
| 518 | if (spec->need_dac_fix) |
| 519 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 520 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 521 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | } |
| 523 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 525 | * 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] | 526 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 527 | * being part of a format specifier. Maximum allowed length of a value is |
| 528 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 529 | * |
| 530 | * Note: some retasking pin complexes seem to ignore requests for input |
| 531 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 532 | * are requested. Therefore order this list so that this behaviour will not |
| 533 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 534 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 535 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 536 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 537 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 538 | "Mic 50pc bias", "Mic 80pc bias", |
| 539 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 540 | }; |
| 541 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 542 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 543 | }; |
| 544 | /* 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] | 545 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 546 | * addition, "input" pins may or may not process the mic bias option |
| 547 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 548 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 549 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 550 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 551 | #define ALC_PIN_DIR_IN 0x00 |
| 552 | #define ALC_PIN_DIR_OUT 0x01 |
| 553 | #define ALC_PIN_DIR_INOUT 0x02 |
| 554 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 555 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 556 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 557 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | * For each direction the minimum and maximum values are given. |
| 559 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 560 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 562 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 563 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 564 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 565 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | }; |
| 567 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 568 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 569 | #define alc_pin_mode_n_items(_dir) \ |
| 570 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 571 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 572 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 573 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 574 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 575 | unsigned int item_num = uinfo->value.enumerated.item; |
| 576 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 577 | |
| 578 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 579 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 580 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 581 | |
| 582 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 583 | item_num = alc_pin_mode_min(dir); |
| 584 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 585 | return 0; |
| 586 | } |
| 587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 590 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 592 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 593 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 594 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 595 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 596 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 597 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 598 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 599 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 600 | /* Find enumerated value for current pinctl setting */ |
| 601 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2ca | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 602 | 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] | 603 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | *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] | 605 | return 0; |
| 606 | } |
| 607 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 608 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 609 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 610 | { |
| 611 | signed int change; |
| 612 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 613 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 614 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 615 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 616 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 617 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 618 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 619 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 620 | 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] | 621 | val = alc_pin_mode_min(dir); |
| 622 | |
| 623 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 624 | if (change) { |
| 625 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 626 | snd_hda_codec_write_cache(codec, nid, 0, |
| 627 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 628 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 629 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 630 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 631 | * for the requested pin mode. Enum values of 2 or less are |
| 632 | * input modes. |
| 633 | * |
| 634 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 635 | * reduces noise slightly (particularly on input) so we'll |
| 636 | * do it. However, having both input and output buffers |
| 637 | * enabled simultaneously doesn't seem to be problematic if |
| 638 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 639 | */ |
| 640 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 641 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 642 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 643 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 644 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 645 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 646 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 647 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 648 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 649 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 650 | } |
| 651 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 652 | return change; |
| 653 | } |
| 654 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 655 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 656 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 657 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 658 | .info = alc_pin_mode_info, \ |
| 659 | .get = alc_pin_mode_get, \ |
| 660 | .put = alc_pin_mode_put, \ |
| 661 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 662 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 663 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 664 | * together using a mask with more than one bit set. This control is |
| 665 | * currently used only by the ALC260 test model. At this stage they are not |
| 666 | * needed for any "production" models. |
| 667 | */ |
| 668 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 669 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 670 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 671 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 672 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 673 | { |
| 674 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 675 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 676 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 677 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 678 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 679 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 680 | |
| 681 | *valp = (val & mask) != 0; |
| 682 | return 0; |
| 683 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 684 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 685 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 686 | { |
| 687 | signed int change; |
| 688 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 689 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 690 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 691 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 692 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 693 | AC_VERB_GET_GPIO_DATA, |
| 694 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 695 | |
| 696 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 698 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 699 | gpio_data &= ~mask; |
| 700 | else |
| 701 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 702 | snd_hda_codec_write_cache(codec, nid, 0, |
| 703 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 704 | |
| 705 | return change; |
| 706 | } |
| 707 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 708 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 709 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 710 | .info = alc_gpio_data_info, \ |
| 711 | .get = alc_gpio_data_get, \ |
| 712 | .put = alc_gpio_data_put, \ |
| 713 | .private_value = nid | (mask<<16) } |
| 714 | #endif /* CONFIG_SND_DEBUG */ |
| 715 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 716 | /* A switch control to allow the enabling of the digital IO pins on the |
| 717 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 718 | * to provide something in the test model allowing digital outputs to be |
| 719 | * identified if present. If models are found which can utilise these |
| 720 | * outputs a more complete mixer control can be devised for those models if |
| 721 | * necessary. |
| 722 | */ |
| 723 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 724 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 725 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 726 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 727 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 728 | { |
| 729 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 730 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 731 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 732 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 733 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 734 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 735 | |
| 736 | *valp = (val & mask) != 0; |
| 737 | return 0; |
| 738 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 739 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 740 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 741 | { |
| 742 | signed int change; |
| 743 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 744 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 745 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 746 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 747 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 748 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 749 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 750 | |
| 751 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 752 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 753 | if (val==0) |
| 754 | ctrl_data &= ~mask; |
| 755 | else |
| 756 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 757 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 758 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 759 | |
| 760 | return change; |
| 761 | } |
| 762 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 763 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 764 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 765 | .info = alc_spdif_ctrl_info, \ |
| 766 | .get = alc_spdif_ctrl_get, \ |
| 767 | .put = alc_spdif_ctrl_put, \ |
| 768 | .private_value = nid | (mask<<16) } |
| 769 | #endif /* CONFIG_SND_DEBUG */ |
| 770 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 771 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 772 | * Again, this is only used in the ALC26x test models to help identify when |
| 773 | * the EAPD line must be asserted for features to work. |
| 774 | */ |
| 775 | #ifdef CONFIG_SND_DEBUG |
| 776 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 777 | |
| 778 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 779 | struct snd_ctl_elem_value *ucontrol) |
| 780 | { |
| 781 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 782 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 783 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 784 | long *valp = ucontrol->value.integer.value; |
| 785 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 786 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 787 | |
| 788 | *valp = (val & mask) != 0; |
| 789 | return 0; |
| 790 | } |
| 791 | |
| 792 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 793 | struct snd_ctl_elem_value *ucontrol) |
| 794 | { |
| 795 | int change; |
| 796 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 797 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 798 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 799 | long val = *ucontrol->value.integer.value; |
| 800 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 801 | AC_VERB_GET_EAPD_BTLENABLE, |
| 802 | 0x00); |
| 803 | |
| 804 | /* Set/unset the masked control bit(s) as needed */ |
| 805 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 806 | if (!val) |
| 807 | ctrl_data &= ~mask; |
| 808 | else |
| 809 | ctrl_data |= mask; |
| 810 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 811 | ctrl_data); |
| 812 | |
| 813 | return change; |
| 814 | } |
| 815 | |
| 816 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 817 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 818 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 819 | .info = alc_eapd_ctrl_info, \ |
| 820 | .get = alc_eapd_ctrl_get, \ |
| 821 | .put = alc_eapd_ctrl_put, \ |
| 822 | .private_value = nid | (mask<<16) } |
| 823 | #endif /* CONFIG_SND_DEBUG */ |
| 824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 825 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 826 | * set up the input pin config (depending on the given auto-pin type) |
| 827 | */ |
| 828 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 829 | int auto_pin_type) |
| 830 | { |
| 831 | unsigned int val = PIN_IN; |
| 832 | |
| 833 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 834 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 835 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 836 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 837 | if (pincap & AC_PINCAP_VREF_80) |
| 838 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 839 | else if (pincap & AC_PINCAP_VREF_50) |
| 840 | val = PIN_VREF50; |
| 841 | else if (pincap & AC_PINCAP_VREF_100) |
| 842 | val = PIN_VREF100; |
| 843 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 844 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 845 | } |
| 846 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 847 | } |
| 848 | |
| 849 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 850 | */ |
| 851 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 852 | { |
| 853 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 854 | return; |
| 855 | spec->mixers[spec->num_mixers++] = mix; |
| 856 | } |
| 857 | |
| 858 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 859 | { |
| 860 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 861 | return; |
| 862 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 863 | } |
| 864 | |
| 865 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 866 | * set up from the preset table |
| 867 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 868 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 869 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 871 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 872 | int i; |
| 873 | |
| 874 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 875 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 876 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 877 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 878 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 879 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 880 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 881 | spec->channel_mode = preset->channel_mode; |
| 882 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 883 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 884 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 886 | if (preset->const_channel_count) |
| 887 | spec->multiout.max_channels = preset->const_channel_count; |
| 888 | else |
| 889 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 890 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 891 | |
| 892 | spec->multiout.num_dacs = preset->num_dacs; |
| 893 | spec->multiout.dac_nids = preset->dac_nids; |
| 894 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 895 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 896 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 897 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 898 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 899 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 900 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 901 | spec->input_mux = preset->input_mux; |
| 902 | |
| 903 | spec->num_adc_nids = preset->num_adc_nids; |
| 904 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 905 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 906 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 907 | |
| 908 | spec->unsol_event = preset->unsol_event; |
| 909 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 910 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 911 | spec->power_hook = preset->power_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 912 | spec->loopback.amplist = preset->loopbacks; |
| 913 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 914 | |
| 915 | if (preset->setup) |
| 916 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 917 | } |
| 918 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 919 | /* Enable GPIO mask and set output */ |
| 920 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 921 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 922 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 923 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 924 | { } |
| 925 | }; |
| 926 | |
| 927 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 928 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 929 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 930 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 931 | { } |
| 932 | }; |
| 933 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 934 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 935 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 936 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 937 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 938 | { } |
| 939 | }; |
| 940 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 941 | /* |
| 942 | * Fix hardware PLL issue |
| 943 | * On some codecs, the analog PLL gating control must be off while |
| 944 | * the default value is 1. |
| 945 | */ |
| 946 | static void alc_fix_pll(struct hda_codec *codec) |
| 947 | { |
| 948 | struct alc_spec *spec = codec->spec; |
| 949 | unsigned int val; |
| 950 | |
| 951 | if (!spec->pll_nid) |
| 952 | return; |
| 953 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 954 | spec->pll_coef_idx); |
| 955 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 956 | AC_VERB_GET_PROC_COEF, 0); |
| 957 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 958 | spec->pll_coef_idx); |
| 959 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 960 | val & ~(1 << spec->pll_coef_bit)); |
| 961 | } |
| 962 | |
| 963 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 964 | unsigned int coef_idx, unsigned int coef_bit) |
| 965 | { |
| 966 | struct alc_spec *spec = codec->spec; |
| 967 | spec->pll_nid = nid; |
| 968 | spec->pll_coef_idx = coef_idx; |
| 969 | spec->pll_coef_bit = coef_bit; |
| 970 | alc_fix_pll(codec); |
| 971 | } |
| 972 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 973 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 974 | { |
| 975 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 976 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 977 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 978 | |
Takashi Iwai | ad87c64 | 2009-11-02 14:23:15 +0100 | [diff] [blame] | 979 | if (!nid) |
| 980 | return; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 981 | spec->jack_present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 982 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 983 | nid = spec->autocfg.speaker_pins[i]; |
| 984 | if (!nid) |
| 985 | break; |
| 986 | snd_hda_codec_write(codec, nid, 0, |
| 987 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 988 | spec->jack_present ? 0 : PIN_OUT); |
| 989 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 990 | } |
| 991 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 992 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 993 | hda_nid_t nid) |
| 994 | { |
| 995 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 996 | int i, nums; |
| 997 | |
| 998 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 999 | for (i = 0; i < nums; i++) |
| 1000 | if (conn[i] == nid) |
| 1001 | return i; |
| 1002 | return -1; |
| 1003 | } |
| 1004 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1005 | static void alc_mic_automute(struct hda_codec *codec) |
| 1006 | { |
| 1007 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1008 | struct alc_mic_route *dead, *alive; |
| 1009 | unsigned int present, type; |
| 1010 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1011 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1012 | if (!spec->auto_mic) |
| 1013 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1014 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1015 | return; |
| 1016 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1017 | return; |
| 1018 | |
| 1019 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1020 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1021 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1022 | if (present) { |
| 1023 | alive = &spec->ext_mic; |
| 1024 | dead = &spec->int_mic; |
| 1025 | } else { |
| 1026 | alive = &spec->int_mic; |
| 1027 | dead = &spec->ext_mic; |
| 1028 | } |
| 1029 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1030 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1031 | if (type == AC_WID_AUD_MIX) { |
| 1032 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1033 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1034 | alive->mux_idx, |
| 1035 | HDA_AMP_MUTE, 0); |
| 1036 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1037 | dead->mux_idx, |
| 1038 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1039 | } else { |
| 1040 | /* MUX style (e.g. ALC880) */ |
| 1041 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1042 | AC_VERB_SET_CONNECT_SEL, |
| 1043 | alive->mux_idx); |
| 1044 | } |
| 1045 | |
| 1046 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1047 | } |
| 1048 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1049 | /* unsolicited event for HP jack sensing */ |
| 1050 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1051 | { |
| 1052 | if (codec->vendor_id == 0x10ec0880) |
| 1053 | res >>= 28; |
| 1054 | else |
| 1055 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1056 | switch (res) { |
| 1057 | case ALC880_HP_EVENT: |
| 1058 | alc_automute_pin(codec); |
| 1059 | break; |
| 1060 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1061 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1062 | break; |
| 1063 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | static void alc_inithook(struct hda_codec *codec) |
| 1067 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1068 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1069 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1070 | } |
| 1071 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1072 | /* additional initialization for ALC888 variants */ |
| 1073 | static void alc888_coef_init(struct hda_codec *codec) |
| 1074 | { |
| 1075 | unsigned int tmp; |
| 1076 | |
| 1077 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1078 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1079 | 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] | 1080 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1081 | /* alc888S-VC */ |
| 1082 | snd_hda_codec_read(codec, 0x20, 0, |
| 1083 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1084 | else |
| 1085 | /* alc888-VB */ |
| 1086 | snd_hda_codec_read(codec, 0x20, 0, |
| 1087 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1088 | } |
| 1089 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1090 | static void alc889_coef_init(struct hda_codec *codec) |
| 1091 | { |
| 1092 | unsigned int tmp; |
| 1093 | |
| 1094 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1095 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1096 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1098 | } |
| 1099 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1100 | /* turn on/off EAPD control (only if available) */ |
| 1101 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 1102 | { |
| 1103 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 1104 | return; |
| 1105 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 1106 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 1107 | on ? 2 : 0); |
| 1108 | } |
| 1109 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1110 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1111 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1112 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1113 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1114 | switch (type) { |
| 1115 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1117 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1118 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1119 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1120 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1121 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1122 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1123 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1124 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1125 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | case 0x10ec0260: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1127 | set_eapd(codec, 0x0f, 1); |
| 1128 | set_eapd(codec, 0x10, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1129 | break; |
| 1130 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1131 | case 0x10ec0267: |
| 1132 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | case 0x10ec0269: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1134 | case 0x10ec0270: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1135 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1136 | case 0x10ec0660: |
| 1137 | case 0x10ec0662: |
| 1138 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1139 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1140 | case 0x10ec0889: |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 1141 | set_eapd(codec, 0x14, 1); |
| 1142 | set_eapd(codec, 0x15, 1); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1143 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1144 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1145 | switch (codec->vendor_id) { |
| 1146 | case 0x10ec0260: |
| 1147 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1148 | AC_VERB_SET_COEF_INDEX, 7); |
| 1149 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1150 | AC_VERB_GET_PROC_COEF, 0); |
| 1151 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1152 | AC_VERB_SET_COEF_INDEX, 7); |
| 1153 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1154 | AC_VERB_SET_PROC_COEF, |
| 1155 | tmp | 0x2010); |
| 1156 | break; |
| 1157 | case 0x10ec0262: |
| 1158 | case 0x10ec0880: |
| 1159 | case 0x10ec0882: |
| 1160 | case 0x10ec0883: |
| 1161 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1162 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1163 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1164 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1165 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1166 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1167 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1168 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1169 | #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] | 1170 | case 0x10ec0267: |
| 1171 | case 0x10ec0268: |
| 1172 | snd_hda_codec_write(codec, 0x20, 0, |
| 1173 | AC_VERB_SET_COEF_INDEX, 7); |
| 1174 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1175 | AC_VERB_GET_PROC_COEF, 0); |
| 1176 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1177 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | snd_hda_codec_write(codec, 0x20, 0, |
| 1179 | AC_VERB_SET_PROC_COEF, |
| 1180 | tmp | 0x3000); |
| 1181 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 1182 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1183 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1184 | break; |
| 1185 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1186 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1187 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1188 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1189 | { |
| 1190 | struct alc_spec *spec = codec->spec; |
| 1191 | |
| 1192 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1193 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1194 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1195 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1196 | if (spec->autocfg.line_out_pins[0] && |
| 1197 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1198 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1199 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1200 | else |
| 1201 | return; |
| 1202 | } |
| 1203 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1204 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1205 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1206 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1207 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1208 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1209 | spec->unsol_event = alc_sku_unsol_event; |
| 1210 | } |
| 1211 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1212 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1213 | { |
| 1214 | struct alc_spec *spec = codec->spec; |
| 1215 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1216 | hda_nid_t fixed, ext; |
| 1217 | int i; |
| 1218 | |
| 1219 | /* there must be only two mic inputs exclusively */ |
| 1220 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1221 | if (cfg->input_pins[i]) |
| 1222 | return; |
| 1223 | |
| 1224 | fixed = ext = 0; |
| 1225 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1226 | hda_nid_t nid = cfg->input_pins[i]; |
| 1227 | unsigned int defcfg; |
| 1228 | if (!nid) |
| 1229 | return; |
| 1230 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1231 | switch (get_defcfg_connect(defcfg)) { |
| 1232 | case AC_JACK_PORT_FIXED: |
| 1233 | if (fixed) |
| 1234 | return; /* already occupied */ |
| 1235 | fixed = nid; |
| 1236 | break; |
| 1237 | case AC_JACK_PORT_COMPLEX: |
| 1238 | if (ext) |
| 1239 | return; /* already occupied */ |
| 1240 | ext = nid; |
| 1241 | break; |
| 1242 | default: |
| 1243 | return; /* invalid entry */ |
| 1244 | } |
| 1245 | } |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 1246 | if (!ext || !fixed) |
| 1247 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1248 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1249 | return; /* no unsol support */ |
| 1250 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1251 | ext, fixed); |
| 1252 | spec->ext_mic.pin = ext; |
| 1253 | spec->int_mic.pin = fixed; |
| 1254 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1255 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1256 | spec->auto_mic = 1; |
| 1257 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1258 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1259 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1260 | spec->unsol_event = alc_sku_unsol_event; |
| 1261 | } |
| 1262 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1263 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 1264 | { |
| 1265 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 1266 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 1267 | struct alc_spec *spec = codec->spec; |
| 1268 | |
| 1269 | ass = codec->subsystem_id & 0xffff; |
| 1270 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
| 1271 | goto do_sku; |
| 1272 | |
| 1273 | nid = 0x1d; |
| 1274 | if (codec->vendor_id == 0x10ec0260) |
| 1275 | nid = 0x17; |
| 1276 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1277 | |
| 1278 | if (!(ass & 1)) { |
| 1279 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 1280 | codec->chip_name, ass); |
| 1281 | return -1; |
| 1282 | } |
| 1283 | |
| 1284 | /* check sum */ |
| 1285 | tmp = 0; |
| 1286 | for (i = 1; i < 16; i++) { |
| 1287 | if ((ass >> i) & 1) |
| 1288 | tmp++; |
| 1289 | } |
| 1290 | if (((ass >> 16) & 0xf) != tmp) |
| 1291 | return -1; |
| 1292 | |
| 1293 | spec->cdefine.port_connectivity = ass >> 30; |
| 1294 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 1295 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 1296 | spec->cdefine.customization = ass >> 8; |
| 1297 | do_sku: |
| 1298 | spec->cdefine.sku_cfg = ass; |
| 1299 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 1300 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 1301 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 1302 | spec->cdefine.override = ass & 0x1; |
| 1303 | |
| 1304 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 1305 | nid, spec->cdefine.sku_cfg); |
| 1306 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 1307 | spec->cdefine.port_connectivity); |
| 1308 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 1309 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 1310 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 1311 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 1312 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 1313 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 1314 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 1315 | |
| 1316 | return 0; |
| 1317 | } |
| 1318 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1319 | /* check subsystem ID and set up device-specific initialization; |
| 1320 | * return 1 if initialized, 0 if invalid SSID |
| 1321 | */ |
| 1322 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1323 | * 31 ~ 16 : Manufacture ID |
| 1324 | * 15 ~ 8 : SKU ID |
| 1325 | * 7 ~ 0 : Assembly ID |
| 1326 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1327 | */ |
| 1328 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1329 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1330 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1331 | { |
| 1332 | unsigned int ass, tmp, i; |
| 1333 | unsigned nid; |
| 1334 | struct alc_spec *spec = codec->spec; |
| 1335 | |
| 1336 | ass = codec->subsystem_id & 0xffff; |
| 1337 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1338 | goto do_sku; |
| 1339 | |
| 1340 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1341 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1342 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1343 | * 29~21 : reserve |
| 1344 | * 20 : PCBEEP input |
| 1345 | * 19~16 : Check sum (15:1) |
| 1346 | * 15~1 : Custom |
| 1347 | * 0 : override |
| 1348 | */ |
| 1349 | nid = 0x1d; |
| 1350 | if (codec->vendor_id == 0x10ec0260) |
| 1351 | nid = 0x17; |
| 1352 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1353 | snd_printd("realtek: No valid SSID, " |
| 1354 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1355 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1356 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1357 | return 0; |
| 1358 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1359 | return 0; |
| 1360 | |
| 1361 | /* check sum */ |
| 1362 | tmp = 0; |
| 1363 | for (i = 1; i < 16; i++) { |
| 1364 | if ((ass >> i) & 1) |
| 1365 | tmp++; |
| 1366 | } |
| 1367 | if (((ass >> 16) & 0xf) != tmp) |
| 1368 | return 0; |
| 1369 | do_sku: |
| 1370 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1371 | ass & 0xffff, codec->vendor_id); |
| 1372 | /* |
| 1373 | * 0 : override |
| 1374 | * 1 : Swap Jack |
| 1375 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1376 | * 3~5 : External Amplifier control |
| 1377 | * 7~6 : Reserved |
| 1378 | */ |
| 1379 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1380 | switch (tmp) { |
| 1381 | case 1: |
| 1382 | spec->init_amp = ALC_INIT_GPIO1; |
| 1383 | break; |
| 1384 | case 3: |
| 1385 | spec->init_amp = ALC_INIT_GPIO2; |
| 1386 | break; |
| 1387 | case 7: |
| 1388 | spec->init_amp = ALC_INIT_GPIO3; |
| 1389 | break; |
| 1390 | case 5: |
| 1391 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1392 | break; |
| 1393 | } |
| 1394 | |
| 1395 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1396 | * when the external headphone out jack is plugged" |
| 1397 | */ |
| 1398 | if (!(ass & 0x8000)) |
| 1399 | return 1; |
| 1400 | /* |
| 1401 | * 10~8 : Jack location |
| 1402 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1403 | * 14~13: Resvered |
| 1404 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1405 | * when the external headphone out jack is plugged" |
| 1406 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1407 | if (!spec->autocfg.hp_pins[0]) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1408 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1409 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1410 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1411 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1412 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1413 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1414 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1415 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1416 | else if (tmp == 3) |
| 1417 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1418 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1419 | return 1; |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 1420 | for (i = 0; i < spec->autocfg.line_outs; i++) |
| 1421 | if (spec->autocfg.line_out_pins[i] == nid) |
| 1422 | return 1; |
| 1423 | spec->autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1424 | } |
| 1425 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1426 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1427 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1428 | return 1; |
| 1429 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1430 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1431 | static void alc_ssid_check(struct hda_codec *codec, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1432 | hda_nid_t porta, hda_nid_t porte, |
| 1433 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1434 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 1435 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1436 | struct alc_spec *spec = codec->spec; |
| 1437 | snd_printd("realtek: " |
| 1438 | "Enable default setup for auto mode as fallback\n"); |
| 1439 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1440 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1441 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1442 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1443 | } |
| 1444 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1445 | /* |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1446 | * Fix-up pin default configurations and add default verbs |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1447 | */ |
| 1448 | |
| 1449 | struct alc_pincfg { |
| 1450 | hda_nid_t nid; |
| 1451 | u32 val; |
| 1452 | }; |
| 1453 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1454 | struct alc_fixup { |
| 1455 | const struct alc_pincfg *pins; |
| 1456 | const struct hda_verb *verbs; |
| 1457 | }; |
| 1458 | |
| 1459 | static void alc_pick_fixup(struct hda_codec *codec, |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1460 | const struct snd_pci_quirk *quirk, |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1461 | const struct alc_fixup *fix) |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1462 | { |
| 1463 | const struct alc_pincfg *cfg; |
| 1464 | |
| 1465 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1466 | if (!quirk) |
| 1467 | return; |
| 1468 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 1469 | fix += quirk->value; |
| 1470 | cfg = fix->pins; |
| 1471 | if (cfg) { |
| 1472 | for (; cfg->nid; cfg++) |
| 1473 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
| 1474 | } |
| 1475 | if (fix->verbs) |
| 1476 | add_verb(codec->spec, fix->verbs); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1477 | } |
| 1478 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 1479 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 1480 | unsigned int coef_idx) |
| 1481 | { |
| 1482 | unsigned int val; |
| 1483 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 1484 | coef_idx); |
| 1485 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 1486 | AC_VERB_GET_PROC_COEF, 0); |
| 1487 | return val; |
| 1488 | } |
| 1489 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1490 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1491 | * ALC888 |
| 1492 | */ |
| 1493 | |
| 1494 | /* |
| 1495 | * 2ch mode |
| 1496 | */ |
| 1497 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1498 | /* Mic-in jack as mic in */ |
| 1499 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1500 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1501 | /* Line-in jack as Line in */ |
| 1502 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1503 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1504 | /* Line-Out as Front */ |
| 1505 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1506 | { } /* end */ |
| 1507 | }; |
| 1508 | |
| 1509 | /* |
| 1510 | * 4ch mode |
| 1511 | */ |
| 1512 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1513 | /* Mic-in jack as mic in */ |
| 1514 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1515 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1516 | /* Line-in jack as Surround */ |
| 1517 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1518 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1519 | /* Line-Out as Front */ |
| 1520 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1521 | { } /* end */ |
| 1522 | }; |
| 1523 | |
| 1524 | /* |
| 1525 | * 6ch mode |
| 1526 | */ |
| 1527 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1528 | /* Mic-in jack as CLFE */ |
| 1529 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1530 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1531 | /* Line-in jack as Surround */ |
| 1532 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1533 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1534 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1535 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1536 | { } /* end */ |
| 1537 | }; |
| 1538 | |
| 1539 | /* |
| 1540 | * 8ch mode |
| 1541 | */ |
| 1542 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1543 | /* Mic-in jack as CLFE */ |
| 1544 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1545 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1546 | /* Line-in jack as Surround */ |
| 1547 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1548 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1549 | /* Line-Out as Side */ |
| 1550 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1551 | { } /* end */ |
| 1552 | }; |
| 1553 | |
| 1554 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1555 | { 2, alc888_4ST_ch2_intel_init }, |
| 1556 | { 4, alc888_4ST_ch4_intel_init }, |
| 1557 | { 6, alc888_4ST_ch6_intel_init }, |
| 1558 | { 8, alc888_4ST_ch8_intel_init }, |
| 1559 | }; |
| 1560 | |
| 1561 | /* |
| 1562 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1563 | */ |
| 1564 | |
| 1565 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1566 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1567 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1568 | /* Connect Internal HP to Front */ |
| 1569 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1570 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1571 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1572 | /* Connect Bass HP to Front */ |
| 1573 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1576 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1577 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1578 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1579 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1580 | /* Connect Mic jack to CLFE */ |
| 1581 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1582 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1583 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1584 | /* Connect Line-in jack to Surround */ |
| 1585 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1586 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1587 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1588 | /* Connect HP out jack to Front */ |
| 1589 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1590 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1591 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1592 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1593 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1594 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1595 | {} |
| 1596 | }; |
| 1597 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1598 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1599 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1600 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1601 | unsigned int mute; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1602 | hda_nid_t nid; |
| 1603 | int i; |
| 1604 | |
| 1605 | spec->jack_present = 0; |
| 1606 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1607 | nid = spec->autocfg.hp_pins[i]; |
| 1608 | if (!nid) |
| 1609 | break; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 1610 | if (snd_hda_jack_detect(codec, nid)) { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1611 | spec->jack_present = 1; |
| 1612 | break; |
| 1613 | } |
| 1614 | } |
| 1615 | |
| 1616 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1617 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1618 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1619 | nid = spec->autocfg.speaker_pins[i]; |
| 1620 | if (!nid) |
| 1621 | break; |
| 1622 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1623 | HDA_AMP_MUTE, mute); |
| 1624 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1625 | } |
| 1626 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1627 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1628 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1629 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1630 | if (codec->vendor_id == 0x10ec0880) |
| 1631 | res >>= 28; |
| 1632 | else |
| 1633 | res >>= 26; |
| 1634 | if (res == ALC880_HP_EVENT) |
| 1635 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1636 | } |
| 1637 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1638 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1639 | { |
| 1640 | struct alc_spec *spec = codec->spec; |
| 1641 | |
| 1642 | spec->autocfg.hp_pins[0] = 0x15; |
| 1643 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1644 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1645 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1646 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1647 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1648 | } |
| 1649 | |
| 1650 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1651 | { |
| 1652 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1653 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1654 | } |
| 1655 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1656 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1657 | { |
| 1658 | struct alc_spec *spec = codec->spec; |
| 1659 | |
| 1660 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1661 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1662 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1663 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1664 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1665 | |
| 1666 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1667 | * ALC888 Acer Aspire 4930G model |
| 1668 | */ |
| 1669 | |
| 1670 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1671 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1672 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1673 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1675 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1676 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1677 | /* Connect Internal HP to front */ |
| 1678 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1679 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1680 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1681 | /* Connect HP out to front */ |
| 1682 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1683 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1684 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1685 | { } |
| 1686 | }; |
| 1687 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1688 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1689 | * ALC888 Acer Aspire 6530G model |
| 1690 | */ |
| 1691 | |
| 1692 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1693 | /* Bias voltage on for external mic port */ |
| 1694 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1695 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1696 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1697 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1698 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1699 | /* Enable unsolicited event for HP jack */ |
| 1700 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1701 | /* Enable speaker output */ |
| 1702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1704 | /* Enable headphone output */ |
| 1705 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1706 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1708 | { } |
| 1709 | }; |
| 1710 | |
| 1711 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1712 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1713 | */ |
| 1714 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1715 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1716 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1717 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1718 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1720 | /* Enable unsolicited event for HP jack */ |
| 1721 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1722 | /* Connect Internal Front to Front */ |
| 1723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1724 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1725 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1726 | /* Connect Internal Rear to Rear */ |
| 1727 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1728 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1729 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1730 | /* Connect Internal CLFE to CLFE */ |
| 1731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1733 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1734 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1735 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1736 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1737 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1738 | /* Enable all DACs */ |
| 1739 | /* DAC DISABLE/MUTE 1? */ |
| 1740 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1741 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1742 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1743 | /* DAC DISABLE/MUTE 2? */ |
| 1744 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1745 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1746 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1747 | /* DMIC fix |
| 1748 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1749 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1750 | * makes the signal become a difference/sum signal instead of standard |
| 1751 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1752 | * codec replicate the sum signal to both channels, turning it into a |
| 1753 | * normal mono mic. |
| 1754 | */ |
| 1755 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1756 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1757 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1758 | { } |
| 1759 | }; |
| 1760 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1761 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1762 | /* Front mic only available on one ADC */ |
| 1763 | { |
| 1764 | .num_items = 4, |
| 1765 | .items = { |
| 1766 | { "Mic", 0x0 }, |
| 1767 | { "Line", 0x2 }, |
| 1768 | { "CD", 0x4 }, |
| 1769 | { "Front Mic", 0xb }, |
| 1770 | }, |
| 1771 | }, |
| 1772 | { |
| 1773 | .num_items = 3, |
| 1774 | .items = { |
| 1775 | { "Mic", 0x0 }, |
| 1776 | { "Line", 0x2 }, |
| 1777 | { "CD", 0x4 }, |
| 1778 | }, |
| 1779 | } |
| 1780 | }; |
| 1781 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1782 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1783 | /* Interal mic only available on one ADC */ |
| 1784 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1785 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1786 | .items = { |
| 1787 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1788 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1789 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1790 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1791 | { "Int Mic", 0xb }, |
| 1792 | }, |
| 1793 | }, |
| 1794 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1795 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1796 | .items = { |
| 1797 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1798 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1799 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1800 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1801 | }, |
| 1802 | } |
| 1803 | }; |
| 1804 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1805 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1806 | /* Digital mic only available on first "ADC" */ |
| 1807 | { |
| 1808 | .num_items = 5, |
| 1809 | .items = { |
| 1810 | { "Mic", 0x0 }, |
| 1811 | { "Line", 0x2 }, |
| 1812 | { "CD", 0x4 }, |
| 1813 | { "Front Mic", 0xb }, |
| 1814 | { "Input Mix", 0xa }, |
| 1815 | }, |
| 1816 | }, |
| 1817 | { |
| 1818 | .num_items = 4, |
| 1819 | .items = { |
| 1820 | { "Mic", 0x0 }, |
| 1821 | { "Line", 0x2 }, |
| 1822 | { "CD", 0x4 }, |
| 1823 | { "Input Mix", 0xa }, |
| 1824 | }, |
| 1825 | }, |
| 1826 | { |
| 1827 | .num_items = 4, |
| 1828 | .items = { |
| 1829 | { "Mic", 0x0 }, |
| 1830 | { "Line", 0x2 }, |
| 1831 | { "CD", 0x4 }, |
| 1832 | { "Input Mix", 0xa }, |
| 1833 | }, |
| 1834 | } |
| 1835 | }; |
| 1836 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1837 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1838 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1839 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1840 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1841 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1842 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1843 | HDA_OUTPUT), |
| 1844 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1845 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1846 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1847 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1848 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1849 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1850 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1851 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1852 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1853 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1854 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1855 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1856 | { } /* end */ |
| 1857 | }; |
| 1858 | |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 1859 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
| 1860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1861 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1862 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1863 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1864 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1865 | HDA_OUTPUT), |
| 1866 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1867 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1868 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1869 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1870 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1872 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1873 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1874 | { } /* end */ |
| 1875 | }; |
| 1876 | |
| 1877 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1878 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1879 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1880 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1881 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1882 | spec->autocfg.hp_pins[0] = 0x15; |
| 1883 | spec->autocfg.speaker_pins[0] = 0x14; |
Łukasz Wojniłowicz | 7cef4cf | 2009-11-20 12:14:35 +0100 | [diff] [blame] | 1884 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1885 | spec->autocfg.speaker_pins[2] = 0x17; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1886 | } |
| 1887 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1888 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1889 | { |
| 1890 | struct alc_spec *spec = codec->spec; |
| 1891 | |
| 1892 | spec->autocfg.hp_pins[0] = 0x15; |
| 1893 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1894 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1895 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1896 | } |
| 1897 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1898 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1899 | { |
| 1900 | struct alc_spec *spec = codec->spec; |
| 1901 | |
| 1902 | spec->autocfg.hp_pins[0] = 0x15; |
| 1903 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1904 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1905 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1906 | } |
| 1907 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1908 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1909 | * ALC880 3-stack model |
| 1910 | * |
| 1911 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1912 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1913 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1914 | */ |
| 1915 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1916 | static hda_nid_t alc880_dac_nids[4] = { |
| 1917 | /* front, rear, clfe, rear_surr */ |
| 1918 | 0x02, 0x05, 0x04, 0x03 |
| 1919 | }; |
| 1920 | |
| 1921 | static hda_nid_t alc880_adc_nids[3] = { |
| 1922 | /* ADC0-2 */ |
| 1923 | 0x07, 0x08, 0x09, |
| 1924 | }; |
| 1925 | |
| 1926 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1927 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1928 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1929 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1930 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1931 | /* ADC1-2 */ |
| 1932 | 0x08, 0x09, |
| 1933 | }; |
| 1934 | |
| 1935 | #define ALC880_DIGOUT_NID 0x06 |
| 1936 | #define ALC880_DIGIN_NID 0x0a |
| 1937 | |
| 1938 | static struct hda_input_mux alc880_capture_source = { |
| 1939 | .num_items = 4, |
| 1940 | .items = { |
| 1941 | { "Mic", 0x0 }, |
| 1942 | { "Front Mic", 0x3 }, |
| 1943 | { "Line", 0x2 }, |
| 1944 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1945 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1946 | }; |
| 1947 | |
| 1948 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1949 | /* 2ch mode */ |
| 1950 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1951 | /* set line-in to input, mute it */ |
| 1952 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1953 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1954 | /* set mic-in to input vref 80%, mute it */ |
| 1955 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1956 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1957 | { } /* end */ |
| 1958 | }; |
| 1959 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1960 | /* 6ch mode */ |
| 1961 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1962 | /* set line-in to output, unmute it */ |
| 1963 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1964 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1965 | /* set mic-in to output, unmute it */ |
| 1966 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1967 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1968 | { } /* end */ |
| 1969 | }; |
| 1970 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1971 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1972 | { 2, alc880_threestack_ch2_init }, |
| 1973 | { 6, alc880_threestack_ch6_init }, |
| 1974 | }; |
| 1975 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1976 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1977 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1978 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1979 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1980 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1981 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1982 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1983 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1984 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1985 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1986 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1987 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1988 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1992 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1993 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1994 | { |
| 1995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1996 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1997 | .info = alc_ch_mode_info, |
| 1998 | .get = alc_ch_mode_get, |
| 1999 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2000 | }, |
| 2001 | { } /* end */ |
| 2002 | }; |
| 2003 | |
| 2004 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2005 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 2006 | struct snd_ctl_elem_info *uinfo) |
| 2007 | { |
| 2008 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2009 | struct alc_spec *spec = codec->spec; |
| 2010 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2011 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2012 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2013 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2014 | HDA_INPUT); |
| 2015 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2016 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2017 | return err; |
| 2018 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2019 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2020 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 2021 | unsigned int size, unsigned int __user *tlv) |
| 2022 | { |
| 2023 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2024 | struct alc_spec *spec = codec->spec; |
| 2025 | int err; |
| 2026 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2027 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2028 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 2029 | HDA_INPUT); |
| 2030 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2031 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2032 | return err; |
| 2033 | } |
| 2034 | |
| 2035 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 2036 | struct snd_ctl_elem_value *ucontrol); |
| 2037 | |
| 2038 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 2039 | struct snd_ctl_elem_value *ucontrol, |
| 2040 | getput_call_t func) |
| 2041 | { |
| 2042 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2043 | struct alc_spec *spec = codec->spec; |
| 2044 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 2045 | int err; |
| 2046 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2047 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2048 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 2049 | 3, 0, HDA_INPUT); |
| 2050 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 2051 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2052 | return err; |
| 2053 | } |
| 2054 | |
| 2055 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 2056 | struct snd_ctl_elem_value *ucontrol) |
| 2057 | { |
| 2058 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2059 | snd_hda_mixer_amp_volume_get); |
| 2060 | } |
| 2061 | |
| 2062 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 2063 | struct snd_ctl_elem_value *ucontrol) |
| 2064 | { |
| 2065 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2066 | snd_hda_mixer_amp_volume_put); |
| 2067 | } |
| 2068 | |
| 2069 | /* capture mixer elements */ |
| 2070 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 2071 | |
| 2072 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 2073 | struct snd_ctl_elem_value *ucontrol) |
| 2074 | { |
| 2075 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2076 | snd_hda_mixer_amp_switch_get); |
| 2077 | } |
| 2078 | |
| 2079 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 2080 | struct snd_ctl_elem_value *ucontrol) |
| 2081 | { |
| 2082 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 2083 | snd_hda_mixer_amp_switch_put); |
| 2084 | } |
| 2085 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2086 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2087 | { \ |
| 2088 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2089 | .name = "Capture Switch", \ |
| 2090 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 2091 | .count = num, \ |
| 2092 | .info = alc_cap_sw_info, \ |
| 2093 | .get = alc_cap_sw_get, \ |
| 2094 | .put = alc_cap_sw_put, \ |
| 2095 | }, \ |
| 2096 | { \ |
| 2097 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2098 | .name = "Capture Volume", \ |
| 2099 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 2100 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 2101 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 2102 | .count = num, \ |
| 2103 | .info = alc_cap_vol_info, \ |
| 2104 | .get = alc_cap_vol_get, \ |
| 2105 | .put = alc_cap_vol_put, \ |
| 2106 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2107 | } |
| 2108 | |
| 2109 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 2110 | { \ |
| 2111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2112 | /* .name = "Capture Source", */ \ |
| 2113 | .name = "Input Source", \ |
| 2114 | .count = num, \ |
| 2115 | .info = alc_mux_enum_info, \ |
| 2116 | .get = alc_mux_enum_get, \ |
| 2117 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2118 | } |
| 2119 | |
| 2120 | #define DEFINE_CAPMIX(num) \ |
| 2121 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2122 | _DEFINE_CAPMIX(num), \ |
| 2123 | _DEFINE_CAPSRC(num), \ |
| 2124 | { } /* end */ \ |
| 2125 | } |
| 2126 | |
| 2127 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2128 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2129 | _DEFINE_CAPMIX(num), \ |
| 2130 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2131 | } |
| 2132 | |
| 2133 | /* up to three ADCs */ |
| 2134 | DEFINE_CAPMIX(1); |
| 2135 | DEFINE_CAPMIX(2); |
| 2136 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2137 | DEFINE_CAPMIX_NOSRC(1); |
| 2138 | DEFINE_CAPMIX_NOSRC(2); |
| 2139 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2140 | |
| 2141 | /* |
| 2142 | * ALC880 5-stack model |
| 2143 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2144 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2145 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2146 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2147 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2148 | */ |
| 2149 | |
| 2150 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2151 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2152 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2153 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2154 | { } /* end */ |
| 2155 | }; |
| 2156 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2157 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2158 | /* 6ch mode */ |
| 2159 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2160 | /* set line-in to input, mute it */ |
| 2161 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2162 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2163 | { } /* end */ |
| 2164 | }; |
| 2165 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2166 | /* 8ch mode */ |
| 2167 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2168 | /* set line-in to output, unmute it */ |
| 2169 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2170 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2171 | { } /* end */ |
| 2172 | }; |
| 2173 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2174 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2175 | { 6, alc880_fivestack_ch6_init }, |
| 2176 | { 8, alc880_fivestack_ch8_init }, |
| 2177 | }; |
| 2178 | |
| 2179 | |
| 2180 | /* |
| 2181 | * ALC880 6-stack model |
| 2182 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2183 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2184 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2185 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2186 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2187 | */ |
| 2188 | |
| 2189 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2190 | /* front, rear, clfe, rear_surr */ |
| 2191 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2192 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2193 | |
| 2194 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2195 | .num_items = 4, |
| 2196 | .items = { |
| 2197 | { "Mic", 0x0 }, |
| 2198 | { "Front Mic", 0x1 }, |
| 2199 | { "Line", 0x2 }, |
| 2200 | { "CD", 0x4 }, |
| 2201 | }, |
| 2202 | }; |
| 2203 | |
| 2204 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2205 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2206 | { 8, NULL }, |
| 2207 | }; |
| 2208 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2209 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2210 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2211 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2212 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2213 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2214 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2215 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2216 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2217 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2218 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2219 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2228 | { |
| 2229 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2230 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2231 | .info = alc_ch_mode_info, |
| 2232 | .get = alc_ch_mode_get, |
| 2233 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2234 | }, |
| 2235 | { } /* end */ |
| 2236 | }; |
| 2237 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2238 | |
| 2239 | /* |
| 2240 | * ALC880 W810 model |
| 2241 | * |
| 2242 | * W810 has rear IO for: |
| 2243 | * Front (DAC 02) |
| 2244 | * Surround (DAC 03) |
| 2245 | * Center/LFE (DAC 04) |
| 2246 | * Digital out (06) |
| 2247 | * |
| 2248 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2249 | * 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] | 2250 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2251 | * There is a variable resistor to control the speaker or headphone |
| 2252 | * volume. This is a hardware-only device without a software API. |
| 2253 | * |
| 2254 | * Plugging headphones in will disable the internal speakers. This is |
| 2255 | * implemented in hardware, not via the driver using jack sense. In |
| 2256 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2257 | * disable both the speakers and headphones. |
| 2258 | * |
| 2259 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2260 | * These may not do anything useful with this driver yet, because I |
| 2261 | * haven't setup any initialization verbs for these yet... |
| 2262 | */ |
| 2263 | |
| 2264 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2265 | /* front, rear/surround, clfe */ |
| 2266 | 0x02, 0x03, 0x04 |
| 2267 | }; |
| 2268 | |
| 2269 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2270 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2271 | { 6, NULL } |
| 2272 | }; |
| 2273 | |
| 2274 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2275 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2276 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2277 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2278 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2279 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2280 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2281 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2282 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2283 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2284 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2285 | { } /* end */ |
| 2286 | }; |
| 2287 | |
| 2288 | |
| 2289 | /* |
| 2290 | * Z710V model |
| 2291 | * |
| 2292 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2293 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2294 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2295 | */ |
| 2296 | |
| 2297 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2298 | 0x02 |
| 2299 | }; |
| 2300 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2301 | |
| 2302 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2303 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2304 | { 2, NULL } |
| 2305 | }; |
| 2306 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2307 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2308 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2309 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2310 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2311 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2312 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2313 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2316 | { } /* end */ |
| 2317 | }; |
| 2318 | |
| 2319 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2320 | /* |
| 2321 | * ALC880 F1734 model |
| 2322 | * |
| 2323 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2324 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2325 | */ |
| 2326 | |
| 2327 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2328 | 0x03 |
| 2329 | }; |
| 2330 | #define ALC880_F1734_HP_DAC 0x02 |
| 2331 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2332 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2333 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2334 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2335 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2336 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2337 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2338 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2339 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2341 | { } /* end */ |
| 2342 | }; |
| 2343 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2344 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2345 | .num_items = 2, |
| 2346 | .items = { |
| 2347 | { "Mic", 0x1 }, |
| 2348 | { "CD", 0x4 }, |
| 2349 | }, |
| 2350 | }; |
| 2351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2352 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2353 | /* |
| 2354 | * ALC880 ASUS model |
| 2355 | * |
| 2356 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2357 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2358 | * Mic = 0x18, Line = 0x1a |
| 2359 | */ |
| 2360 | |
| 2361 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2362 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2363 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2364 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2365 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2366 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2367 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2368 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2369 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2370 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2371 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2372 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2374 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2375 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2376 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2379 | { |
| 2380 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2381 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2382 | .info = alc_ch_mode_info, |
| 2383 | .get = alc_ch_mode_get, |
| 2384 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2385 | }, |
| 2386 | { } /* end */ |
| 2387 | }; |
| 2388 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2389 | /* |
| 2390 | * ALC880 ASUS W1V model |
| 2391 | * |
| 2392 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2393 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2394 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2395 | */ |
| 2396 | |
| 2397 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2398 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2399 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2400 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2401 | { } /* end */ |
| 2402 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2403 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2404 | /* TCL S700 */ |
| 2405 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2406 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2407 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2408 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2409 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2410 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2411 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2412 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2413 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2414 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2415 | { } /* end */ |
| 2416 | }; |
| 2417 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2418 | /* Uniwill */ |
| 2419 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2420 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2421 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2422 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2423 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2424 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2425 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2426 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2427 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2430 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2431 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2433 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2434 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2435 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2436 | { |
| 2437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2438 | .name = "Channel Mode", |
| 2439 | .info = alc_ch_mode_info, |
| 2440 | .get = alc_ch_mode_get, |
| 2441 | .put = alc_ch_mode_put, |
| 2442 | }, |
| 2443 | { } /* end */ |
| 2444 | }; |
| 2445 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2446 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2447 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2448 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2449 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2450 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2451 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2452 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2453 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2454 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2455 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2456 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2457 | { } /* end */ |
| 2458 | }; |
| 2459 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2460 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2461 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2462 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2463 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2464 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2467 | { } /* end */ |
| 2468 | }; |
| 2469 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2470 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2471 | * virtual master controls |
| 2472 | */ |
| 2473 | |
| 2474 | /* |
| 2475 | * slave controls for virtual master |
| 2476 | */ |
| 2477 | static const char *alc_slave_vols[] = { |
| 2478 | "Front Playback Volume", |
| 2479 | "Surround Playback Volume", |
| 2480 | "Center Playback Volume", |
| 2481 | "LFE Playback Volume", |
| 2482 | "Side Playback Volume", |
| 2483 | "Headphone Playback Volume", |
| 2484 | "Speaker Playback Volume", |
| 2485 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2486 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2487 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2488 | NULL, |
| 2489 | }; |
| 2490 | |
| 2491 | static const char *alc_slave_sws[] = { |
| 2492 | "Front Playback Switch", |
| 2493 | "Surround Playback Switch", |
| 2494 | "Center Playback Switch", |
| 2495 | "LFE Playback Switch", |
| 2496 | "Side Playback Switch", |
| 2497 | "Headphone Playback Switch", |
| 2498 | "Speaker Playback Switch", |
| 2499 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2500 | "IEC958 Playback Switch", |
Takashi Iwai | 23033b2 | 2009-12-08 12:36:52 +0100 | [diff] [blame] | 2501 | "Line-Out Playback Switch", |
| 2502 | "PCM Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2503 | NULL, |
| 2504 | }; |
| 2505 | |
| 2506 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2507 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2508 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2509 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2510 | #define NID_MAPPING (-1) |
| 2511 | |
| 2512 | #define SUBDEV_SPEAKER_ (0 << 6) |
| 2513 | #define SUBDEV_HP_ (1 << 6) |
| 2514 | #define SUBDEV_LINE_ (2 << 6) |
| 2515 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) |
| 2516 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) |
| 2517 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) |
| 2518 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2519 | static void alc_free_kctls(struct hda_codec *codec); |
| 2520 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2521 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2522 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2523 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2524 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2525 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2526 | { } /* end */ |
| 2527 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2528 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2529 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2530 | static int alc_build_controls(struct hda_codec *codec) |
| 2531 | { |
| 2532 | struct alc_spec *spec = codec->spec; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2533 | struct snd_kcontrol *kctl; |
| 2534 | struct snd_kcontrol_new *knew; |
| 2535 | int i, j, err; |
| 2536 | unsigned int u; |
| 2537 | hda_nid_t nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2538 | |
| 2539 | for (i = 0; i < spec->num_mixers; i++) { |
| 2540 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2541 | if (err < 0) |
| 2542 | return err; |
| 2543 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2544 | if (spec->cap_mixer) { |
| 2545 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2546 | if (err < 0) |
| 2547 | return err; |
| 2548 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2549 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2550 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2551 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2552 | if (err < 0) |
| 2553 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2554 | if (!spec->no_analog) { |
| 2555 | err = snd_hda_create_spdif_share_sw(codec, |
| 2556 | &spec->multiout); |
| 2557 | if (err < 0) |
| 2558 | return err; |
| 2559 | spec->multiout.share_spdif = 1; |
| 2560 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2561 | } |
| 2562 | if (spec->dig_in_nid) { |
| 2563 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2564 | if (err < 0) |
| 2565 | return err; |
| 2566 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2567 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2568 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2569 | /* create beep controls if needed */ |
| 2570 | if (spec->beep_amp) { |
| 2571 | struct snd_kcontrol_new *knew; |
| 2572 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2573 | struct snd_kcontrol *kctl; |
| 2574 | kctl = snd_ctl_new1(knew, codec); |
| 2575 | if (!kctl) |
| 2576 | return -ENOMEM; |
| 2577 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2578 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2579 | if (err < 0) |
| 2580 | return err; |
| 2581 | } |
| 2582 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 2583 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2584 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2585 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2586 | if (!spec->no_analog && |
| 2587 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2588 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2589 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2590 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2591 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2592 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2593 | if (err < 0) |
| 2594 | return err; |
| 2595 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2596 | if (!spec->no_analog && |
| 2597 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2598 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2599 | NULL, alc_slave_sws); |
| 2600 | if (err < 0) |
| 2601 | return err; |
| 2602 | } |
| 2603 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2604 | /* assign Capture Source enums to NID */ |
| 2605 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
| 2606 | if (!kctl) |
| 2607 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
| 2608 | for (i = 0; kctl && i < kctl->count; i++) { |
Takashi Iwai | d1409ae | 2009-12-17 15:01:31 +0100 | [diff] [blame] | 2609 | hda_nid_t *nids = spec->capsrc_nids; |
| 2610 | if (!nids) |
| 2611 | nids = spec->adc_nids; |
Takashi Iwai | 21949f0 | 2009-12-23 08:31:59 +0100 | [diff] [blame] | 2612 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 2613 | if (err < 0) |
| 2614 | return err; |
| 2615 | } |
| 2616 | if (spec->cap_mixer) { |
| 2617 | const char *kname = kctl ? kctl->id.name : NULL; |
| 2618 | for (knew = spec->cap_mixer; knew->name; knew++) { |
| 2619 | if (kname && strcmp(knew->name, kname) == 0) |
| 2620 | continue; |
| 2621 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2622 | for (i = 0; kctl && i < kctl->count; i++) { |
| 2623 | err = snd_hda_add_nid(codec, kctl, i, |
| 2624 | spec->adc_nids[i]); |
| 2625 | if (err < 0) |
| 2626 | return err; |
| 2627 | } |
| 2628 | } |
| 2629 | } |
| 2630 | |
| 2631 | /* other nid->control mapping */ |
| 2632 | for (i = 0; i < spec->num_mixers; i++) { |
| 2633 | for (knew = spec->mixers[i]; knew->name; knew++) { |
| 2634 | if (knew->iface != NID_MAPPING) |
| 2635 | continue; |
| 2636 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); |
| 2637 | if (kctl == NULL) |
| 2638 | continue; |
| 2639 | u = knew->subdevice; |
| 2640 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2641 | nid = u & 0x3f; |
| 2642 | if (nid == 0) |
| 2643 | continue; |
| 2644 | switch (u & 0xc0) { |
| 2645 | case SUBDEV_SPEAKER_: |
| 2646 | nid = spec->autocfg.speaker_pins[nid]; |
| 2647 | break; |
| 2648 | case SUBDEV_LINE_: |
| 2649 | nid = spec->autocfg.line_out_pins[nid]; |
| 2650 | break; |
| 2651 | case SUBDEV_HP_: |
| 2652 | nid = spec->autocfg.hp_pins[nid]; |
| 2653 | break; |
| 2654 | default: |
| 2655 | continue; |
| 2656 | } |
| 2657 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2658 | if (err < 0) |
| 2659 | return err; |
| 2660 | } |
| 2661 | u = knew->private_value; |
| 2662 | for (j = 0; j < 4; j++, u >>= 8) { |
| 2663 | nid = u & 0xff; |
| 2664 | if (nid == 0) |
| 2665 | continue; |
| 2666 | err = snd_hda_add_nid(codec, kctl, 0, nid); |
| 2667 | if (err < 0) |
| 2668 | return err; |
| 2669 | } |
| 2670 | } |
| 2671 | } |
Takashi Iwai | bae84e7 | 2010-03-22 08:30:20 +0100 | [diff] [blame] | 2672 | |
| 2673 | alc_free_kctls(codec); /* no longer needed */ |
| 2674 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2675 | return 0; |
| 2676 | } |
| 2677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2678 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2679 | /* |
| 2680 | * initialize the codec volumes, etc |
| 2681 | */ |
| 2682 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2683 | /* |
| 2684 | * generic initialization of ADC, input mixers and output mixers |
| 2685 | */ |
| 2686 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2687 | /* |
| 2688 | * Unmute ADC0-2 and set the default input to mic-in |
| 2689 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2690 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2691 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2692 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2694 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2696 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2697 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2698 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2699 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2700 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2701 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2702 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2703 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2704 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2705 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2706 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2707 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2708 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2709 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2710 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2711 | /* |
| 2712 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2714 | /* set vol=0 to output mixers */ |
| 2715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2716 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2717 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2718 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2719 | /* set up input amps for analog loopback */ |
| 2720 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2721 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2722 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2723 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2724 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2725 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2727 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2728 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2729 | |
| 2730 | { } |
| 2731 | }; |
| 2732 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2733 | /* |
| 2734 | * 3-stack pin configuration: |
| 2735 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2736 | */ |
| 2737 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2738 | /* |
| 2739 | * preset connection lists of input pins |
| 2740 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2741 | */ |
| 2742 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2743 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2744 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2745 | |
| 2746 | /* |
| 2747 | * Set pin mode and muting |
| 2748 | */ |
| 2749 | /* set front pin widgets 0x14 for output */ |
| 2750 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2751 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2752 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2753 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2754 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2755 | /* Mic2 (as headphone out) for HP output */ |
| 2756 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2758 | /* Line In pin widget for input */ |
| 2759 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2760 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2761 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2762 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2763 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2764 | /* CD pin widget for input */ |
| 2765 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2766 | |
| 2767 | { } |
| 2768 | }; |
| 2769 | |
| 2770 | /* |
| 2771 | * 5-stack pin configuration: |
| 2772 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2773 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2774 | */ |
| 2775 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2776 | /* |
| 2777 | * preset connection lists of input pins |
| 2778 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2779 | */ |
| 2780 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2781 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2782 | |
| 2783 | /* |
| 2784 | * Set pin mode and muting |
| 2785 | */ |
| 2786 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2789 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2790 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2791 | /* unmute pins for output (no gain on this amp) */ |
| 2792 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2794 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2795 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2796 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2797 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2800 | /* Mic2 (as headphone out) for HP output */ |
| 2801 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2802 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2803 | /* Line In pin widget for input */ |
| 2804 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2806 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2807 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2808 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2809 | /* CD pin widget for input */ |
| 2810 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2811 | |
| 2812 | { } |
| 2813 | }; |
| 2814 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2815 | /* |
| 2816 | * W810 pin configuration: |
| 2817 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2818 | */ |
| 2819 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2820 | /* hphone/speaker input selector: front DAC */ |
| 2821 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2822 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2823 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2824 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2825 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2826 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2827 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2828 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2829 | |
| 2830 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2832 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2833 | { } |
| 2834 | }; |
| 2835 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2836 | /* |
| 2837 | * Z71V pin configuration: |
| 2838 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2839 | */ |
| 2840 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2841 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2842 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2844 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2845 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2846 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2847 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2848 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2849 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2850 | |
| 2851 | { } |
| 2852 | }; |
| 2853 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2854 | /* |
| 2855 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2856 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2857 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2858 | */ |
| 2859 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2860 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2861 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2866 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2867 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2868 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2869 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2870 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2871 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2872 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2873 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2874 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2875 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2876 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2877 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2878 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2879 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2880 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2881 | { } |
| 2882 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2883 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2884 | /* |
| 2885 | * Uniwill pin configuration: |
| 2886 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2887 | * line = 0x1a |
| 2888 | */ |
| 2889 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2890 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2891 | |
| 2892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2894 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2895 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2896 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2897 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2898 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2899 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2901 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2902 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2903 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2905 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2906 | |
| 2907 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2908 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2909 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2910 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2911 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2912 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2913 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2914 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2915 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2916 | |
| 2917 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2918 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2919 | |
| 2920 | { } |
| 2921 | }; |
| 2922 | |
| 2923 | /* |
| 2924 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2925 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2926 | */ |
| 2927 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2928 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2929 | |
| 2930 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2931 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2932 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2933 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2934 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2935 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2937 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2938 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2939 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2940 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2941 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2942 | |
| 2943 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2944 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2945 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2947 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2948 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2949 | |
| 2950 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2951 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2952 | |
| 2953 | { } |
| 2954 | }; |
| 2955 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2956 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2957 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2958 | { } |
| 2959 | }; |
| 2960 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2961 | /* auto-toggle front mic */ |
| 2962 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2963 | { |
| 2964 | unsigned int present; |
| 2965 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2966 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 2967 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2968 | bits = present ? HDA_AMP_MUTE : 0; |
| 2969 | 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] | 2970 | } |
| 2971 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2972 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2973 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2974 | struct alc_spec *spec = codec->spec; |
| 2975 | |
| 2976 | spec->autocfg.hp_pins[0] = 0x14; |
| 2977 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2978 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2979 | } |
| 2980 | |
| 2981 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2982 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2983 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2984 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2985 | } |
| 2986 | |
| 2987 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2988 | unsigned int res) |
| 2989 | { |
| 2990 | /* Looks like the unsol event is incompatible with the standard |
| 2991 | * definition. 4bit tag is placed at 28 bit! |
| 2992 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2993 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2994 | case ALC880_MIC_EVENT: |
| 2995 | alc880_uniwill_mic_automute(codec); |
| 2996 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2997 | default: |
| 2998 | alc_automute_amp_unsol_event(codec, res); |
| 2999 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 3000 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3001 | } |
| 3002 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3003 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3004 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3005 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3006 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3007 | spec->autocfg.hp_pins[0] = 0x14; |
| 3008 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3009 | } |
| 3010 | |
| 3011 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 3012 | { |
| 3013 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3014 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3015 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3016 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 3017 | present &= HDA_AMP_VOLMASK; |
| 3018 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 3019 | HDA_AMP_VOLMASK, present); |
| 3020 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 3021 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3022 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3023 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3024 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 3025 | unsigned int res) |
| 3026 | { |
| 3027 | /* Looks like the unsol event is incompatible with the standard |
| 3028 | * definition. 4bit tag is placed at 28 bit! |
| 3029 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3030 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3031 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3032 | else |
| 3033 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3034 | } |
| 3035 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3036 | /* |
| 3037 | * F1734 pin configuration: |
| 3038 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 3039 | */ |
| 3040 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3041 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3042 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3043 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3044 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3045 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3046 | |
| 3047 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3048 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3049 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3050 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3051 | |
| 3052 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3053 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 3054 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3055 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3056 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3057 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3058 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3059 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3060 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3061 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3062 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 3063 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 3064 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3065 | { } |
| 3066 | }; |
| 3067 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3068 | /* |
| 3069 | * ASUS pin configuration: |
| 3070 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 3071 | */ |
| 3072 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 3073 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 3074 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3075 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3076 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3077 | |
| 3078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3079 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3081 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3082 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3083 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3084 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3085 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3086 | |
| 3087 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3088 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3089 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3090 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3091 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3092 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3093 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3094 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3095 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 3096 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3097 | { } |
| 3098 | }; |
| 3099 | |
| 3100 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3101 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 3102 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 3103 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3104 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3105 | /* Clevo m520g init */ |
| 3106 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 3107 | /* headphone output */ |
| 3108 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3109 | /* line-out */ |
| 3110 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3112 | /* Line-in */ |
| 3113 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3114 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3115 | /* CD */ |
| 3116 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3117 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3118 | /* Mic1 (rear panel) */ |
| 3119 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3120 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3121 | /* Mic2 (front panel) */ |
| 3122 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3123 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3124 | /* headphone */ |
| 3125 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3126 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3127 | /* change to EAPD mode */ |
| 3128 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3129 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3130 | |
| 3131 | { } |
| 3132 | }; |
| 3133 | |
| 3134 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 3135 | /* change to EAPD mode */ |
| 3136 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3137 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3138 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3139 | /* Headphone output */ |
| 3140 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3141 | /* Front output*/ |
| 3142 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3143 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 3144 | |
| 3145 | /* Line In pin widget for input */ |
| 3146 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3147 | /* CD pin widget for input */ |
| 3148 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3149 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3150 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3151 | |
| 3152 | /* change to EAPD mode */ |
| 3153 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3154 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 3155 | |
| 3156 | { } |
| 3157 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3158 | |
| 3159 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3160 | * LG m1 express dual |
| 3161 | * |
| 3162 | * Pin assignment: |
| 3163 | * Rear Line-In/Out (blue): 0x14 |
| 3164 | * Build-in Mic-In: 0x15 |
| 3165 | * Speaker-out: 0x17 |
| 3166 | * HP-Out (green): 0x1b |
| 3167 | * Mic-In/Out (red): 0x19 |
| 3168 | * SPDIF-Out: 0x1e |
| 3169 | */ |
| 3170 | |
| 3171 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 3172 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 3173 | 0x05, 0x02, 0x03 |
| 3174 | }; |
| 3175 | |
| 3176 | /* seems analog CD is not working */ |
| 3177 | static struct hda_input_mux alc880_lg_capture_source = { |
| 3178 | .num_items = 3, |
| 3179 | .items = { |
| 3180 | { "Mic", 0x1 }, |
| 3181 | { "Line", 0x5 }, |
| 3182 | { "Internal Mic", 0x6 }, |
| 3183 | }, |
| 3184 | }; |
| 3185 | |
| 3186 | /* 2,4,6 channel modes */ |
| 3187 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 3188 | /* set line-in and mic-in to input */ |
| 3189 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 3190 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3191 | { } |
| 3192 | }; |
| 3193 | |
| 3194 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 3195 | /* set line-in to out and mic-in to input */ |
| 3196 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3197 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 3198 | { } |
| 3199 | }; |
| 3200 | |
| 3201 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3202 | /* set line-in and mic-in to output */ |
| 3203 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3204 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3205 | { } |
| 3206 | }; |
| 3207 | |
| 3208 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3209 | { 2, alc880_lg_ch2_init }, |
| 3210 | { 4, alc880_lg_ch4_init }, |
| 3211 | { 6, alc880_lg_ch6_init }, |
| 3212 | }; |
| 3213 | |
| 3214 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3215 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3216 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3217 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3218 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3219 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3220 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3221 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3222 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3225 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3226 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3227 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3228 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3229 | { |
| 3230 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3231 | .name = "Channel Mode", |
| 3232 | .info = alc_ch_mode_info, |
| 3233 | .get = alc_ch_mode_get, |
| 3234 | .put = alc_ch_mode_put, |
| 3235 | }, |
| 3236 | { } /* end */ |
| 3237 | }; |
| 3238 | |
| 3239 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3240 | /* set capture source to mic-in */ |
| 3241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3242 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3243 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3244 | /* mute all amp mixer inputs */ |
| 3245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3246 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3247 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3248 | /* line-in to input */ |
| 3249 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3250 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3251 | /* built-in mic */ |
| 3252 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3253 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3254 | /* speaker-out */ |
| 3255 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3256 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3257 | /* mic-in to input */ |
| 3258 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3259 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3260 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3261 | /* HP-out */ |
| 3262 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3263 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3264 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3265 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3266 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3267 | { } |
| 3268 | }; |
| 3269 | |
| 3270 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3271 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3272 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3273 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3274 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3275 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3276 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3277 | } |
| 3278 | |
| 3279 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3280 | * LG LW20 |
| 3281 | * |
| 3282 | * Pin assignment: |
| 3283 | * Speaker-out: 0x14 |
| 3284 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3285 | * Built-in Mic-In: 0x19 |
| 3286 | * Line-In: 0x1b |
| 3287 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3288 | * SPDIF-Out: 0x1e |
| 3289 | */ |
| 3290 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3291 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3292 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3293 | .items = { |
| 3294 | { "Mic", 0x0 }, |
| 3295 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3296 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3297 | }, |
| 3298 | }; |
| 3299 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3300 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3301 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3302 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3303 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3304 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3305 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3306 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3307 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3308 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3309 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3310 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3311 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3312 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3313 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3314 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3315 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3316 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3317 | { |
| 3318 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3319 | .name = "Channel Mode", |
| 3320 | .info = alc_ch_mode_info, |
| 3321 | .get = alc_ch_mode_get, |
| 3322 | .put = alc_ch_mode_put, |
| 3323 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3324 | { } /* end */ |
| 3325 | }; |
| 3326 | |
| 3327 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3328 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3329 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3330 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3331 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3332 | /* set capture source to mic-in */ |
| 3333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3334 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3335 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3336 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3337 | /* speaker-out */ |
| 3338 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3339 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3340 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3341 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3342 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3343 | /* mic-in to input */ |
| 3344 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3345 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3346 | /* built-in mic */ |
| 3347 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3348 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3349 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3350 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3351 | { } |
| 3352 | }; |
| 3353 | |
| 3354 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3355 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3356 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3357 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3358 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3359 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3360 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3361 | } |
| 3362 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3363 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3364 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3365 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3366 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3367 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3368 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3369 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3370 | { } /* end */ |
| 3371 | }; |
| 3372 | |
| 3373 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3374 | .num_items = 2, |
| 3375 | .items = { |
| 3376 | { "Mic", 0x0 }, |
| 3377 | { "Internal Mic", 0x1 }, |
| 3378 | }, |
| 3379 | }; |
| 3380 | |
| 3381 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3382 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3383 | |
| 3384 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3385 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3386 | |
| 3387 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3388 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3389 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3390 | /* Mic2 (as headphone out) for HP output */ |
| 3391 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3392 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3393 | /* Internal Speaker */ |
| 3394 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3395 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3396 | |
| 3397 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3398 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3399 | |
| 3400 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3401 | { } |
| 3402 | }; |
| 3403 | |
| 3404 | /* toggle speaker-output according to the hp-jack state */ |
| 3405 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3406 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3407 | struct alc_spec *spec = codec->spec; |
| 3408 | alc_automute_amp(codec); |
| 3409 | /* toggle EAPD */ |
| 3410 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3411 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3412 | else |
| 3413 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3414 | } |
| 3415 | |
| 3416 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3417 | unsigned int res) |
| 3418 | { |
| 3419 | /* Looks like the unsol event is incompatible with the standard |
| 3420 | * definition. 4bit tag is placed at 28 bit! |
| 3421 | */ |
| 3422 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3423 | alc880_medion_rim_automute(codec); |
| 3424 | } |
| 3425 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3426 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3427 | { |
| 3428 | struct alc_spec *spec = codec->spec; |
| 3429 | |
| 3430 | spec->autocfg.hp_pins[0] = 0x14; |
| 3431 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3432 | } |
| 3433 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3435 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3436 | { 0x0b, HDA_INPUT, 0 }, |
| 3437 | { 0x0b, HDA_INPUT, 1 }, |
| 3438 | { 0x0b, HDA_INPUT, 2 }, |
| 3439 | { 0x0b, HDA_INPUT, 3 }, |
| 3440 | { 0x0b, HDA_INPUT, 4 }, |
| 3441 | { } /* end */ |
| 3442 | }; |
| 3443 | |
| 3444 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3445 | { 0x0b, HDA_INPUT, 1 }, |
| 3446 | { 0x0b, HDA_INPUT, 6 }, |
| 3447 | { 0x0b, HDA_INPUT, 7 }, |
| 3448 | { } /* end */ |
| 3449 | }; |
| 3450 | #endif |
| 3451 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3452 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3453 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3456 | static int alc_init(struct hda_codec *codec) |
| 3457 | { |
| 3458 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3459 | unsigned int i; |
| 3460 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3461 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3462 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3463 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3464 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3465 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3466 | |
| 3467 | if (spec->init_hook) |
| 3468 | spec->init_hook(codec); |
| 3469 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3470 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3471 | if (codec->patch_ops.check_power_status) |
| 3472 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3473 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | return 0; |
| 3475 | } |
| 3476 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3477 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3478 | { |
| 3479 | struct alc_spec *spec = codec->spec; |
| 3480 | |
| 3481 | if (spec->unsol_event) |
| 3482 | spec->unsol_event(codec, res); |
| 3483 | } |
| 3484 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3485 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3486 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3487 | { |
| 3488 | struct alc_spec *spec = codec->spec; |
| 3489 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3490 | } |
| 3491 | #endif |
| 3492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3493 | /* |
| 3494 | * Analog playback callbacks |
| 3495 | */ |
| 3496 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 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; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3501 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3502 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3503 | } |
| 3504 | |
| 3505 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3506 | struct hda_codec *codec, |
| 3507 | unsigned int stream_tag, |
| 3508 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3509 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3510 | { |
| 3511 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3512 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3513 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3517 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3518 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3519 | { |
| 3520 | struct alc_spec *spec = codec->spec; |
| 3521 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3522 | } |
| 3523 | |
| 3524 | /* |
| 3525 | * Digital out |
| 3526 | */ |
| 3527 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3528 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3529 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3530 | { |
| 3531 | struct alc_spec *spec = codec->spec; |
| 3532 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3533 | } |
| 3534 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3535 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3536 | struct hda_codec *codec, |
| 3537 | unsigned int stream_tag, |
| 3538 | unsigned int format, |
| 3539 | struct snd_pcm_substream *substream) |
| 3540 | { |
| 3541 | struct alc_spec *spec = codec->spec; |
| 3542 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3543 | stream_tag, format, substream); |
| 3544 | } |
| 3545 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3546 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3547 | struct hda_codec *codec, |
| 3548 | struct snd_pcm_substream *substream) |
| 3549 | { |
| 3550 | struct alc_spec *spec = codec->spec; |
| 3551 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3552 | } |
| 3553 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3554 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3555 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3556 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3557 | { |
| 3558 | struct alc_spec *spec = codec->spec; |
| 3559 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3560 | } |
| 3561 | |
| 3562 | /* |
| 3563 | * Analog capture |
| 3564 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3565 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3566 | struct hda_codec *codec, |
| 3567 | unsigned int stream_tag, |
| 3568 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3569 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3570 | { |
| 3571 | struct alc_spec *spec = codec->spec; |
| 3572 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3573 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3574 | stream_tag, 0, format); |
| 3575 | return 0; |
| 3576 | } |
| 3577 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3578 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3579 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3580 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3581 | { |
| 3582 | struct alc_spec *spec = codec->spec; |
| 3583 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3584 | snd_hda_codec_cleanup_stream(codec, |
| 3585 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3586 | return 0; |
| 3587 | } |
| 3588 | |
| 3589 | |
| 3590 | /* |
| 3591 | */ |
| 3592 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3593 | .substreams = 1, |
| 3594 | .channels_min = 2, |
| 3595 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3596 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3597 | .ops = { |
| 3598 | .open = alc880_playback_pcm_open, |
| 3599 | .prepare = alc880_playback_pcm_prepare, |
| 3600 | .cleanup = alc880_playback_pcm_cleanup |
| 3601 | }, |
| 3602 | }; |
| 3603 | |
| 3604 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3605 | .substreams = 1, |
| 3606 | .channels_min = 2, |
| 3607 | .channels_max = 2, |
| 3608 | /* NID is set in alc_build_pcms */ |
| 3609 | }; |
| 3610 | |
| 3611 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3612 | .substreams = 1, |
| 3613 | .channels_min = 2, |
| 3614 | .channels_max = 2, |
| 3615 | /* NID is set in alc_build_pcms */ |
| 3616 | }; |
| 3617 | |
| 3618 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3619 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3620 | .channels_min = 2, |
| 3621 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3622 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3623 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3624 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3625 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3626 | }, |
| 3627 | }; |
| 3628 | |
| 3629 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3630 | .substreams = 1, |
| 3631 | .channels_min = 2, |
| 3632 | .channels_max = 2, |
| 3633 | /* NID is set in alc_build_pcms */ |
| 3634 | .ops = { |
| 3635 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3636 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3637 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3638 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3639 | }, |
| 3640 | }; |
| 3641 | |
| 3642 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3643 | .substreams = 1, |
| 3644 | .channels_min = 2, |
| 3645 | .channels_max = 2, |
| 3646 | /* NID is set in alc_build_pcms */ |
| 3647 | }; |
| 3648 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3649 | /* 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] | 3650 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3651 | .substreams = 0, |
| 3652 | .channels_min = 0, |
| 3653 | .channels_max = 0, |
| 3654 | }; |
| 3655 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3656 | static int alc_build_pcms(struct hda_codec *codec) |
| 3657 | { |
| 3658 | struct alc_spec *spec = codec->spec; |
| 3659 | struct hda_pcm *info = spec->pcm_rec; |
| 3660 | int i; |
| 3661 | |
| 3662 | codec->num_pcms = 1; |
| 3663 | codec->pcm_info = info; |
| 3664 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3665 | if (spec->no_analog) |
| 3666 | goto skip_analog; |
| 3667 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3668 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3669 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3670 | info->name = spec->stream_name_analog; |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3671 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3672 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3673 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3674 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3675 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3676 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3677 | } |
| 3678 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3679 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3680 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3681 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3682 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3683 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3684 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3685 | if (spec->channel_mode) { |
| 3686 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3687 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3688 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3689 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3690 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3691 | } |
| 3692 | } |
| 3693 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3694 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3695 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3696 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3697 | snprintf(spec->stream_name_digital, |
| 3698 | sizeof(spec->stream_name_digital), |
| 3699 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3700 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3701 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3702 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3703 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3704 | if (spec->dig_out_type) |
| 3705 | info->pcm_type = spec->dig_out_type; |
| 3706 | else |
| 3707 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3708 | if (spec->multiout.dig_out_nid && |
| 3709 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3710 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3711 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3712 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3713 | if (spec->dig_in_nid && |
| 3714 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3715 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3716 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3717 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3718 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3719 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3720 | } |
| 3721 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3722 | if (spec->no_analog) |
| 3723 | return 0; |
| 3724 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3725 | /* If the use of more than one ADC is requested for the current |
| 3726 | * model, configure a second analog capture-only PCM. |
| 3727 | */ |
| 3728 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3729 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3730 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3731 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3732 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3733 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3734 | if (spec->alt_dac_nid) { |
| 3735 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3736 | *spec->stream_analog_alt_playback; |
| 3737 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3738 | spec->alt_dac_nid; |
| 3739 | } else { |
| 3740 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3741 | alc_pcm_null_stream; |
| 3742 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3743 | } |
| 3744 | if (spec->num_adc_nids > 1) { |
| 3745 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3746 | *spec->stream_analog_alt_capture; |
| 3747 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3748 | spec->adc_nids[1]; |
| 3749 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3750 | spec->num_adc_nids - 1; |
| 3751 | } else { |
| 3752 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3753 | alc_pcm_null_stream; |
| 3754 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3755 | } |
| 3756 | } |
| 3757 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3758 | return 0; |
| 3759 | } |
| 3760 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3761 | static inline void alc_shutup(struct hda_codec *codec) |
| 3762 | { |
| 3763 | snd_hda_shutup_pins(codec); |
| 3764 | } |
| 3765 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3766 | static void alc_free_kctls(struct hda_codec *codec) |
| 3767 | { |
| 3768 | struct alc_spec *spec = codec->spec; |
| 3769 | |
| 3770 | if (spec->kctls.list) { |
| 3771 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3772 | int i; |
| 3773 | for (i = 0; i < spec->kctls.used; i++) |
| 3774 | kfree(kctl[i].name); |
| 3775 | } |
| 3776 | snd_array_free(&spec->kctls); |
| 3777 | } |
| 3778 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3779 | static void alc_free(struct hda_codec *codec) |
| 3780 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3781 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3782 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3783 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3784 | return; |
| 3785 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3786 | alc_shutup(codec); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3787 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3788 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3789 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3790 | } |
| 3791 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3792 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3793 | static void alc_power_eapd(struct hda_codec *codec) |
| 3794 | { |
| 3795 | /* We currently only handle front, HP */ |
| 3796 | switch (codec->vendor_id) { |
| 3797 | case 0x10ec0260: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3798 | set_eapd(codec, 0x0f, 0); |
| 3799 | set_eapd(codec, 0x10, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3800 | break; |
| 3801 | case 0x10ec0262: |
| 3802 | case 0x10ec0267: |
| 3803 | case 0x10ec0268: |
| 3804 | case 0x10ec0269: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3805 | case 0x10ec0270: |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3806 | case 0x10ec0272: |
| 3807 | case 0x10ec0660: |
| 3808 | case 0x10ec0662: |
| 3809 | case 0x10ec0663: |
| 3810 | case 0x10ec0862: |
| 3811 | case 0x10ec0889: |
Takashi Iwai | 9e4c849 | 2010-01-19 15:53:43 +0100 | [diff] [blame] | 3812 | set_eapd(codec, 0x14, 0); |
| 3813 | set_eapd(codec, 0x15, 0); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3814 | break; |
| 3815 | } |
| 3816 | } |
| 3817 | |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3818 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) |
| 3819 | { |
| 3820 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 3821 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3822 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3823 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3824 | return 0; |
| 3825 | } |
| 3826 | #endif |
| 3827 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3828 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3829 | static int alc_resume(struct hda_codec *codec) |
| 3830 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3831 | codec->patch_ops.init(codec); |
| 3832 | snd_hda_codec_resume_amp(codec); |
| 3833 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 3834 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3835 | if (codec->patch_ops.check_power_status) |
| 3836 | codec->patch_ops.check_power_status(codec, 0x01); |
| 3837 | #endif |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3838 | return 0; |
| 3839 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3840 | #endif |
| 3841 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3842 | /* |
| 3843 | */ |
| 3844 | static struct hda_codec_ops alc_patch_ops = { |
| 3845 | .build_controls = alc_build_controls, |
| 3846 | .build_pcms = alc_build_pcms, |
| 3847 | .init = alc_init, |
| 3848 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3849 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3850 | #ifdef SND_HDA_NEEDS_RESUME |
| 3851 | .resume = alc_resume, |
| 3852 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3853 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 3854 | .suspend = alc_suspend, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3855 | .check_power_status = alc_check_power_status, |
| 3856 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 3857 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3858 | }; |
| 3859 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 3860 | /* replace the codec chip_name with the given string */ |
| 3861 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 3862 | { |
| 3863 | kfree(codec->chip_name); |
| 3864 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 3865 | if (!codec->chip_name) { |
| 3866 | alc_free(codec); |
| 3867 | return -ENOMEM; |
| 3868 | } |
| 3869 | return 0; |
| 3870 | } |
| 3871 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3872 | /* |
| 3873 | * Test configuration for debugging |
| 3874 | * |
| 3875 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3876 | * enum controls. |
| 3877 | */ |
| 3878 | #ifdef CONFIG_SND_DEBUG |
| 3879 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3880 | 0x02, 0x03, 0x04, 0x05 |
| 3881 | }; |
| 3882 | |
| 3883 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3884 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3885 | .items = { |
| 3886 | { "In-1", 0x0 }, |
| 3887 | { "In-2", 0x1 }, |
| 3888 | { "In-3", 0x2 }, |
| 3889 | { "In-4", 0x3 }, |
| 3890 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3891 | { "Front", 0x5 }, |
| 3892 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3893 | }, |
| 3894 | }; |
| 3895 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3896 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3897 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3898 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3899 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3900 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3901 | }; |
| 3902 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3903 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3904 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3905 | { |
| 3906 | static char *texts[] = { |
| 3907 | "N/A", "Line Out", "HP Out", |
| 3908 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3909 | }; |
| 3910 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3911 | uinfo->count = 1; |
| 3912 | uinfo->value.enumerated.items = 8; |
| 3913 | if (uinfo->value.enumerated.item >= 8) |
| 3914 | uinfo->value.enumerated.item = 7; |
| 3915 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3916 | return 0; |
| 3917 | } |
| 3918 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3919 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3920 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3921 | { |
| 3922 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3923 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3924 | unsigned int pin_ctl, item = 0; |
| 3925 | |
| 3926 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3927 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3928 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3929 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3930 | item = 2; |
| 3931 | else |
| 3932 | item = 1; |
| 3933 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3934 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3935 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3936 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3937 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3938 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3939 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3940 | } |
| 3941 | } |
| 3942 | ucontrol->value.enumerated.item[0] = item; |
| 3943 | return 0; |
| 3944 | } |
| 3945 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3946 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3947 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3948 | { |
| 3949 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3950 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3951 | static unsigned int ctls[] = { |
| 3952 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3953 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3954 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3955 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3956 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3957 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3958 | }; |
| 3959 | unsigned int old_ctl, new_ctl; |
| 3960 | |
| 3961 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3962 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3963 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3964 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3965 | int val; |
| 3966 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3967 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3968 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3969 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3970 | HDA_AMP_MUTE : 0; |
| 3971 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3972 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3973 | return 1; |
| 3974 | } |
| 3975 | return 0; |
| 3976 | } |
| 3977 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3978 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3979 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3980 | { |
| 3981 | static char *texts[] = { |
| 3982 | "Front", "Surround", "CLFE", "Side" |
| 3983 | }; |
| 3984 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3985 | uinfo->count = 1; |
| 3986 | uinfo->value.enumerated.items = 4; |
| 3987 | if (uinfo->value.enumerated.item >= 4) |
| 3988 | uinfo->value.enumerated.item = 3; |
| 3989 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3990 | return 0; |
| 3991 | } |
| 3992 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3993 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3994 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3995 | { |
| 3996 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3997 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3998 | unsigned int sel; |
| 3999 | |
| 4000 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 4001 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 4002 | return 0; |
| 4003 | } |
| 4004 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4005 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 4006 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4007 | { |
| 4008 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4009 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 4010 | unsigned int sel; |
| 4011 | |
| 4012 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 4013 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 4014 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4015 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4016 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4017 | return 1; |
| 4018 | } |
| 4019 | return 0; |
| 4020 | } |
| 4021 | |
| 4022 | #define PIN_CTL_TEST(xname,nid) { \ |
| 4023 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4024 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4025 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4026 | .info = alc_test_pin_ctl_info, \ |
| 4027 | .get = alc_test_pin_ctl_get, \ |
| 4028 | .put = alc_test_pin_ctl_put, \ |
| 4029 | .private_value = nid \ |
| 4030 | } |
| 4031 | |
| 4032 | #define PIN_SRC_TEST(xname,nid) { \ |
| 4033 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 4034 | .name = xname, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 4035 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4036 | .info = alc_test_pin_src_info, \ |
| 4037 | .get = alc_test_pin_src_get, \ |
| 4038 | .put = alc_test_pin_src_put, \ |
| 4039 | .private_value = nid \ |
| 4040 | } |
| 4041 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4042 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4043 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 4044 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 4045 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 4046 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4047 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 4048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 4049 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 4050 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4051 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 4052 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 4053 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 4054 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 4055 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 4056 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 4057 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 4058 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 4059 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 4060 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 4061 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 4062 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 4063 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 4064 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 4065 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 4066 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 4067 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 4068 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 4069 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 4070 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 4071 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 4072 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4073 | { |
| 4074 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4075 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4076 | .info = alc_ch_mode_info, |
| 4077 | .get = alc_ch_mode_get, |
| 4078 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4079 | }, |
| 4080 | { } /* end */ |
| 4081 | }; |
| 4082 | |
| 4083 | static struct hda_verb alc880_test_init_verbs[] = { |
| 4084 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4085 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4087 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4088 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4089 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4090 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4091 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4093 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4095 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4096 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4097 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4098 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4100 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4101 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4102 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4103 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4105 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4106 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4107 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4108 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4109 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 4110 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4111 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4112 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4113 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4114 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4115 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4116 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4117 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 4118 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4119 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4120 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4121 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4122 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4123 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4124 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 4125 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4126 | /* Analog input/passthru */ |
| 4127 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4132 | { } |
| 4133 | }; |
| 4134 | #endif |
| 4135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4136 | /* |
| 4137 | */ |
| 4138 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4139 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 4140 | [ALC880_3ST] = "3stack", |
| 4141 | [ALC880_TCL_S700] = "tcl", |
| 4142 | [ALC880_3ST_DIG] = "3stack-digout", |
| 4143 | [ALC880_CLEVO] = "clevo", |
| 4144 | [ALC880_5ST] = "5stack", |
| 4145 | [ALC880_5ST_DIG] = "5stack-digout", |
| 4146 | [ALC880_W810] = "w810", |
| 4147 | [ALC880_Z71V] = "z71v", |
| 4148 | [ALC880_6ST] = "6stack", |
| 4149 | [ALC880_6ST_DIG] = "6stack-digout", |
| 4150 | [ALC880_ASUS] = "asus", |
| 4151 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 4152 | [ALC880_ASUS_DIG] = "asus-dig", |
| 4153 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 4154 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4155 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 4156 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4157 | [ALC880_F1734] = "F1734", |
| 4158 | [ALC880_LG] = "lg", |
| 4159 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4160 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4161 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4162 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 4163 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4164 | [ALC880_AUTO] = "auto", |
| 4165 | }; |
| 4166 | |
| 4167 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4168 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4169 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 4170 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 4171 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 4172 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 4173 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 4174 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 4175 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 4176 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4177 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 4178 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4179 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 4180 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 4181 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 4182 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 4183 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 4184 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 4185 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 4186 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 4187 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 4188 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 4189 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4190 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 4191 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 4192 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4193 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4194 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4195 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 4196 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4197 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 4198 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4199 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 4200 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 4201 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 4202 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4203 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 4204 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4205 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4206 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4207 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4208 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4209 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 4210 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4211 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4212 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4213 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4214 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4215 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 4216 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4217 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4218 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4219 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4220 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 4221 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4222 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4223 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 4224 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 4225 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 4226 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4227 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 4228 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4229 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4230 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4231 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 4232 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4233 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 4234 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 4235 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 4236 | /* default Intel */ |
| 4237 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4238 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 4239 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4240 | {} |
| 4241 | }; |
| 4242 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4243 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4244 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4245 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4246 | static struct alc_config_preset alc880_presets[] = { |
| 4247 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4248 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4249 | .init_verbs = { alc880_volume_init_verbs, |
| 4250 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4251 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4252 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4253 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4254 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4255 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4256 | .input_mux = &alc880_capture_source, |
| 4257 | }, |
| 4258 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4259 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4260 | .init_verbs = { alc880_volume_init_verbs, |
| 4261 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4262 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4263 | .dac_nids = alc880_dac_nids, |
| 4264 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4265 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4266 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4267 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4268 | .input_mux = &alc880_capture_source, |
| 4269 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4270 | [ALC880_TCL_S700] = { |
| 4271 | .mixers = { alc880_tcl_s700_mixer }, |
| 4272 | .init_verbs = { alc880_volume_init_verbs, |
| 4273 | alc880_pin_tcl_S700_init_verbs, |
| 4274 | alc880_gpio2_init_verbs }, |
| 4275 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4276 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4277 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4278 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4279 | .hp_nid = 0x03, |
| 4280 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4281 | .channel_mode = alc880_2_jack_modes, |
| 4282 | .input_mux = &alc880_capture_source, |
| 4283 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4284 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4285 | .mixers = { alc880_three_stack_mixer, |
| 4286 | alc880_five_stack_mixer}, |
| 4287 | .init_verbs = { alc880_volume_init_verbs, |
| 4288 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4289 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4290 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4291 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4292 | .channel_mode = alc880_fivestack_modes, |
| 4293 | .input_mux = &alc880_capture_source, |
| 4294 | }, |
| 4295 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4296 | .mixers = { alc880_three_stack_mixer, |
| 4297 | alc880_five_stack_mixer }, |
| 4298 | .init_verbs = { alc880_volume_init_verbs, |
| 4299 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4300 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4301 | .dac_nids = alc880_dac_nids, |
| 4302 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4303 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4304 | .channel_mode = alc880_fivestack_modes, |
| 4305 | .input_mux = &alc880_capture_source, |
| 4306 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4307 | [ALC880_6ST] = { |
| 4308 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4309 | .init_verbs = { alc880_volume_init_verbs, |
| 4310 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4311 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4312 | .dac_nids = alc880_6st_dac_nids, |
| 4313 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4314 | .channel_mode = alc880_sixstack_modes, |
| 4315 | .input_mux = &alc880_6stack_capture_source, |
| 4316 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4317 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4318 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | .init_verbs = { alc880_volume_init_verbs, |
| 4320 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4321 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4322 | .dac_nids = alc880_6st_dac_nids, |
| 4323 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4324 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4325 | .channel_mode = alc880_sixstack_modes, |
| 4326 | .input_mux = &alc880_6stack_capture_source, |
| 4327 | }, |
| 4328 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4329 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4330 | .init_verbs = { alc880_volume_init_verbs, |
| 4331 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4332 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4333 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4334 | .dac_nids = alc880_w810_dac_nids, |
| 4335 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4336 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4337 | .channel_mode = alc880_w810_modes, |
| 4338 | .input_mux = &alc880_capture_source, |
| 4339 | }, |
| 4340 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4341 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4342 | .init_verbs = { alc880_volume_init_verbs, |
| 4343 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4344 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4345 | .dac_nids = alc880_z71v_dac_nids, |
| 4346 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4347 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4348 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4349 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4350 | .input_mux = &alc880_capture_source, |
| 4351 | }, |
| 4352 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4353 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | .init_verbs = { alc880_volume_init_verbs, |
| 4355 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4356 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4357 | .dac_nids = alc880_f1734_dac_nids, |
| 4358 | .hp_nid = 0x02, |
| 4359 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4360 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4361 | .input_mux = &alc880_f1734_capture_source, |
| 4362 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4363 | .setup = alc880_uniwill_p53_setup, |
| 4364 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4365 | }, |
| 4366 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4368 | .init_verbs = { alc880_volume_init_verbs, |
| 4369 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4370 | alc880_gpio1_init_verbs }, |
| 4371 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4372 | .dac_nids = alc880_asus_dac_nids, |
| 4373 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4374 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4375 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4376 | .input_mux = &alc880_capture_source, |
| 4377 | }, |
| 4378 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4379 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4380 | .init_verbs = { alc880_volume_init_verbs, |
| 4381 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4382 | alc880_gpio1_init_verbs }, |
| 4383 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4384 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4385 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4386 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4387 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4388 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4389 | .input_mux = &alc880_capture_source, |
| 4390 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4391 | [ALC880_ASUS_DIG2] = { |
| 4392 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4393 | .init_verbs = { alc880_volume_init_verbs, |
| 4394 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4395 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4396 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4397 | .dac_nids = alc880_asus_dac_nids, |
| 4398 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4399 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4400 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4401 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4402 | .input_mux = &alc880_capture_source, |
| 4403 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4404 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4405 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4406 | .init_verbs = { alc880_volume_init_verbs, |
| 4407 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4408 | alc880_gpio1_init_verbs }, |
| 4409 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4410 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4411 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4412 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4413 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4414 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4415 | .input_mux = &alc880_capture_source, |
| 4416 | }, |
| 4417 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4418 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4419 | .init_verbs = { alc880_volume_init_verbs, |
| 4420 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4421 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4422 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4423 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4425 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4426 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4427 | .input_mux = &alc880_capture_source, |
| 4428 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4429 | [ALC880_UNIWILL] = { |
| 4430 | .mixers = { alc880_uniwill_mixer }, |
| 4431 | .init_verbs = { alc880_volume_init_verbs, |
| 4432 | alc880_uniwill_init_verbs }, |
| 4433 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4434 | .dac_nids = alc880_asus_dac_nids, |
| 4435 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4436 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4437 | .channel_mode = alc880_threestack_modes, |
| 4438 | .need_dac_fix = 1, |
| 4439 | .input_mux = &alc880_capture_source, |
| 4440 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4441 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4442 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4443 | }, |
| 4444 | [ALC880_UNIWILL_P53] = { |
| 4445 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4446 | .init_verbs = { alc880_volume_init_verbs, |
| 4447 | alc880_uniwill_p53_init_verbs }, |
| 4448 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4449 | .dac_nids = alc880_asus_dac_nids, |
| 4450 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4451 | .channel_mode = alc880_threestack_modes, |
| 4452 | .input_mux = &alc880_capture_source, |
| 4453 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4454 | .setup = alc880_uniwill_p53_setup, |
| 4455 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4456 | }, |
| 4457 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4458 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4459 | .init_verbs = { alc880_volume_init_verbs, |
| 4460 | alc880_uniwill_p53_init_verbs, |
| 4461 | alc880_beep_init_verbs }, |
| 4462 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4463 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4464 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4465 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4466 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4467 | .input_mux = &alc880_capture_source, |
| 4468 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4469 | .setup = alc880_uniwill_p53_setup, |
| 4470 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4471 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4472 | [ALC880_CLEVO] = { |
| 4473 | .mixers = { alc880_three_stack_mixer }, |
| 4474 | .init_verbs = { alc880_volume_init_verbs, |
| 4475 | alc880_pin_clevo_init_verbs }, |
| 4476 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4477 | .dac_nids = alc880_dac_nids, |
| 4478 | .hp_nid = 0x03, |
| 4479 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4480 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4481 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4482 | .input_mux = &alc880_capture_source, |
| 4483 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4484 | [ALC880_LG] = { |
| 4485 | .mixers = { alc880_lg_mixer }, |
| 4486 | .init_verbs = { alc880_volume_init_verbs, |
| 4487 | alc880_lg_init_verbs }, |
| 4488 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4489 | .dac_nids = alc880_lg_dac_nids, |
| 4490 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4491 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4492 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4493 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4494 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4495 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4496 | .setup = alc880_lg_setup, |
| 4497 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4498 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4499 | .loopbacks = alc880_lg_loopbacks, |
| 4500 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4501 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4502 | [ALC880_LG_LW] = { |
| 4503 | .mixers = { alc880_lg_lw_mixer }, |
| 4504 | .init_verbs = { alc880_volume_init_verbs, |
| 4505 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4506 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4507 | .dac_nids = alc880_dac_nids, |
| 4508 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4509 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4510 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4511 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4512 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4513 | .setup = alc880_lg_lw_setup, |
| 4514 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4515 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4516 | [ALC880_MEDION_RIM] = { |
| 4517 | .mixers = { alc880_medion_rim_mixer }, |
| 4518 | .init_verbs = { alc880_volume_init_verbs, |
| 4519 | alc880_medion_rim_init_verbs, |
| 4520 | alc_gpio2_init_verbs }, |
| 4521 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4522 | .dac_nids = alc880_dac_nids, |
| 4523 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4524 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4525 | .channel_mode = alc880_2_jack_modes, |
| 4526 | .input_mux = &alc880_medion_rim_capture_source, |
| 4527 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4528 | .setup = alc880_medion_rim_setup, |
| 4529 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4530 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4531 | #ifdef CONFIG_SND_DEBUG |
| 4532 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4533 | .mixers = { alc880_test_mixer }, |
| 4534 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4535 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4536 | .dac_nids = alc880_test_dac_nids, |
| 4537 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4538 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4539 | .channel_mode = alc880_test_modes, |
| 4540 | .input_mux = &alc880_test_capture_source, |
| 4541 | }, |
| 4542 | #endif |
| 4543 | }; |
| 4544 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4545 | /* |
| 4546 | * Automatic parse of I/O pins from the BIOS configuration |
| 4547 | */ |
| 4548 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4549 | enum { |
| 4550 | ALC_CTL_WIDGET_VOL, |
| 4551 | ALC_CTL_WIDGET_MUTE, |
| 4552 | ALC_CTL_BIND_MUTE, |
| 4553 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4554 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4555 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4556 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4557 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4558 | }; |
| 4559 | |
| 4560 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4561 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4562 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4563 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4564 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4565 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4566 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4567 | knew = snd_array_new(&spec->kctls); |
| 4568 | if (!knew) |
| 4569 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4570 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4571 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4572 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4573 | return -ENOMEM; |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 4574 | if (get_amp_nid_(val)) |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 4575 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4576 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4577 | return 0; |
| 4578 | } |
| 4579 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4580 | static int add_control_with_pfx(struct alc_spec *spec, int type, |
| 4581 | const char *pfx, const char *dir, |
| 4582 | const char *sfx, unsigned long val) |
| 4583 | { |
| 4584 | char name[32]; |
| 4585 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); |
| 4586 | return add_control(spec, type, name, val); |
| 4587 | } |
| 4588 | |
| 4589 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ |
| 4590 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) |
| 4591 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ |
| 4592 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) |
| 4593 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4594 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4595 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4596 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4597 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4598 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4599 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4600 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4601 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4602 | #define ALC880_PIN_CD_NID 0x1c |
| 4603 | |
| 4604 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4605 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4606 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4607 | { |
| 4608 | hda_nid_t nid; |
| 4609 | int assigned[4]; |
| 4610 | int i, j; |
| 4611 | |
| 4612 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4613 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4614 | |
| 4615 | /* check the pins hardwired to audio widget */ |
| 4616 | for (i = 0; i < cfg->line_outs; i++) { |
| 4617 | nid = cfg->line_out_pins[i]; |
| 4618 | if (alc880_is_fixed_pin(nid)) { |
| 4619 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4620 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4621 | assigned[idx] = 1; |
| 4622 | } |
| 4623 | } |
| 4624 | /* left pins can be connect to any audio widget */ |
| 4625 | for (i = 0; i < cfg->line_outs; i++) { |
| 4626 | nid = cfg->line_out_pins[i]; |
| 4627 | if (alc880_is_fixed_pin(nid)) |
| 4628 | continue; |
| 4629 | /* search for an empty channel */ |
| 4630 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4631 | if (!assigned[j]) { |
| 4632 | spec->multiout.dac_nids[i] = |
| 4633 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4634 | assigned[j] = 1; |
| 4635 | break; |
| 4636 | } |
| 4637 | } |
| 4638 | } |
| 4639 | spec->multiout.num_dacs = cfg->line_outs; |
| 4640 | return 0; |
| 4641 | } |
| 4642 | |
| 4643 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4644 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4645 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4646 | { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4647 | static const char *chname[4] = { |
| 4648 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4649 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4650 | hda_nid_t nid; |
| 4651 | int i, err; |
| 4652 | |
| 4653 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4654 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4655 | continue; |
| 4656 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4657 | if (i == 2) { |
| 4658 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4659 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4660 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4661 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4662 | HDA_OUTPUT)); |
| 4663 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4664 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4665 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 4666 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4667 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4668 | HDA_OUTPUT)); |
| 4669 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4670 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4671 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4672 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4673 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4674 | HDA_INPUT)); |
| 4675 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4676 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4677 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 4678 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4679 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4680 | HDA_INPUT)); |
| 4681 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4682 | return err; |
| 4683 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4684 | const char *pfx; |
| 4685 | if (cfg->line_outs == 1 && |
| 4686 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4687 | pfx = "Speaker"; |
| 4688 | else |
| 4689 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4690 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4691 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4692 | HDA_OUTPUT)); |
| 4693 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4694 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4695 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4696 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4697 | HDA_INPUT)); |
| 4698 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4699 | return err; |
| 4700 | } |
| 4701 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4702 | return 0; |
| 4703 | } |
| 4704 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4705 | /* add playback controls for speaker and HP outputs */ |
| 4706 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4707 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4708 | { |
| 4709 | hda_nid_t nid; |
| 4710 | int err; |
| 4711 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4712 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4713 | return 0; |
| 4714 | |
| 4715 | if (alc880_is_fixed_pin(pin)) { |
| 4716 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4717 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4718 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4719 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4720 | else |
| 4721 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4722 | /* control HP volume/switch on the output mixer amp */ |
| 4723 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4724 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4725 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4726 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4727 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4728 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4729 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4730 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4731 | return err; |
| 4732 | } else if (alc880_is_multi_pin(pin)) { |
| 4733 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4734 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4735 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4736 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4737 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4738 | return err; |
| 4739 | } |
| 4740 | return 0; |
| 4741 | } |
| 4742 | |
| 4743 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4744 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4745 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4746 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4747 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4748 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4749 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4750 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4751 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4752 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4753 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 4754 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4755 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4756 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4757 | return err; |
| 4758 | return 0; |
| 4759 | } |
| 4760 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4761 | 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] | 4762 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4763 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4764 | return (pincap & AC_PINCAP_IN) != 0; |
| 4765 | } |
| 4766 | |
| 4767 | /* create playback/capture controls for input pins */ |
| 4768 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4769 | const struct auto_pin_cfg *cfg, |
| 4770 | hda_nid_t mixer, |
| 4771 | hda_nid_t cap1, hda_nid_t cap2) |
| 4772 | { |
| 4773 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4774 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4775 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4776 | |
| 4777 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4778 | hda_nid_t pin; |
| 4779 | |
| 4780 | pin = cfg->input_pins[i]; |
| 4781 | if (!alc_is_input_pin(codec, pin)) |
| 4782 | continue; |
| 4783 | |
| 4784 | if (mixer) { |
| 4785 | idx = get_connection_index(codec, mixer, pin); |
| 4786 | if (idx >= 0) { |
| 4787 | err = new_analog_input(spec, pin, |
| 4788 | auto_pin_cfg_labels[i], |
| 4789 | idx, mixer); |
| 4790 | if (err < 0) |
| 4791 | return err; |
| 4792 | } |
| 4793 | } |
| 4794 | |
| 4795 | if (!cap1) |
| 4796 | continue; |
| 4797 | idx = get_connection_index(codec, cap1, pin); |
| 4798 | if (idx < 0 && cap2) |
| 4799 | idx = get_connection_index(codec, cap2, pin); |
| 4800 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4801 | imux->items[imux->num_items].label = |
| 4802 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4803 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4804 | imux->num_items++; |
| 4805 | } |
| 4806 | } |
| 4807 | return 0; |
| 4808 | } |
| 4809 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4810 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4811 | const struct auto_pin_cfg *cfg) |
| 4812 | { |
| 4813 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4814 | } |
| 4815 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4816 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4817 | unsigned int pin_type) |
| 4818 | { |
| 4819 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4820 | pin_type); |
| 4821 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4822 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4823 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4824 | } |
| 4825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4826 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4827 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4828 | int dac_idx) |
| 4829 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4830 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4831 | /* need the manual connection? */ |
| 4832 | if (alc880_is_multi_pin(nid)) { |
| 4833 | struct alc_spec *spec = codec->spec; |
| 4834 | int idx = alc880_multi_pin_idx(nid); |
| 4835 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4836 | AC_VERB_SET_CONNECT_SEL, |
| 4837 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4838 | } |
| 4839 | } |
| 4840 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4841 | static int get_pin_type(int line_out_type) |
| 4842 | { |
| 4843 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4844 | return PIN_HP; |
| 4845 | else |
| 4846 | return PIN_OUT; |
| 4847 | } |
| 4848 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4849 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4850 | { |
| 4851 | struct alc_spec *spec = codec->spec; |
| 4852 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4853 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4854 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4855 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4856 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4857 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4858 | } |
| 4859 | } |
| 4860 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4861 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4862 | { |
| 4863 | struct alc_spec *spec = codec->spec; |
| 4864 | hda_nid_t pin; |
| 4865 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4866 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4867 | if (pin) /* connect to front */ |
| 4868 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4869 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4870 | if (pin) /* connect to front */ |
| 4871 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4872 | } |
| 4873 | |
| 4874 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4875 | { |
| 4876 | struct alc_spec *spec = codec->spec; |
| 4877 | int i; |
| 4878 | |
| 4879 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4880 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4881 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4882 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4883 | if (nid != ALC880_PIN_CD_NID && |
| 4884 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4885 | snd_hda_codec_write(codec, nid, 0, |
| 4886 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4887 | AMP_OUT_MUTE); |
| 4888 | } |
| 4889 | } |
| 4890 | } |
| 4891 | |
| 4892 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4893 | /* return 1 if successful, 0 if the proper config is not found, |
| 4894 | * or a negative error code |
| 4895 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4896 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4897 | { |
| 4898 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4899 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4900 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4901 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4902 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4903 | alc880_ignore); |
| 4904 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4905 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4906 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4907 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4908 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4909 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4910 | if (err < 0) |
| 4911 | return err; |
| 4912 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4913 | if (err < 0) |
| 4914 | return err; |
| 4915 | err = alc880_auto_create_extra_out(spec, |
| 4916 | spec->autocfg.speaker_pins[0], |
| 4917 | "Speaker"); |
| 4918 | if (err < 0) |
| 4919 | return err; |
| 4920 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4921 | "Headphone"); |
| 4922 | if (err < 0) |
| 4923 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4924 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4925 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4926 | return err; |
| 4927 | |
| 4928 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4929 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4930 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4931 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4932 | hda_nid_t dig_nid; |
| 4933 | err = snd_hda_get_connections(codec, |
| 4934 | spec->autocfg.dig_out_pins[i], |
| 4935 | &dig_nid, 1); |
| 4936 | if (err < 0) |
| 4937 | continue; |
| 4938 | if (!i) |
| 4939 | spec->multiout.dig_out_nid = dig_nid; |
| 4940 | else { |
| 4941 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4942 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4943 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 4944 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4945 | } |
| 4946 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4947 | if (spec->autocfg.dig_in_pin) |
| 4948 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4949 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4950 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4951 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4952 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4953 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4954 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4955 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4956 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4957 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 4958 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4959 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4960 | return 1; |
| 4961 | } |
| 4962 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4963 | /* additional initialization for auto-configuration model */ |
| 4964 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4965 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4966 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4967 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4968 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4969 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4970 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4971 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4972 | } |
| 4973 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4974 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4975 | * one of two digital mic pins, e.g. on ALC272 |
| 4976 | */ |
| 4977 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4978 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4979 | struct alc_spec *spec = codec->spec; |
| 4980 | int i; |
| 4981 | |
| 4982 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4983 | hda_nid_t cap = spec->capsrc_nids ? |
| 4984 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4985 | int iidx, eidx; |
| 4986 | |
| 4987 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4988 | if (iidx < 0) |
| 4989 | continue; |
| 4990 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4991 | if (eidx < 0) |
| 4992 | continue; |
| 4993 | spec->int_mic.mux_idx = iidx; |
| 4994 | spec->ext_mic.mux_idx = eidx; |
| 4995 | if (spec->capsrc_nids) |
| 4996 | spec->capsrc_nids += i; |
| 4997 | spec->adc_nids += i; |
| 4998 | spec->num_adc_nids = 1; |
| 4999 | return; |
| 5000 | } |
| 5001 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 5002 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 5003 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 5004 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 5005 | } |
| 5006 | |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5007 | /* choose the ADC/MUX containing the input pin and initialize the setup */ |
| 5008 | static void fixup_single_adc(struct hda_codec *codec) |
| 5009 | { |
| 5010 | struct alc_spec *spec = codec->spec; |
Frederik Deweerdt | d2db09b | 2010-03-05 16:34:31 +0100 | [diff] [blame] | 5011 | hda_nid_t pin = 0; |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5012 | int i; |
| 5013 | |
| 5014 | /* search for the input pin; there must be only one */ |
| 5015 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5016 | if (spec->autocfg.input_pins[i]) { |
| 5017 | pin = spec->autocfg.input_pins[i]; |
| 5018 | break; |
| 5019 | } |
| 5020 | } |
| 5021 | if (!pin) |
| 5022 | return; |
| 5023 | |
| 5024 | /* set the default connection to that pin */ |
| 5025 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 5026 | hda_nid_t cap = spec->capsrc_nids ? |
| 5027 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 5028 | int idx; |
| 5029 | |
| 5030 | idx = get_connection_index(codec, cap, pin); |
| 5031 | if (idx < 0) |
| 5032 | continue; |
| 5033 | /* use only this ADC */ |
| 5034 | if (spec->capsrc_nids) |
| 5035 | spec->capsrc_nids += i; |
| 5036 | spec->adc_nids += i; |
| 5037 | spec->num_adc_nids = 1; |
| 5038 | /* select or unmute this route */ |
| 5039 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { |
| 5040 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, |
| 5041 | HDA_AMP_MUTE, 0); |
| 5042 | } else { |
| 5043 | snd_hda_codec_write_cache(codec, cap, 0, |
| 5044 | AC_VERB_SET_CONNECT_SEL, idx); |
| 5045 | } |
| 5046 | return; |
| 5047 | } |
| 5048 | } |
| 5049 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5050 | static void set_capture_mixer(struct hda_codec *codec) |
| 5051 | { |
| 5052 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5053 | static struct snd_kcontrol_new *caps[2][3] = { |
| 5054 | { alc_capture_mixer_nosrc1, |
| 5055 | alc_capture_mixer_nosrc2, |
| 5056 | alc_capture_mixer_nosrc3 }, |
| 5057 | { alc_capture_mixer1, |
| 5058 | alc_capture_mixer2, |
| 5059 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5060 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5061 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5062 | int mux = 0; |
| 5063 | if (spec->auto_mic) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5064 | fixup_automic_adc(codec); |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 5065 | else if (spec->input_mux) { |
| 5066 | if (spec->input_mux->num_items > 1) |
| 5067 | mux = 1; |
| 5068 | else if (spec->input_mux->num_items == 1) |
| 5069 | fixup_single_adc(codec); |
| 5070 | } |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 5071 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 5072 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 5073 | } |
| 5074 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5075 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ |
| 5076 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, |
| 5077 | int num_nids) |
| 5078 | { |
| 5079 | struct alc_spec *spec = codec->spec; |
| 5080 | int n; |
| 5081 | hda_nid_t fallback_adc = 0, fallback_cap = 0; |
| 5082 | |
| 5083 | for (n = 0; n < num_nids; n++) { |
| 5084 | hda_nid_t adc, cap; |
| 5085 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 5086 | int nconns, i, j; |
| 5087 | |
| 5088 | adc = nids[n]; |
| 5089 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) |
| 5090 | continue; |
| 5091 | cap = adc; |
| 5092 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5093 | ARRAY_SIZE(conn)); |
| 5094 | if (nconns == 1) { |
| 5095 | cap = conn[0]; |
| 5096 | nconns = snd_hda_get_connections(codec, cap, conn, |
| 5097 | ARRAY_SIZE(conn)); |
| 5098 | } |
| 5099 | if (nconns <= 0) |
| 5100 | continue; |
| 5101 | if (!fallback_adc) { |
| 5102 | fallback_adc = adc; |
| 5103 | fallback_cap = cap; |
| 5104 | } |
| 5105 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5106 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5107 | if (!nid) |
| 5108 | continue; |
| 5109 | for (j = 0; j < nconns; j++) { |
| 5110 | if (conn[j] == nid) |
| 5111 | break; |
| 5112 | } |
| 5113 | if (j >= nconns) |
| 5114 | break; |
| 5115 | } |
| 5116 | if (i >= AUTO_PIN_LAST) { |
| 5117 | int num_adcs = spec->num_adc_nids; |
| 5118 | spec->private_adc_nids[num_adcs] = adc; |
| 5119 | spec->private_capsrc_nids[num_adcs] = cap; |
| 5120 | spec->num_adc_nids++; |
| 5121 | spec->adc_nids = spec->private_adc_nids; |
| 5122 | if (adc != cap) |
| 5123 | spec->capsrc_nids = spec->private_capsrc_nids; |
| 5124 | } |
| 5125 | } |
| 5126 | if (!spec->num_adc_nids) { |
| 5127 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" |
Takashi Iwai | 1f85d72 | 2010-03-30 07:48:05 +0200 | [diff] [blame] | 5128 | " using fallback 0x%x\n", |
| 5129 | codec->chip_name, fallback_adc); |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 5130 | spec->private_adc_nids[0] = fallback_adc; |
| 5131 | spec->adc_nids = spec->private_adc_nids; |
| 5132 | if (fallback_adc != fallback_cap) { |
| 5133 | spec->private_capsrc_nids[0] = fallback_cap; |
| 5134 | spec->capsrc_nids = spec->private_adc_nids; |
| 5135 | } |
| 5136 | } |
| 5137 | } |
| 5138 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5139 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5140 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 5141 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 5142 | #else |
| 5143 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 5144 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5145 | |
| 5146 | /* |
| 5147 | * OK, here we have finally the patch for ALC880 |
| 5148 | */ |
| 5149 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5150 | static int patch_alc880(struct hda_codec *codec) |
| 5151 | { |
| 5152 | struct alc_spec *spec; |
| 5153 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5155 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5156 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5157 | if (spec == NULL) |
| 5158 | return -ENOMEM; |
| 5159 | |
| 5160 | codec->spec = spec; |
| 5161 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5162 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 5163 | alc880_models, |
| 5164 | alc880_cfg_tbl); |
| 5165 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5166 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5167 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5168 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5169 | } |
| 5170 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5171 | if (board_config == ALC880_AUTO) { |
| 5172 | /* automatic parse from the BIOS config */ |
| 5173 | err = alc880_parse_auto_config(codec); |
| 5174 | if (err < 0) { |
| 5175 | alc_free(codec); |
| 5176 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5177 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5178 | printk(KERN_INFO |
| 5179 | "hda_codec: Cannot set up configuration " |
| 5180 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5181 | board_config = ALC880_3ST; |
| 5182 | } |
| 5183 | } |
| 5184 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 5185 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 5186 | if (err < 0) { |
| 5187 | alc_free(codec); |
| 5188 | return err; |
| 5189 | } |
| 5190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5191 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 5192 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5193 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5194 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 5195 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5196 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5197 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5198 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 5199 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 5200 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5201 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5202 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 5203 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5204 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 5205 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5206 | if (wcap != AC_WID_AUD_IN) { |
| 5207 | spec->adc_nids = alc880_adc_nids_alt; |
| 5208 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5209 | } else { |
| 5210 | spec->adc_nids = alc880_adc_nids; |
| 5211 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5212 | } |
| 5213 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 5214 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 5215 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5216 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5217 | spec->vmaster_nid = 0x0c; |
| 5218 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5219 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5220 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5221 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5222 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5223 | if (!spec->loopback.amplist) |
| 5224 | spec->loopback.amplist = alc880_loopbacks; |
| 5225 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5226 | |
| 5227 | return 0; |
| 5228 | } |
| 5229 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5230 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5231 | /* |
| 5232 | * ALC260 support |
| 5233 | */ |
| 5234 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5235 | static hda_nid_t alc260_dac_nids[1] = { |
| 5236 | /* front */ |
| 5237 | 0x02, |
| 5238 | }; |
| 5239 | |
| 5240 | static hda_nid_t alc260_adc_nids[1] = { |
| 5241 | /* ADC0 */ |
| 5242 | 0x04, |
| 5243 | }; |
| 5244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5245 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5246 | /* ADC1 */ |
| 5247 | 0x05, |
| 5248 | }; |
| 5249 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5250 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 5251 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 5252 | */ |
| 5253 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5254 | /* ADC0, ADC1 */ |
| 5255 | 0x04, 0x05 |
| 5256 | }; |
| 5257 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5258 | #define ALC260_DIGOUT_NID 0x03 |
| 5259 | #define ALC260_DIGIN_NID 0x06 |
| 5260 | |
| 5261 | static struct hda_input_mux alc260_capture_source = { |
| 5262 | .num_items = 4, |
| 5263 | .items = { |
| 5264 | { "Mic", 0x0 }, |
| 5265 | { "Front Mic", 0x1 }, |
| 5266 | { "Line", 0x2 }, |
| 5267 | { "CD", 0x4 }, |
| 5268 | }, |
| 5269 | }; |
| 5270 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5271 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5272 | * headphone jack and the internal CD lines since these are the only pins at |
| 5273 | * which audio can appear. For flexibility, also allow the option of |
| 5274 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 5275 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5276 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5277 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 5278 | { |
| 5279 | .num_items = 3, |
| 5280 | .items = { |
| 5281 | { "Mic/Line", 0x0 }, |
| 5282 | { "CD", 0x4 }, |
| 5283 | { "Headphone", 0x2 }, |
| 5284 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5285 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5286 | { |
| 5287 | .num_items = 4, |
| 5288 | .items = { |
| 5289 | { "Mic/Line", 0x0 }, |
| 5290 | { "CD", 0x4 }, |
| 5291 | { "Headphone", 0x2 }, |
| 5292 | { "Mixer", 0x5 }, |
| 5293 | }, |
| 5294 | }, |
| 5295 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5296 | }; |
| 5297 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5298 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 5299 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5300 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5301 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 5302 | { |
| 5303 | .num_items = 4, |
| 5304 | .items = { |
| 5305 | { "Mic", 0x0 }, |
| 5306 | { "Line", 0x2 }, |
| 5307 | { "CD", 0x4 }, |
| 5308 | { "Headphone", 0x5 }, |
| 5309 | }, |
| 5310 | }, |
| 5311 | { |
| 5312 | .num_items = 5, |
| 5313 | .items = { |
| 5314 | { "Mic", 0x0 }, |
| 5315 | { "Line", 0x2 }, |
| 5316 | { "CD", 0x4 }, |
| 5317 | { "Headphone", 0x6 }, |
| 5318 | { "Mixer", 0x5 }, |
| 5319 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5320 | }, |
| 5321 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5322 | |
| 5323 | /* Maxdata Favorit 100XS */ |
| 5324 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 5325 | { |
| 5326 | .num_items = 2, |
| 5327 | .items = { |
| 5328 | { "Line/Mic", 0x0 }, |
| 5329 | { "CD", 0x4 }, |
| 5330 | }, |
| 5331 | }, |
| 5332 | { |
| 5333 | .num_items = 3, |
| 5334 | .items = { |
| 5335 | { "Line/Mic", 0x0 }, |
| 5336 | { "CD", 0x4 }, |
| 5337 | { "Mixer", 0x5 }, |
| 5338 | }, |
| 5339 | }, |
| 5340 | }; |
| 5341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5342 | /* |
| 5343 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 5344 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 5345 | * element which allows changing the channel mode, so the verb list is |
| 5346 | * never used. |
| 5347 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5348 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5349 | { 2, NULL }, |
| 5350 | }; |
| 5351 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5352 | |
| 5353 | /* Mixer combinations |
| 5354 | * |
| 5355 | * basic: base_output + input + pc_beep + capture |
| 5356 | * HP: base_output + input + capture_alt |
| 5357 | * HP_3013: hp_3013 + input + capture |
| 5358 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5359 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5360 | */ |
| 5361 | |
| 5362 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5363 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5364 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5365 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5366 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5367 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5368 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5369 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5370 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5371 | |
| 5372 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5374 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5375 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5376 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5377 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5378 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5379 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5381 | { } /* end */ |
| 5382 | }; |
| 5383 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5384 | /* update HP, line and mono out pins according to the master switch */ |
| 5385 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5386 | hda_nid_t hp, hda_nid_t line, |
| 5387 | hda_nid_t mono) |
| 5388 | { |
| 5389 | struct alc_spec *spec = codec->spec; |
| 5390 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5391 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5392 | 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] | 5393 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5394 | 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] | 5395 | val); |
| 5396 | /* mono (speaker) depending on the HP jack sense */ |
| 5397 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5398 | 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] | 5399 | val); |
| 5400 | } |
| 5401 | |
| 5402 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5403 | struct snd_ctl_elem_value *ucontrol) |
| 5404 | { |
| 5405 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5406 | struct alc_spec *spec = codec->spec; |
| 5407 | *ucontrol->value.integer.value = spec->master_sw; |
| 5408 | return 0; |
| 5409 | } |
| 5410 | |
| 5411 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5412 | struct snd_ctl_elem_value *ucontrol) |
| 5413 | { |
| 5414 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5415 | struct alc_spec *spec = codec->spec; |
| 5416 | int val = !!*ucontrol->value.integer.value; |
| 5417 | hda_nid_t hp, line, mono; |
| 5418 | |
| 5419 | if (val == spec->master_sw) |
| 5420 | return 0; |
| 5421 | spec->master_sw = val; |
| 5422 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5423 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5424 | mono = kcontrol->private_value & 0xff; |
| 5425 | alc260_hp_master_update(codec, hp, line, mono); |
| 5426 | return 1; |
| 5427 | } |
| 5428 | |
| 5429 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5430 | { |
| 5431 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5432 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5433 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5434 | .info = snd_ctl_boolean_mono_info, |
| 5435 | .get = alc260_hp_master_sw_get, |
| 5436 | .put = alc260_hp_master_sw_put, |
| 5437 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5438 | }, |
| 5439 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5440 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5441 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5442 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5443 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5444 | HDA_OUTPUT), |
| 5445 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5446 | { } /* end */ |
| 5447 | }; |
| 5448 | |
| 5449 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5450 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5451 | {}, |
| 5452 | }; |
| 5453 | |
| 5454 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5455 | { |
| 5456 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5457 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5458 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5459 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5460 | } |
| 5461 | |
| 5462 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5463 | { |
| 5464 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5465 | alc260_hp_automute(codec); |
| 5466 | } |
| 5467 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5468 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5469 | { |
| 5470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5471 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 5472 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5473 | .info = snd_ctl_boolean_mono_info, |
| 5474 | .get = alc260_hp_master_sw_get, |
| 5475 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5476 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5477 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5478 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5479 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5480 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5481 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5482 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5483 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5484 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5485 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5486 | { } /* end */ |
| 5487 | }; |
| 5488 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5489 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5490 | .ops = &snd_hda_bind_vol, |
| 5491 | .values = { |
| 5492 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5493 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5494 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5495 | 0 |
| 5496 | }, |
| 5497 | }; |
| 5498 | |
| 5499 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5500 | .ops = &snd_hda_bind_sw, |
| 5501 | .values = { |
| 5502 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5503 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5504 | 0 |
| 5505 | }, |
| 5506 | }; |
| 5507 | |
| 5508 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5509 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5510 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5511 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5512 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5513 | { } /* end */ |
| 5514 | }; |
| 5515 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5516 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5517 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5518 | {}, |
| 5519 | }; |
| 5520 | |
| 5521 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5522 | { |
| 5523 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5524 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5525 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5526 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5527 | } |
| 5528 | |
| 5529 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5530 | unsigned int res) |
| 5531 | { |
| 5532 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5533 | alc260_hp_3013_automute(codec); |
| 5534 | } |
| 5535 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5536 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5537 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 5538 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5539 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5540 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5541 | bits); |
| 5542 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5543 | bits); |
| 5544 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5545 | bits); |
| 5546 | } |
| 5547 | |
| 5548 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5549 | unsigned int res) |
| 5550 | { |
| 5551 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5552 | alc260_hp_3012_automute(codec); |
| 5553 | } |
| 5554 | |
| 5555 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5556 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5557 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5558 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5559 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5560 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5561 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5563 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5564 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5565 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5566 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5567 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5568 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5569 | { } /* end */ |
| 5570 | }; |
| 5571 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5572 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5573 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5574 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5575 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5576 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5577 | * revisions available in early 2006. Therefore for now allow the |
| 5578 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5579 | * that the lack of mic bias for this NID is intentional we could change the |
| 5580 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5581 | * |
| 5582 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5583 | * don't appear to make the mic bias available from the "line" jack, even |
| 5584 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5585 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5586 | * and the output jack. If this turns out to be the case for all such |
| 5587 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5588 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5589 | * |
| 5590 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5591 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5592 | * controls for such models. On models without a "mono speaker" the control |
| 5593 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5594 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5595 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5596 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5597 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5598 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5599 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5600 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5601 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5602 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5603 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5604 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5605 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5606 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5607 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5608 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5609 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5610 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5611 | { } /* end */ |
| 5612 | }; |
| 5613 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5614 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5615 | */ |
| 5616 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5617 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5618 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5619 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5620 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5621 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5622 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5623 | { } /* end */ |
| 5624 | }; |
| 5625 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5626 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5627 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5628 | */ |
| 5629 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5630 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5631 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5633 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5634 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5635 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5636 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5637 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5638 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5639 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5640 | { } /* end */ |
| 5641 | }; |
| 5642 | |
| 5643 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5644 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5645 | */ |
| 5646 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5647 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5648 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5649 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5650 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5651 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5652 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5656 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5657 | { } /* end */ |
| 5658 | }; |
| 5659 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5660 | /* |
| 5661 | * initialization verbs |
| 5662 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5663 | static struct hda_verb alc260_init_verbs[] = { |
| 5664 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5665 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5666 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5667 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5668 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5669 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5670 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5671 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5672 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5673 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5674 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5675 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5676 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5677 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5678 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5679 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5680 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5681 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5682 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5683 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5684 | /* set connection select to line in (default select for this ADC) */ |
| 5685 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5686 | /* mute capture amp left and right */ |
| 5687 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5688 | /* set connection select to line in (default select for this ADC) */ |
| 5689 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5690 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5691 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5692 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5693 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5694 | /* set vol=0 HP mixer amp left and right */ |
| 5695 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5696 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5697 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5698 | /* set vol=0 Mono mixer amp left and right */ |
| 5699 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5700 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5701 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5702 | /* unmute LINE-2 out pin */ |
| 5703 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5704 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5705 | * Line In 2 = 0x03 |
| 5706 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5707 | /* mute analog inputs */ |
| 5708 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5709 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5710 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5711 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5713 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5714 | /* mute Front out path */ |
| 5715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5717 | /* mute Headphone out path */ |
| 5718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5720 | /* mute Mono out path */ |
| 5721 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5722 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5723 | { } |
| 5724 | }; |
| 5725 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5726 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5727 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5728 | /* Headphone and output */ |
| 5729 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5730 | /* mono output */ |
| 5731 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5732 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5733 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5734 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5735 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5736 | /* Line In pin widget for input */ |
| 5737 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5738 | /* Line-2 pin widget for output */ |
| 5739 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5740 | /* CD pin widget for input */ |
| 5741 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5742 | /* unmute amp left and right */ |
| 5743 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5744 | /* set connection select to line in (default select for this ADC) */ |
| 5745 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5746 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5748 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5749 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5750 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5752 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5753 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5754 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5755 | * Line In 2 = 0x03 |
| 5756 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5757 | /* mute analog inputs */ |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5760 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5761 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5762 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5763 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5764 | /* Unmute Front out path */ |
| 5765 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5766 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5767 | /* Unmute Headphone out path */ |
| 5768 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5769 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5770 | /* Unmute Mono out path */ |
| 5771 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5772 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5773 | { } |
| 5774 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5775 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5776 | |
| 5777 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5778 | /* Line out and output */ |
| 5779 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5780 | /* mono output */ |
| 5781 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5782 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5783 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5784 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5785 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5786 | /* Line In pin widget for input */ |
| 5787 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5788 | /* Headphone pin widget for output */ |
| 5789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5790 | /* CD pin widget for input */ |
| 5791 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5792 | /* unmute amp left and right */ |
| 5793 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5794 | /* set connection select to line in (default select for this ADC) */ |
| 5795 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5796 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5797 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5798 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5799 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5800 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5801 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5802 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5803 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5804 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5805 | * Line In 2 = 0x03 |
| 5806 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5807 | /* mute analog inputs */ |
| 5808 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5809 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5810 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5811 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5812 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5813 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5814 | /* Unmute Front out path */ |
| 5815 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5816 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5817 | /* Unmute Headphone out path */ |
| 5818 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5819 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5820 | /* Unmute Mono out path */ |
| 5821 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5822 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5823 | { } |
| 5824 | }; |
| 5825 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5826 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5827 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5828 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5829 | */ |
| 5830 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5831 | /* Disable all GPIOs */ |
| 5832 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5833 | /* Internal speaker is connected to headphone pin */ |
| 5834 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5835 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5836 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5837 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5838 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5839 | /* Ensure all other unused pins are disabled and muted. */ |
| 5840 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5841 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5842 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5843 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5844 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5845 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5848 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5849 | /* Disable digital (SPDIF) pins */ |
| 5850 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5851 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5852 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5853 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5854 | * when acting as an output. |
| 5855 | */ |
| 5856 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5857 | |
| 5858 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5860 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5861 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5862 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5863 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5864 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5865 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5866 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5867 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5868 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5869 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5870 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5871 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5872 | * If the pin mode is changed by the user the pin mode control will |
| 5873 | * take care of enabling the pin's input/output buffers as needed. |
| 5874 | * Therefore there's no need to enable the input buffer at this |
| 5875 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5876 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5877 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5878 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5879 | * mixer ctrl) |
| 5880 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5881 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5882 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5883 | /* Mute capture amp left and right */ |
| 5884 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5885 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5886 | * in (on mic1 pin) |
| 5887 | */ |
| 5888 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5889 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5890 | /* Do the same for the second ADC: mute capture input amp and |
| 5891 | * set ADC connection to line in (on mic1 pin) |
| 5892 | */ |
| 5893 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5894 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5895 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5896 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5900 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5901 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5902 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5904 | {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] | 5905 | |
| 5906 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5907 | }; |
| 5908 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5909 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5910 | * similar laptops (adapted from Fujitsu init verbs). |
| 5911 | */ |
| 5912 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5913 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5914 | * the headphone jack. Turn this on and rely on the standard mute |
| 5915 | * methods whenever the user wants to turn these outputs off. |
| 5916 | */ |
| 5917 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5918 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5919 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5920 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5921 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5922 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5923 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5924 | /* Line In jack is connected to Line1 pin */ |
| 5925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5926 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5927 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5928 | /* Ensure all other unused pins are disabled and muted. */ |
| 5929 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5930 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5931 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5932 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5933 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5934 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5935 | /* Disable digital (SPDIF) pins */ |
| 5936 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5937 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5938 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5939 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5940 | * bus when acting as outputs. |
| 5941 | */ |
| 5942 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5943 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5944 | |
| 5945 | /* Start with output sum widgets muted and their output gains at min */ |
| 5946 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5948 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5949 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5950 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5951 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5952 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5953 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5954 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5955 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5956 | /* Unmute Line-out pin widget amp left and right |
| 5957 | * (no equiv mixer ctrl) |
| 5958 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5959 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5960 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5961 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5962 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5963 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5964 | * will take care of enabling the pin's input/output buffers as needed. |
| 5965 | * Therefore there's no need to enable the input buffer at this |
| 5966 | * stage. |
| 5967 | */ |
| 5968 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5969 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5970 | |
| 5971 | /* Mute capture amp left and right */ |
| 5972 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5973 | /* Set ADC connection select to match default mixer setting - mic |
| 5974 | * (on mic1 pin) |
| 5975 | */ |
| 5976 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5977 | |
| 5978 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5979 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5980 | */ |
| 5981 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5982 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5983 | |
| 5984 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5985 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5986 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5990 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5992 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5993 | |
| 5994 | { } |
| 5995 | }; |
| 5996 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5997 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5998 | * (adapted from Acer init verbs). |
| 5999 | */ |
| 6000 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 6001 | /* GPIO 0 enables the output jack. |
| 6002 | * Turn this on and rely on the standard mute |
| 6003 | * methods whenever the user wants to turn these outputs off. |
| 6004 | */ |
| 6005 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6006 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6007 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 6008 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 6009 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 6010 | /* Ensure all other unused pins are disabled and muted. */ |
| 6011 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6012 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6013 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6014 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6015 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6016 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6017 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6018 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6019 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 6020 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6021 | /* Disable digital (SPDIF) pins */ |
| 6022 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6023 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6024 | |
| 6025 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 6026 | * bus when acting as outputs. |
| 6027 | */ |
| 6028 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6029 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6030 | |
| 6031 | /* Start with output sum widgets muted and their output gains at min */ |
| 6032 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6033 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6034 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6036 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6037 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6038 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6039 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6040 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6041 | |
| 6042 | /* Unmute Line-out pin widget amp left and right |
| 6043 | * (no equiv mixer ctrl) |
| 6044 | */ |
| 6045 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6046 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 6047 | * inputs. If the pin mode is changed by the user the pin mode control |
| 6048 | * will take care of enabling the pin's input/output buffers as needed. |
| 6049 | * Therefore there's no need to enable the input buffer at this |
| 6050 | * stage. |
| 6051 | */ |
| 6052 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6053 | |
| 6054 | /* Mute capture amp left and right */ |
| 6055 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6056 | /* Set ADC connection select to match default mixer setting - mic |
| 6057 | * (on mic1 pin) |
| 6058 | */ |
| 6059 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6060 | |
| 6061 | /* Do similar with the second ADC: mute capture input amp and |
| 6062 | * set ADC connection to mic to match ALSA's default state. |
| 6063 | */ |
| 6064 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6065 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6066 | |
| 6067 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6068 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6069 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6070 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6071 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6072 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6073 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6074 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6075 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6076 | |
| 6077 | { } |
| 6078 | }; |
| 6079 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6080 | static struct hda_verb alc260_will_verbs[] = { |
| 6081 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6082 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6083 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6084 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6085 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6086 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 6087 | {} |
| 6088 | }; |
| 6089 | |
| 6090 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 6091 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 6092 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6093 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 6094 | |
| 6095 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 6096 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 6097 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6098 | |
| 6099 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6100 | {} |
| 6101 | }; |
| 6102 | |
| 6103 | /* toggle speaker-output according to the hp-jack state */ |
| 6104 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 6105 | { |
| 6106 | unsigned int present; |
| 6107 | |
| 6108 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 6109 | present = snd_hda_jack_detect(codec, 0x0f); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6110 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6111 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6112 | AC_VERB_SET_GPIO_DATA, 1); |
| 6113 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6114 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6115 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6116 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6117 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 6118 | AC_VERB_SET_GPIO_DATA, 0); |
| 6119 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 6120 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6121 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6122 | } |
| 6123 | } |
| 6124 | |
| 6125 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 6126 | unsigned int res) |
| 6127 | { |
| 6128 | if ((res >> 26) == ALC880_HP_EVENT) |
| 6129 | alc260_replacer_672v_automute(codec); |
| 6130 | } |
| 6131 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6132 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 6133 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6134 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6135 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6136 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6137 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6138 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6139 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6140 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6141 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6142 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 6143 | {} |
| 6144 | }; |
| 6145 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6146 | /* Test configuration for debugging, modelled after the ALC880 test |
| 6147 | * configuration. |
| 6148 | */ |
| 6149 | #ifdef CONFIG_SND_DEBUG |
| 6150 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 6151 | 0x02, |
| 6152 | }; |
| 6153 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 6154 | 0x04, 0x05, |
| 6155 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6156 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6157 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6158 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 6159 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6160 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 6161 | { |
| 6162 | .num_items = 7, |
| 6163 | .items = { |
| 6164 | { "MIC1 pin", 0x0 }, |
| 6165 | { "MIC2 pin", 0x1 }, |
| 6166 | { "LINE1 pin", 0x2 }, |
| 6167 | { "LINE2 pin", 0x3 }, |
| 6168 | { "CD pin", 0x4 }, |
| 6169 | { "LINE-OUT pin", 0x5 }, |
| 6170 | { "HP-OUT pin", 0x6 }, |
| 6171 | }, |
| 6172 | }, |
| 6173 | { |
| 6174 | .num_items = 8, |
| 6175 | .items = { |
| 6176 | { "MIC1 pin", 0x0 }, |
| 6177 | { "MIC2 pin", 0x1 }, |
| 6178 | { "LINE1 pin", 0x2 }, |
| 6179 | { "LINE2 pin", 0x3 }, |
| 6180 | { "CD pin", 0x4 }, |
| 6181 | { "Mixer", 0x5 }, |
| 6182 | { "LINE-OUT pin", 0x6 }, |
| 6183 | { "HP-OUT pin", 0x7 }, |
| 6184 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6185 | }, |
| 6186 | }; |
| 6187 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 6188 | /* Output driver widgets */ |
| 6189 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 6190 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 6191 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 6192 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 6193 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 6194 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 6195 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6196 | /* Modes for retasking pin widgets |
| 6197 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 6198 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 6199 | * mention this restriction. At this stage it's not clear whether |
| 6200 | * this behaviour is intentional or is a hardware bug in chip |
| 6201 | * revisions available at least up until early 2006. Therefore for |
| 6202 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 6203 | * choices, but if it turns out that the lack of mic bias for these |
| 6204 | * NIDs is intentional we could change their modes from |
| 6205 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 6206 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6207 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 6208 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 6209 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 6210 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 6211 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 6212 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 6213 | |
| 6214 | /* Loopback mixer controls */ |
| 6215 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 6216 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 6217 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 6218 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 6219 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 6220 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 6221 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 6222 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 6223 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 6224 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6225 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 6226 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 6227 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 6228 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6229 | |
| 6230 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 6231 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 6232 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 6233 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 6234 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 6235 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6236 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 6237 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6238 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6239 | */ |
| 6240 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 6241 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 6242 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 6243 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 6244 | * this output to turn on an external amplifier. |
| 6245 | */ |
| 6246 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 6247 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 6248 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6249 | { } /* end */ |
| 6250 | }; |
| 6251 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 6252 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 6253 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 6254 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 6255 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 6256 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6257 | /* Enable retasking pins as output, initially without power amp */ |
| 6258 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6259 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6260 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6261 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6262 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6263 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6264 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 6265 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 6266 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 6267 | * payload also sets the generation to 0, output to be in "consumer" |
| 6268 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 6269 | * control. |
| 6270 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6271 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6272 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 6273 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6274 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6275 | * OUT1 sum bus when acting as an output. |
| 6276 | */ |
| 6277 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6278 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6279 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6280 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 6281 | |
| 6282 | /* Start with output sum widgets muted and their output gains at min */ |
| 6283 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6284 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6285 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6286 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6287 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6288 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6289 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6290 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6291 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6292 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 6293 | /* Unmute retasking pin widget output buffers since the default |
| 6294 | * state appears to be output. As the pin mode is changed by the |
| 6295 | * user the pin mode control will take care of enabling the pin's |
| 6296 | * input/output buffers as needed. |
| 6297 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6298 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6299 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6300 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6301 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6302 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6303 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6304 | /* Also unmute the mono-out pin widget */ |
| 6305 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6306 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6307 | /* Mute capture amp left and right */ |
| 6308 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6309 | /* Set ADC connection select to match default mixer setting (mic1 |
| 6310 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6311 | */ |
| 6312 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6313 | |
| 6314 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 6315 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6316 | */ |
| 6317 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6318 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6319 | |
| 6320 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 6321 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 6322 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 6323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 6324 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 6325 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 6326 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 6327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 6328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 6329 | |
| 6330 | { } |
| 6331 | }; |
| 6332 | #endif |
| 6333 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6334 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 6335 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6336 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6337 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 6338 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 6339 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6340 | /* |
| 6341 | * for BIOS auto-configuration |
| 6342 | */ |
| 6343 | |
| 6344 | 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] | 6345 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6346 | { |
| 6347 | hda_nid_t nid_vol; |
| 6348 | unsigned long vol_val, sw_val; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6349 | int err; |
| 6350 | |
| 6351 | if (nid >= 0x0f && nid < 0x11) { |
| 6352 | nid_vol = nid - 0x7; |
| 6353 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6354 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6355 | } else if (nid == 0x11) { |
| 6356 | nid_vol = nid - 0x7; |
| 6357 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 6358 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 6359 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 6360 | nid_vol = 0x08; |
| 6361 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 6362 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 6363 | } else |
| 6364 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6365 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6366 | if (!(*vol_bits & (1 << nid_vol))) { |
| 6367 | /* first control for the volume widget */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6368 | 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] | 6369 | if (err < 0) |
| 6370 | return err; |
| 6371 | *vol_bits |= (1 << nid_vol); |
| 6372 | } |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 6373 | 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] | 6374 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6375 | return err; |
| 6376 | return 1; |
| 6377 | } |
| 6378 | |
| 6379 | /* add playback controls from the parsed DAC table */ |
| 6380 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6381 | const struct auto_pin_cfg *cfg) |
| 6382 | { |
| 6383 | hda_nid_t nid; |
| 6384 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6385 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6386 | |
| 6387 | spec->multiout.num_dacs = 1; |
| 6388 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6389 | spec->multiout.dac_nids[0] = 0x02; |
| 6390 | |
| 6391 | nid = cfg->line_out_pins[0]; |
| 6392 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6393 | const char *pfx; |
| 6394 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6395 | pfx = "Master"; |
| 6396 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6397 | pfx = "Speaker"; |
| 6398 | else |
| 6399 | pfx = "Front"; |
| 6400 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6401 | if (err < 0) |
| 6402 | return err; |
| 6403 | } |
| 6404 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6405 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6407 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6408 | if (err < 0) |
| 6409 | return err; |
| 6410 | } |
| 6411 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6412 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6413 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6414 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6415 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6416 | if (err < 0) |
| 6417 | return err; |
| 6418 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6419 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6420 | } |
| 6421 | |
| 6422 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6423 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6424 | const struct auto_pin_cfg *cfg) |
| 6425 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6426 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6427 | } |
| 6428 | |
| 6429 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6430 | hda_nid_t nid, int pin_type, |
| 6431 | int sel_idx) |
| 6432 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6433 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6434 | /* need the manual connection? */ |
| 6435 | if (nid >= 0x12) { |
| 6436 | int idx = nid - 0x12; |
| 6437 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6438 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6439 | } |
| 6440 | } |
| 6441 | |
| 6442 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6443 | { |
| 6444 | struct alc_spec *spec = codec->spec; |
| 6445 | hda_nid_t nid; |
| 6446 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6447 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6448 | if (nid) { |
| 6449 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6450 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6451 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6452 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6453 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6454 | if (nid) |
| 6455 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6456 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6457 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6458 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6459 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6460 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6461 | |
| 6462 | #define ALC260_PIN_CD_NID 0x16 |
| 6463 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6464 | { |
| 6465 | struct alc_spec *spec = codec->spec; |
| 6466 | int i; |
| 6467 | |
| 6468 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6469 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6470 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6471 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6472 | if (nid != ALC260_PIN_CD_NID && |
| 6473 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6474 | snd_hda_codec_write(codec, nid, 0, |
| 6475 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6476 | AMP_OUT_MUTE); |
| 6477 | } |
| 6478 | } |
| 6479 | } |
| 6480 | |
| 6481 | /* |
| 6482 | * generic initialization of ADC, input mixers and output mixers |
| 6483 | */ |
| 6484 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6485 | /* |
| 6486 | * Unmute ADC0-1 and set the default input to mic-in |
| 6487 | */ |
| 6488 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6489 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6490 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6491 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6493 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6494 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6495 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6496 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6497 | */ |
| 6498 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6499 | /* mute analog inputs */ |
| 6500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6505 | |
| 6506 | /* |
| 6507 | * Set up output mixers (0x08 - 0x0a) |
| 6508 | */ |
| 6509 | /* set vol=0 to output mixers */ |
| 6510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6511 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6512 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6513 | /* set up input amps for analog loopback */ |
| 6514 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6515 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6516 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6517 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6518 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6519 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6520 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6521 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6522 | { } |
| 6523 | }; |
| 6524 | |
| 6525 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6526 | { |
| 6527 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6528 | int err; |
| 6529 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6530 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6531 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6532 | alc260_ignore); |
| 6533 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6534 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6535 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6536 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6537 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6538 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6539 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6540 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6541 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6542 | return err; |
| 6543 | |
| 6544 | spec->multiout.max_channels = 2; |
| 6545 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6546 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6547 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6548 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6549 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6550 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6551 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6552 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6553 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6554 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6555 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 6556 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6557 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6558 | return 1; |
| 6559 | } |
| 6560 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6561 | /* additional initialization for auto-configuration model */ |
| 6562 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6563 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6564 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6565 | alc260_auto_init_multi_out(codec); |
| 6566 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6567 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6568 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6569 | } |
| 6570 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6571 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6572 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6573 | { 0x07, HDA_INPUT, 0 }, |
| 6574 | { 0x07, HDA_INPUT, 1 }, |
| 6575 | { 0x07, HDA_INPUT, 2 }, |
| 6576 | { 0x07, HDA_INPUT, 3 }, |
| 6577 | { 0x07, HDA_INPUT, 4 }, |
| 6578 | { } /* end */ |
| 6579 | }; |
| 6580 | #endif |
| 6581 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6582 | /* |
| 6583 | * ALC260 configurations |
| 6584 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6585 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6586 | [ALC260_BASIC] = "basic", |
| 6587 | [ALC260_HP] = "hp", |
| 6588 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6589 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6590 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6591 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6592 | [ALC260_WILL] = "will", |
| 6593 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6594 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6595 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6596 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6597 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6598 | [ALC260_AUTO] = "auto", |
| 6599 | }; |
| 6600 | |
| 6601 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6602 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Daniel T Chen | 950200e | 2009-12-13 14:11:02 -0500 | [diff] [blame] | 6603 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6604 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6605 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6606 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | 4ac5598 | 2009-11-10 16:08:45 +0100 | [diff] [blame] | 6607 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6608 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6609 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6610 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6611 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6612 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6613 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6614 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6615 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6616 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6617 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6618 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6619 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6620 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6621 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6622 | {} |
| 6623 | }; |
| 6624 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6625 | static struct alc_config_preset alc260_presets[] = { |
| 6626 | [ALC260_BASIC] = { |
| 6627 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6628 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6629 | .init_verbs = { alc260_init_verbs }, |
| 6630 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6631 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6632 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Takashi Iwai | 9c4cc0b | 2010-03-15 09:07:52 +0100 | [diff] [blame] | 6633 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6634 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6635 | .channel_mode = alc260_modes, |
| 6636 | .input_mux = &alc260_capture_source, |
| 6637 | }, |
| 6638 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6639 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6640 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6641 | .init_verbs = { alc260_init_verbs, |
| 6642 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6643 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6644 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6645 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6646 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6647 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6648 | .channel_mode = alc260_modes, |
| 6649 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6650 | .unsol_event = alc260_hp_unsol_event, |
| 6651 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6652 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6653 | [ALC260_HP_DC7600] = { |
| 6654 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6655 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6656 | .init_verbs = { alc260_init_verbs, |
| 6657 | alc260_hp_dc7600_verbs }, |
| 6658 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6659 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6660 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6661 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6662 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6663 | .channel_mode = alc260_modes, |
| 6664 | .input_mux = &alc260_capture_source, |
| 6665 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6666 | .init_hook = alc260_hp_3012_automute, |
| 6667 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6668 | [ALC260_HP_3013] = { |
| 6669 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6670 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6671 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6672 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6673 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6674 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6675 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6676 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6677 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6678 | .channel_mode = alc260_modes, |
| 6679 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6680 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6681 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6682 | }, |
| 6683 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6684 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6685 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6686 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6687 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6688 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6689 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6690 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6691 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6692 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6693 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6694 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6695 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6696 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6697 | .init_verbs = { alc260_acer_init_verbs }, |
| 6698 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6699 | .dac_nids = alc260_dac_nids, |
| 6700 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6701 | .adc_nids = alc260_dual_adc_nids, |
| 6702 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6703 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6704 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6705 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6706 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6707 | [ALC260_FAVORIT100] = { |
| 6708 | .mixers = { alc260_favorit100_mixer }, |
| 6709 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6710 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6711 | .dac_nids = alc260_dac_nids, |
| 6712 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6713 | .adc_nids = alc260_dual_adc_nids, |
| 6714 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6715 | .channel_mode = alc260_modes, |
| 6716 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6717 | .input_mux = alc260_favorit100_capture_sources, |
| 6718 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6719 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6720 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6721 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6722 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6723 | .dac_nids = alc260_dac_nids, |
| 6724 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6725 | .adc_nids = alc260_adc_nids, |
| 6726 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6727 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6728 | .channel_mode = alc260_modes, |
| 6729 | .input_mux = &alc260_capture_source, |
| 6730 | }, |
| 6731 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6732 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6733 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6734 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6735 | .dac_nids = alc260_dac_nids, |
| 6736 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6737 | .adc_nids = alc260_adc_nids, |
| 6738 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6739 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6740 | .channel_mode = alc260_modes, |
| 6741 | .input_mux = &alc260_capture_source, |
| 6742 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6743 | .init_hook = alc260_replacer_672v_automute, |
| 6744 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6745 | #ifdef CONFIG_SND_DEBUG |
| 6746 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6747 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6748 | .init_verbs = { alc260_test_init_verbs }, |
| 6749 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6750 | .dac_nids = alc260_test_dac_nids, |
| 6751 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6752 | .adc_nids = alc260_test_adc_nids, |
| 6753 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6754 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6755 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6756 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6757 | }, |
| 6758 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6759 | }; |
| 6760 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6761 | static int patch_alc260(struct hda_codec *codec) |
| 6762 | { |
| 6763 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6764 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6765 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6766 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6767 | if (spec == NULL) |
| 6768 | return -ENOMEM; |
| 6769 | |
| 6770 | codec->spec = spec; |
| 6771 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6772 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6773 | alc260_models, |
| 6774 | alc260_cfg_tbl); |
| 6775 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6776 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6777 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6778 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6779 | } |
| 6780 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6781 | if (board_config == ALC260_AUTO) { |
| 6782 | /* automatic parse from the BIOS config */ |
| 6783 | err = alc260_parse_auto_config(codec); |
| 6784 | if (err < 0) { |
| 6785 | alc_free(codec); |
| 6786 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6787 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6788 | printk(KERN_INFO |
| 6789 | "hda_codec: Cannot set up configuration " |
| 6790 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6791 | board_config = ALC260_BASIC; |
| 6792 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6793 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6794 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6795 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6796 | if (err < 0) { |
| 6797 | alc_free(codec); |
| 6798 | return err; |
| 6799 | } |
| 6800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6801 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6802 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6803 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6804 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6805 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6806 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6807 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6808 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6809 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6810 | if (!spec->adc_nids && spec->input_mux) { |
| 6811 | /* check whether NID 0x04 is valid */ |
| 6812 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6813 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6814 | /* get type */ |
| 6815 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6816 | spec->adc_nids = alc260_adc_nids_alt; |
| 6817 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6818 | } else { |
| 6819 | spec->adc_nids = alc260_adc_nids; |
| 6820 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6821 | } |
| 6822 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6823 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6824 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6825 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6826 | spec->vmaster_nid = 0x08; |
| 6827 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6828 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6829 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6830 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6831 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6832 | if (!spec->loopback.amplist) |
| 6833 | spec->loopback.amplist = alc260_loopbacks; |
| 6834 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6835 | |
| 6836 | return 0; |
| 6837 | } |
| 6838 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6839 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6840 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6841 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6842 | * |
| 6843 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6844 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6845 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6846 | * 6-channel independent captures. |
| 6847 | * |
| 6848 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6849 | * driver yet). |
| 6850 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6851 | #define ALC882_DIGOUT_NID 0x06 |
| 6852 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6853 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6854 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6855 | #define ALC1200_DIGOUT_NID 0x10 |
| 6856 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6857 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6858 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6859 | { 8, NULL } |
| 6860 | }; |
| 6861 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6862 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6863 | static hda_nid_t alc882_dac_nids[4] = { |
| 6864 | /* front, rear, clfe, rear_surr */ |
| 6865 | 0x02, 0x03, 0x04, 0x05 |
| 6866 | }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6867 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6868 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6869 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6870 | #define alc882_adc_nids alc880_adc_nids |
| 6871 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6872 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6873 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6874 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6875 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6876 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6877 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6878 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6879 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6880 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6881 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6882 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6883 | /* input MUX */ |
| 6884 | /* FIXME: should be a matrix-type input source selection */ |
| 6885 | |
| 6886 | static struct hda_input_mux alc882_capture_source = { |
| 6887 | .num_items = 4, |
| 6888 | .items = { |
| 6889 | { "Mic", 0x0 }, |
| 6890 | { "Front Mic", 0x1 }, |
| 6891 | { "Line", 0x2 }, |
| 6892 | { "CD", 0x4 }, |
| 6893 | }, |
| 6894 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6895 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6896 | #define alc883_capture_source alc882_capture_source |
| 6897 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6898 | static struct hda_input_mux alc889_capture_source = { |
| 6899 | .num_items = 3, |
| 6900 | .items = { |
| 6901 | { "Front Mic", 0x0 }, |
| 6902 | { "Mic", 0x3 }, |
| 6903 | { "Line", 0x2 }, |
| 6904 | }, |
| 6905 | }; |
| 6906 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6907 | static struct hda_input_mux mb5_capture_source = { |
| 6908 | .num_items = 3, |
| 6909 | .items = { |
| 6910 | { "Mic", 0x1 }, |
| 6911 | { "Line", 0x2 }, |
| 6912 | { "CD", 0x4 }, |
| 6913 | }, |
| 6914 | }; |
| 6915 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 6916 | static struct hda_input_mux macmini3_capture_source = { |
| 6917 | .num_items = 2, |
| 6918 | .items = { |
| 6919 | { "Line", 0x2 }, |
| 6920 | { "CD", 0x4 }, |
| 6921 | }, |
| 6922 | }; |
| 6923 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6924 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6925 | .num_items = 4, |
| 6926 | .items = { |
| 6927 | { "Mic", 0x1 }, |
| 6928 | { "Front Mic", 0x0 }, |
| 6929 | { "Line", 0x2 }, |
| 6930 | { "CD", 0x4 }, |
| 6931 | }, |
| 6932 | }; |
| 6933 | |
| 6934 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6935 | .num_items = 2, |
| 6936 | .items = { |
| 6937 | { "Mic", 0x1 }, |
| 6938 | { "Line", 0x2 }, |
| 6939 | }, |
| 6940 | }; |
| 6941 | |
| 6942 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6943 | .num_items = 4, |
| 6944 | .items = { |
| 6945 | { "Mic", 0x0 }, |
| 6946 | { "iMic", 0x1 }, |
| 6947 | { "Line", 0x2 }, |
| 6948 | { "CD", 0x4 }, |
| 6949 | }, |
| 6950 | }; |
| 6951 | |
| 6952 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6953 | .num_items = 2, |
| 6954 | .items = { |
| 6955 | { "Mic", 0x0 }, |
| 6956 | { "Int Mic", 0x1 }, |
| 6957 | }, |
| 6958 | }; |
| 6959 | |
| 6960 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6961 | .num_items = 3, |
| 6962 | .items = { |
| 6963 | { "Mic", 0x0 }, |
| 6964 | { "Front Mic", 0x1 }, |
| 6965 | { "Line", 0x4 }, |
| 6966 | }, |
| 6967 | }; |
| 6968 | |
| 6969 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6970 | .num_items = 2, |
| 6971 | .items = { |
| 6972 | { "Mic", 0x0 }, |
| 6973 | { "Line", 0x2 }, |
| 6974 | }, |
| 6975 | }; |
| 6976 | |
| 6977 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6978 | .num_items = 2, |
| 6979 | .items = { |
| 6980 | { "Mic", 0x0 }, |
| 6981 | /* Front Mic (0x01) unused */ |
| 6982 | { "Line", 0x2 }, |
| 6983 | /* Line 2 (0x03) unused */ |
André Goddard Rosa | af901ca | 2009-11-14 13:09:05 -0200 | [diff] [blame] | 6984 | /* CD (0x04) unused? */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6985 | }, |
| 6986 | }; |
| 6987 | |
| 6988 | /* |
| 6989 | * 2ch mode |
| 6990 | */ |
| 6991 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6992 | { 2, NULL } |
| 6993 | }; |
| 6994 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6995 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6996 | * 2ch mode |
| 6997 | */ |
| 6998 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6999 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7000 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7001 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7002 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7003 | { } /* end */ |
| 7004 | }; |
| 7005 | |
| 7006 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7007 | * 4ch mode |
| 7008 | */ |
| 7009 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 7010 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7011 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7012 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7013 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7014 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7015 | { } /* end */ |
| 7016 | }; |
| 7017 | |
| 7018 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7019 | * 6ch mode |
| 7020 | */ |
| 7021 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 7022 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7023 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7024 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7025 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7026 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7027 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7028 | { } /* end */ |
| 7029 | }; |
| 7030 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7031 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7032 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7033 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7034 | { 6, alc882_3ST_ch6_init }, |
| 7035 | }; |
| 7036 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7037 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 7038 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7039 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 7040 | * 2ch mode |
| 7041 | */ |
| 7042 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 7043 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 7044 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7045 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7046 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7047 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7048 | { } /* end */ |
| 7049 | }; |
| 7050 | |
| 7051 | /* |
| 7052 | * 4ch mode |
| 7053 | */ |
| 7054 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 7055 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7056 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7057 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7058 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7059 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7060 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7061 | { } /* end */ |
| 7062 | }; |
| 7063 | |
| 7064 | /* |
| 7065 | * 6ch mode |
| 7066 | */ |
| 7067 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 7068 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7069 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7070 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7071 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7072 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7073 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7074 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7075 | { } /* end */ |
| 7076 | }; |
| 7077 | |
| 7078 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 7079 | { 2, alc883_3ST_ch2_clevo_init }, |
| 7080 | { 4, alc883_3ST_ch4_clevo_init }, |
| 7081 | { 6, alc883_3ST_ch6_clevo_init }, |
| 7082 | }; |
| 7083 | |
| 7084 | |
| 7085 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7086 | * 6ch mode |
| 7087 | */ |
| 7088 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 7089 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7090 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7091 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7092 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7093 | { } /* end */ |
| 7094 | }; |
| 7095 | |
| 7096 | /* |
| 7097 | * 8ch mode |
| 7098 | */ |
| 7099 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 7100 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7101 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7102 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7103 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7104 | { } /* end */ |
| 7105 | }; |
| 7106 | |
| 7107 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 7108 | { 6, alc882_sixstack_ch6_init }, |
| 7109 | { 8, alc882_sixstack_ch8_init }, |
| 7110 | }; |
| 7111 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7112 | |
| 7113 | /* Macbook Air 2,1 */ |
| 7114 | |
| 7115 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { |
| 7116 | { 2, NULL }, |
| 7117 | }; |
| 7118 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7119 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 7120 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7121 | */ |
| 7122 | |
| 7123 | /* |
| 7124 | * 2ch mode |
| 7125 | */ |
| 7126 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 7127 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7128 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7129 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7130 | { } /* end */ |
| 7131 | }; |
| 7132 | |
| 7133 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7134 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7135 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7136 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7137 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7138 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7139 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7140 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7141 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7142 | { } /* end */ |
| 7143 | }; |
| 7144 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7145 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7146 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7147 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7148 | }; |
| 7149 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7150 | /* |
| 7151 | * 2ch |
| 7152 | * Speakers/Woofer/HP = Front |
| 7153 | * LineIn = Input |
| 7154 | */ |
| 7155 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 7156 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7157 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7158 | { } /* end */ |
| 7159 | }; |
| 7160 | |
| 7161 | /* |
| 7162 | * 6ch mode |
| 7163 | * Speakers/HP = Front |
| 7164 | * Woofer = LFE |
| 7165 | * LineIn = Surround |
| 7166 | */ |
| 7167 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 7168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7169 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7170 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7171 | { } /* end */ |
| 7172 | }; |
| 7173 | |
| 7174 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 7175 | { 2, alc885_mb5_ch2_init }, |
| 7176 | { 6, alc885_mb5_ch6_init }, |
| 7177 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7178 | |
Takashi Iwai | d01aecd | 2010-02-23 08:07:15 +0100 | [diff] [blame] | 7179 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7180 | |
| 7181 | /* |
| 7182 | * 2ch mode |
| 7183 | */ |
| 7184 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 7185 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7186 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7187 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7188 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7189 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7190 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7191 | { } /* end */ |
| 7192 | }; |
| 7193 | |
| 7194 | /* |
| 7195 | * 4ch mode |
| 7196 | */ |
| 7197 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 7198 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7199 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7200 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7201 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7202 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7203 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7204 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7205 | { } /* end */ |
| 7206 | }; |
| 7207 | |
| 7208 | /* |
| 7209 | * 6ch mode |
| 7210 | */ |
| 7211 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 7212 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7213 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7214 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7215 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7216 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7217 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7218 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7219 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7220 | { } /* end */ |
| 7221 | }; |
| 7222 | |
| 7223 | /* |
| 7224 | * 8ch mode |
| 7225 | */ |
| 7226 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 7227 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7228 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7229 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7230 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7231 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7232 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7233 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7234 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7235 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7236 | { } /* end */ |
| 7237 | }; |
| 7238 | |
| 7239 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 7240 | { 2, alc883_4ST_ch2_init }, |
| 7241 | { 4, alc883_4ST_ch4_init }, |
| 7242 | { 6, alc883_4ST_ch6_init }, |
| 7243 | { 8, alc883_4ST_ch8_init }, |
| 7244 | }; |
| 7245 | |
| 7246 | |
| 7247 | /* |
| 7248 | * 2ch mode |
| 7249 | */ |
| 7250 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 7251 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7252 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7253 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7254 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7255 | { } /* end */ |
| 7256 | }; |
| 7257 | |
| 7258 | /* |
| 7259 | * 4ch mode |
| 7260 | */ |
| 7261 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 7262 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7263 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7264 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7265 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7266 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7267 | { } /* end */ |
| 7268 | }; |
| 7269 | |
| 7270 | /* |
| 7271 | * 6ch mode |
| 7272 | */ |
| 7273 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 7274 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7275 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7276 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7277 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7278 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7279 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7280 | { } /* end */ |
| 7281 | }; |
| 7282 | |
| 7283 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 7284 | { 2, alc883_3ST_ch2_intel_init }, |
| 7285 | { 4, alc883_3ST_ch4_intel_init }, |
| 7286 | { 6, alc883_3ST_ch6_intel_init }, |
| 7287 | }; |
| 7288 | |
| 7289 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7290 | * 2ch mode |
| 7291 | */ |
| 7292 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 7293 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7294 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7295 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7296 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7299 | { } /* end */ |
| 7300 | }; |
| 7301 | |
| 7302 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7303 | * 6ch mode |
| 7304 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7305 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7306 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7307 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7308 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7309 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7310 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7311 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7312 | { } /* end */ |
| 7313 | }; |
| 7314 | |
| 7315 | /* |
| 7316 | * 8ch mode |
| 7317 | */ |
| 7318 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7319 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 7320 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 7321 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 7322 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 7323 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7324 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7325 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7326 | { } /* end */ |
| 7327 | }; |
| 7328 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 7329 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 7330 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7331 | { 6, alc889_ch6_intel_init }, |
| 7332 | { 8, alc889_ch8_intel_init }, |
| 7333 | }; |
| 7334 | |
| 7335 | /* |
| 7336 | * 6ch mode |
| 7337 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7338 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 7339 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 7340 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7341 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7342 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7343 | { } /* end */ |
| 7344 | }; |
| 7345 | |
| 7346 | /* |
| 7347 | * 8ch mode |
| 7348 | */ |
| 7349 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 7350 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7351 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7352 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7353 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7354 | { } /* end */ |
| 7355 | }; |
| 7356 | |
| 7357 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 7358 | { 6, alc883_sixstack_ch6_init }, |
| 7359 | { 8, alc883_sixstack_ch8_init }, |
| 7360 | }; |
| 7361 | |
| 7362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7363 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 7364 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 7365 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 7366 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7367 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7368 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7369 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7370 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7371 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7372 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7373 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7374 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7375 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 7376 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7377 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7378 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7379 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7380 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7381 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7382 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7383 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7384 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7385 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7386 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7387 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7388 | { } /* end */ |
| 7389 | }; |
| 7390 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7391 | /* Macbook Air 2,1 same control for HP and internal Speaker */ |
| 7392 | |
| 7393 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { |
| 7394 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7395 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), |
| 7396 | { } |
| 7397 | }; |
| 7398 | |
| 7399 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7400 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7401 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7402 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7403 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7404 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7405 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7406 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7407 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7408 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7409 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7410 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7411 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7412 | { } /* end */ |
| 7413 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7414 | |
| 7415 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7416 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7417 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7418 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7419 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7420 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7421 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7422 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7423 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7424 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7425 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7426 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7427 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7428 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7429 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7430 | { } /* end */ |
| 7431 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7432 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7433 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { |
| 7434 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7435 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7436 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7437 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7438 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7439 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7440 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7441 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), |
| 7442 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 7443 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 7444 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7445 | { } /* end */ |
| 7446 | }; |
| 7447 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7448 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { |
| 7449 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7450 | HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7451 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 7452 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7453 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7454 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7455 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7456 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7457 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7458 | { } /* end */ |
| 7459 | }; |
| 7460 | |
| 7461 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7462 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7463 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7464 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7465 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7466 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7467 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7468 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7469 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7470 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7471 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7472 | { } /* end */ |
| 7473 | }; |
| 7474 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7475 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7476 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7477 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7478 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7482 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7485 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7486 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7487 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7488 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7489 | { } /* end */ |
| 7490 | }; |
| 7491 | |
| 7492 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7493 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7494 | */ |
| 7495 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7496 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7497 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7499 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7500 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7501 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7502 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7503 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7504 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7505 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7509 | { } /* end */ |
| 7510 | }; |
| 7511 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7512 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7516 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7517 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7518 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7519 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7521 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7523 | { } /* end */ |
| 7524 | }; |
| 7525 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7526 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7527 | { |
| 7528 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7529 | .name = "Channel Mode", |
| 7530 | .info = alc_ch_mode_info, |
| 7531 | .get = alc_ch_mode_get, |
| 7532 | .put = alc_ch_mode_put, |
| 7533 | }, |
| 7534 | { } /* end */ |
| 7535 | }; |
| 7536 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7537 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7538 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7541 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7542 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7543 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7544 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7547 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7548 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7549 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7550 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7551 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7552 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7553 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7554 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7555 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7556 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7558 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7559 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7560 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7561 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7562 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7563 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7564 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7565 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7566 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7567 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7568 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7570 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7571 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7572 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7573 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7574 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7575 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7576 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7577 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7578 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7579 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7580 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7581 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7582 | |
| 7583 | /* FIXME: use matrix-type input source selection */ |
| 7584 | /* 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] | 7585 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7586 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7587 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7588 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7589 | /* ADC2: mute amp left and right */ |
| 7590 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7591 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7592 | /* ADC3: mute amp left and right */ |
| 7593 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7594 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7595 | |
| 7596 | { } |
| 7597 | }; |
| 7598 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7599 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7600 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7601 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7602 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7603 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7605 | /* ADC1: mute amp left and right */ |
| 7606 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7607 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7608 | { } |
| 7609 | }; |
| 7610 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7611 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7612 | /* change to EAPD mode */ |
| 7613 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7614 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7615 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7616 | }; |
| 7617 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7618 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7619 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7620 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7621 | { } |
| 7622 | }; |
| 7623 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7624 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7625 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7626 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7627 | {} |
| 7628 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7629 | |
| 7630 | static struct hda_verb alc885_init_verbs[] = { |
| 7631 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7632 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7634 | /* Rear mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7635 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7636 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7637 | /* CLFE mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7638 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7639 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7640 | /* Side mixer */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7641 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7642 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7643 | |
| 7644 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7647 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7648 | /* Front Pin: output 0 (0x0c) */ |
| 7649 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7650 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7651 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7652 | /* Rear Pin: output 1 (0x0d) */ |
| 7653 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7654 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7655 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7656 | /* CLFE Pin: output 2 (0x0e) */ |
| 7657 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7658 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7659 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7660 | /* Side Pin: output 3 (0x0f) */ |
| 7661 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7662 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7663 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7664 | /* Mic (rear) pin: input vref at 80% */ |
| 7665 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7666 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7667 | /* Front Mic pin: input vref at 80% */ |
| 7668 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7669 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7670 | /* Line In pin: input */ |
| 7671 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7672 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7673 | |
| 7674 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7675 | /* Input mixer1 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7676 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7677 | /* Input mixer2 */ |
| 7678 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7679 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 7680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7681 | /* ADC2: mute amp left and right */ |
| 7682 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7683 | /* ADC3: mute amp left and right */ |
| 7684 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7685 | |
| 7686 | { } |
| 7687 | }; |
| 7688 | |
| 7689 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7690 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7691 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7692 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7693 | { } |
| 7694 | }; |
| 7695 | |
| 7696 | |
| 7697 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7698 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7699 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7701 | { } |
| 7702 | }; |
| 7703 | |
| 7704 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7705 | #define alc883_init_verbs alc882_base_init_verbs |
| 7706 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7707 | /* Mac Pro test */ |
| 7708 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7709 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7710 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7711 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7712 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7713 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7714 | /* FIXME: this looks suspicious... |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 7715 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7716 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7717 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7718 | { } /* end */ |
| 7719 | }; |
| 7720 | |
| 7721 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7722 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7725 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7726 | /* Front Pin: output 0 (0x0c) */ |
| 7727 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7728 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7729 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7730 | /* Front Mic pin: input vref at 80% */ |
| 7731 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7732 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7733 | /* Speaker: output */ |
| 7734 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7735 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7736 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7737 | /* Headphone output (output 0 - 0x0c) */ |
| 7738 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7739 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7740 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7741 | |
| 7742 | /* FIXME: use matrix-type input source selection */ |
| 7743 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7744 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7745 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7746 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7747 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7749 | /* Input mixer2 */ |
| 7750 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7751 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7752 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7753 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7754 | /* Input mixer3 */ |
| 7755 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7756 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7757 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7758 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7759 | /* ADC1: mute amp left and right */ |
| 7760 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7761 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7762 | /* ADC2: mute amp left and right */ |
| 7763 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7764 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7765 | /* ADC3: mute amp left and right */ |
| 7766 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7767 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7768 | |
| 7769 | { } |
| 7770 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7771 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7772 | /* Macbook 5,1 */ |
| 7773 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7774 | /* DACs */ |
| 7775 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7776 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7777 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7778 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7779 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7780 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7781 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7783 | /* Surround mixer */ |
| 7784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7787 | /* LFE mixer */ |
| 7788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7789 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7790 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7791 | /* HP mixer */ |
| 7792 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7793 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7795 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7796 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7797 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7798 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7799 | /* LFE Pin (0x0e) */ |
| 7800 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7801 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7802 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7803 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7804 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7805 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7806 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 7807 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7808 | /* Front Mic pin: input vref at 80% */ |
| 7809 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7810 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7811 | /* Line In pin */ |
| 7812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7814 | |
| 7815 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7816 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7817 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7818 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7819 | { } |
| 7820 | }; |
| 7821 | |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 7822 | /* Macmini 3,1 */ |
| 7823 | static struct hda_verb alc885_macmini3_init_verbs[] = { |
| 7824 | /* DACs */ |
| 7825 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7826 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7827 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7828 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7829 | /* Front mixer */ |
| 7830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7832 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7833 | /* Surround mixer */ |
| 7834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7835 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7836 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7837 | /* LFE mixer */ |
| 7838 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7840 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7841 | /* HP mixer */ |
| 7842 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7843 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7844 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7845 | /* Front Pin (0x0c) */ |
| 7846 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7848 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7849 | /* LFE Pin (0x0e) */ |
| 7850 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7852 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7853 | /* HP Pin (0x0f) */ |
| 7854 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7855 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7856 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7857 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7858 | /* Line In pin */ |
| 7859 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7861 | |
| 7862 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7863 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7864 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7865 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7866 | { } |
| 7867 | }; |
| 7868 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 7869 | |
| 7870 | static struct hda_verb alc885_mba21_init_verbs[] = { |
| 7871 | /*Internal and HP Speaker Mixer*/ |
| 7872 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7873 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7874 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7875 | /*Internal Speaker Pin (0x0c)*/ |
| 7876 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, |
| 7877 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7878 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7879 | /* HP Pin: output 0 (0x0e) */ |
| 7880 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7881 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7882 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7883 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, |
| 7884 | /* Line in (is hp when jack connected)*/ |
| 7885 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, |
| 7886 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7887 | |
| 7888 | { } |
| 7889 | }; |
| 7890 | |
| 7891 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7892 | /* Macbook Pro rev3 */ |
| 7893 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7894 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7895 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7896 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7898 | /* Rear mixer */ |
| 7899 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7900 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7901 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7902 | /* HP mixer */ |
| 7903 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7904 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7905 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7906 | /* Front Pin: output 0 (0x0c) */ |
| 7907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7908 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7909 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7910 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7911 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7913 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7914 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7915 | /* Mic (rear) pin: input vref at 80% */ |
| 7916 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7917 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7918 | /* Front Mic pin: input vref at 80% */ |
| 7919 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7920 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7921 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7922 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7923 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7924 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7925 | |
| 7926 | /* FIXME: use matrix-type input source selection */ |
| 7927 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7928 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7929 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7930 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7931 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7932 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7933 | /* Input mixer2 */ |
| 7934 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7935 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7936 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7937 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7938 | /* Input mixer3 */ |
| 7939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7940 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7941 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7942 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7943 | /* ADC1: mute amp left and right */ |
| 7944 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7945 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7946 | /* ADC2: mute amp left and right */ |
| 7947 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7948 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7949 | /* ADC3: mute amp left and right */ |
| 7950 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7951 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7952 | |
| 7953 | { } |
| 7954 | }; |
| 7955 | |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 7956 | /* iMac 9,1 */ |
| 7957 | static struct hda_verb alc885_imac91_init_verbs[] = { |
| 7958 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ |
| 7959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7960 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7961 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7962 | /* Rear mixer */ |
| 7963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7964 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7965 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7966 | /* HP Pin: output 0 (0x0c) */ |
| 7967 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7969 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7970 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7971 | /* Internal Speakers: output 0 (0x0d) */ |
| 7972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7974 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7975 | /* Mic (rear) pin: input vref at 80% */ |
| 7976 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7977 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7978 | /* Front Mic pin: input vref at 80% */ |
| 7979 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7980 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7981 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7982 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7983 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7984 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7985 | |
| 7986 | /* FIXME: use matrix-type input source selection */ |
| 7987 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7988 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7989 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7993 | /* Input mixer2 */ |
| 7994 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7998 | /* Input mixer3 */ |
| 7999 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8000 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8003 | /* ADC1: mute amp left and right */ |
| 8004 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8005 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8006 | /* ADC2: mute amp left and right */ |
| 8007 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8009 | /* ADC3: mute amp left and right */ |
| 8010 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8011 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8012 | |
| 8013 | { } |
| 8014 | }; |
| 8015 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8016 | /* iMac 24 mixer. */ |
| 8017 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 8018 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8019 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 8020 | { } /* end */ |
| 8021 | }; |
| 8022 | |
| 8023 | /* iMac 24 init verbs. */ |
| 8024 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 8025 | /* Internal speakers: output 0 (0x0c) */ |
| 8026 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8027 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8028 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8029 | /* Internal speakers: output 0 (0x0c) */ |
| 8030 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8031 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8032 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8033 | /* Headphone: output 0 (0x0c) */ |
| 8034 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8035 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8036 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8037 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8038 | /* Front Mic: input vref at 80% */ |
| 8039 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8040 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8041 | { } |
| 8042 | }; |
| 8043 | |
| 8044 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8045 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8046 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8047 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8048 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8049 | spec->autocfg.hp_pins[0] = 0x14; |
| 8050 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8051 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8052 | } |
| 8053 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8054 | #define alc885_mb5_setup alc885_imac24_setup |
| 8055 | #define alc885_macmini3_setup alc885_imac24_setup |
| 8056 | |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 8057 | /* Macbook Air 2,1 */ |
| 8058 | static void alc885_mba21_setup(struct hda_codec *codec) |
| 8059 | { |
| 8060 | struct alc_spec *spec = codec->spec; |
| 8061 | |
| 8062 | spec->autocfg.hp_pins[0] = 0x14; |
| 8063 | spec->autocfg.speaker_pins[0] = 0x18; |
| 8064 | } |
| 8065 | |
| 8066 | |
| 8067 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8068 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8069 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8070 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 8071 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8072 | spec->autocfg.hp_pins[0] = 0x15; |
| 8073 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8074 | } |
| 8075 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8076 | static void alc885_imac91_setup(struct hda_codec *codec) |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8077 | { |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8078 | struct alc_spec *spec = codec->spec; |
Alex Murray | a76221d | 2010-01-13 23:15:03 +1030 | [diff] [blame] | 8079 | |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 8080 | spec->autocfg.hp_pins[0] = 0x14; |
| 8081 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8082 | spec->autocfg.speaker_pins[1] = 0x1a; |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 8083 | } |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 8084 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8085 | static struct hda_verb alc882_targa_verbs[] = { |
| 8086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8087 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8088 | |
| 8089 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8090 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8091 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8092 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8093 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8094 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8095 | |
| 8096 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8097 | { } /* end */ |
| 8098 | }; |
| 8099 | |
| 8100 | /* toggle speaker-output according to the hp-jack state */ |
| 8101 | static void alc882_targa_automute(struct hda_codec *codec) |
| 8102 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8103 | struct alc_spec *spec = codec->spec; |
| 8104 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8105 | 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] | 8106 | spec->jack_present ? 1 : 3); |
| 8107 | } |
| 8108 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8109 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8110 | { |
| 8111 | struct alc_spec *spec = codec->spec; |
| 8112 | |
| 8113 | spec->autocfg.hp_pins[0] = 0x14; |
| 8114 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8115 | } |
| 8116 | |
| 8117 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8118 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8119 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8120 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8121 | } |
| 8122 | |
| 8123 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 8124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8126 | |
| 8127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8128 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8129 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8130 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8131 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8133 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8134 | |
| 8135 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8136 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8137 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8138 | { } /* end */ |
| 8139 | }; |
| 8140 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8141 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 8142 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8144 | |
| 8145 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8147 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8148 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 8149 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8150 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8151 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 8152 | |
| 8153 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 8154 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 8155 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 8156 | { } /* end */ |
| 8157 | }; |
| 8158 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 8159 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 8160 | { |
| 8161 | unsigned int gpiostate, gpiomask, gpiodir; |
| 8162 | |
| 8163 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 8164 | AC_VERB_GET_GPIO_DATA, 0); |
| 8165 | |
| 8166 | if (!muted) |
| 8167 | gpiostate |= (1 << pin); |
| 8168 | else |
| 8169 | gpiostate &= ~(1 << pin); |
| 8170 | |
| 8171 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 8172 | AC_VERB_GET_GPIO_MASK, 0); |
| 8173 | gpiomask |= (1 << pin); |
| 8174 | |
| 8175 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 8176 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 8177 | gpiodir |= (1 << pin); |
| 8178 | |
| 8179 | |
| 8180 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8181 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 8182 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8183 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 8184 | |
| 8185 | msleep(1); |
| 8186 | |
| 8187 | snd_hda_codec_write(codec, codec->afg, 0, |
| 8188 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 8189 | } |
| 8190 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8191 | /* set up GPIO at initialization */ |
| 8192 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 8193 | { |
| 8194 | alc882_gpio_mute(codec, 0, 0); |
| 8195 | alc882_gpio_mute(codec, 1, 0); |
| 8196 | } |
| 8197 | |
| 8198 | /* set up GPIO and update auto-muting at initialization */ |
| 8199 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 8200 | { |
| 8201 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8202 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 8203 | } |
| 8204 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8205 | /* |
| 8206 | * generic initialization of ADC, input mixers and output mixers |
| 8207 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8208 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8209 | /* |
| 8210 | * Unmute ADC0-2 and set the default input to mic-in |
| 8211 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8212 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8213 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8214 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8215 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8216 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8217 | /* |
| 8218 | * Set up output mixers (0x0c - 0x0f) |
| 8219 | */ |
| 8220 | /* set vol=0 to output mixers */ |
| 8221 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8224 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8225 | /* set up input amps for analog loopback */ |
| 8226 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8227 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8228 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8231 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8233 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8234 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8235 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8236 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8237 | |
| 8238 | /* FIXME: use matrix-type input source selection */ |
| 8239 | /* 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] | 8240 | /* Input mixer2 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8241 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8242 | /* Input mixer3 */ |
Kailang Yang | 88102f3 | 2010-02-04 14:12:58 +0100 | [diff] [blame] | 8243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8244 | { } |
| 8245 | }; |
| 8246 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8247 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 8248 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 8249 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8250 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8251 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8252 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8253 | { } /* end */ |
| 8254 | }; |
| 8255 | |
| 8256 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 8257 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 8258 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 8259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8260 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8262 | { } /* end */ |
| 8263 | }; |
| 8264 | |
| 8265 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 8266 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 8267 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 8268 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 8269 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 8270 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 8271 | { } /* end */ |
| 8272 | }; |
| 8273 | |
| 8274 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 8275 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 8276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 8277 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 8278 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 8279 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 8280 | { } /* end */ |
| 8281 | }; |
| 8282 | |
| 8283 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 8284 | { 2, alc889A_mb31_ch2_init }, |
| 8285 | { 4, alc889A_mb31_ch4_init }, |
| 8286 | { 5, alc889A_mb31_ch5_init }, |
| 8287 | { 6, alc889A_mb31_ch6_init }, |
| 8288 | }; |
| 8289 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8290 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 8291 | /* eanable EAPD on medion laptop */ |
| 8292 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8293 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8294 | { } |
| 8295 | }; |
| 8296 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8297 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8298 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8299 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 8300 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8301 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8302 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8303 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8304 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8305 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8306 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8308 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8309 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8310 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8311 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8312 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8313 | { } /* end */ |
| 8314 | }; |
| 8315 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8316 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8317 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8318 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8319 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8320 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8321 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8322 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8323 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8324 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8325 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8326 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8327 | { } /* end */ |
| 8328 | }; |
| 8329 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8330 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 8331 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8332 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8333 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8334 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8335 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8336 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8337 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8338 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8339 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8340 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8341 | { } /* end */ |
| 8342 | }; |
| 8343 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8344 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 8345 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8346 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8347 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8348 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8349 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8350 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8351 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8352 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8353 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8355 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8356 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8357 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8358 | { } /* end */ |
| 8359 | }; |
| 8360 | |
| 8361 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 8362 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8363 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8364 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8365 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8366 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8367 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8368 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8369 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8371 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8372 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8373 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8374 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8378 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8379 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8380 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8381 | { } /* end */ |
| 8382 | }; |
| 8383 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8384 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 8385 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8386 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8387 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8388 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8389 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8390 | HDA_OUTPUT), |
| 8391 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8392 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8393 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8394 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8395 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8396 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8397 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8398 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8399 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8400 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8401 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8402 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8403 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8404 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8405 | { } /* end */ |
| 8406 | }; |
| 8407 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8408 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 8409 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8410 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8411 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8412 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8413 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 8414 | HDA_OUTPUT), |
| 8415 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8416 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8417 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8418 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8419 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8420 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8421 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8422 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 8424 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 8425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 8426 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8427 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 8428 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8429 | { } /* end */ |
| 8430 | }; |
| 8431 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 8432 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8433 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8434 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8435 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8436 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8437 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8438 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 8439 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8440 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8441 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8442 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8443 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8444 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8445 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8446 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8447 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8448 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8449 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8450 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8451 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8452 | { } /* end */ |
| 8453 | }; |
| 8454 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8455 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8456 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8457 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8458 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8459 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8460 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8461 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 8462 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 8463 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8464 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 8465 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 8466 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8467 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8469 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8471 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8473 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8474 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8475 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8476 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8477 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8478 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8479 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8480 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8481 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8482 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 8484 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8486 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8487 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8488 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8489 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8490 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8491 | |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 8492 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { |
| 8493 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8494 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 8495 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8496 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8497 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8498 | { } /* end */ |
| 8499 | }; |
| 8500 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8501 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 8502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8503 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8504 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8505 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8506 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8510 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8511 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8512 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8513 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 8514 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8515 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8516 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8517 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8518 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8519 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8520 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8521 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8522 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8523 | { } /* end */ |
| 8524 | }; |
| 8525 | |
| 8526 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 8527 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8528 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8529 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8530 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8531 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8533 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8534 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8535 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8536 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8537 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8538 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8539 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8540 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8541 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8542 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8544 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8546 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8548 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8549 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8550 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8551 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8552 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8553 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8554 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8555 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8556 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8557 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8558 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8559 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8561 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8563 | { } /* end */ |
| 8564 | }; |
| 8565 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8566 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8569 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8570 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8571 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8572 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8573 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8574 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8575 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8576 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8577 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8578 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8579 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8580 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8581 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8582 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8583 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8584 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8585 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8586 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8587 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8588 | { } /* end */ |
| 8589 | }; |
| 8590 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8591 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8592 | /* Output mixers */ |
| 8593 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8594 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8595 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8596 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8597 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8598 | HDA_OUTPUT), |
| 8599 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8600 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8601 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8602 | /* Output switches */ |
| 8603 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8604 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8605 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8606 | /* Boost mixers */ |
| 8607 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8608 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8609 | /* Input mixers */ |
| 8610 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8612 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8613 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8614 | { } /* end */ |
| 8615 | }; |
| 8616 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8617 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8619 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8620 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8622 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8623 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8624 | { } /* end */ |
| 8625 | }; |
| 8626 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8627 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8628 | .ops = &snd_hda_bind_vol, |
| 8629 | .values = { |
| 8630 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8631 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8632 | 0 |
| 8633 | }, |
| 8634 | }; |
| 8635 | |
| 8636 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8637 | .ops = &snd_hda_bind_sw, |
| 8638 | .values = { |
| 8639 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8640 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8641 | 0 |
| 8642 | }, |
| 8643 | }; |
| 8644 | |
| 8645 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8646 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8647 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8648 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8649 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8650 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8652 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8653 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8654 | { } /* end */ |
| 8655 | }; |
| 8656 | |
| 8657 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8658 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8659 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8660 | { |
| 8661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8662 | /* .name = "Capture Source", */ |
| 8663 | .name = "Input Source", |
| 8664 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8665 | .info = alc_mux_enum_info, |
| 8666 | .get = alc_mux_enum_get, |
| 8667 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8668 | }, |
| 8669 | { } /* end */ |
| 8670 | }; |
| 8671 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8672 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8673 | { |
| 8674 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8675 | .name = "Channel Mode", |
| 8676 | .info = alc_ch_mode_info, |
| 8677 | .get = alc_ch_mode_get, |
| 8678 | .put = alc_ch_mode_put, |
| 8679 | }, |
| 8680 | { } /* end */ |
| 8681 | }; |
| 8682 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8683 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8684 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8685 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8686 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8687 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8688 | spec->autocfg.hp_pins[0] = 0x15; |
| 8689 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8690 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8691 | } |
| 8692 | |
| 8693 | /* auto-toggle front mic */ |
| 8694 | /* |
| 8695 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8696 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8697 | 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] | 8698 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8699 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8700 | } |
| 8701 | */ |
| 8702 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8703 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8704 | /* HP */ |
| 8705 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8706 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8707 | /* Subwoofer */ |
| 8708 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8709 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8710 | |
| 8711 | /* enable unsolicited event */ |
| 8712 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8713 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8714 | |
| 8715 | { } /* end */ |
| 8716 | }; |
| 8717 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8718 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8719 | /* HP */ |
| 8720 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8721 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8722 | /* Int speaker */ |
| 8723 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8724 | |
| 8725 | /* enable unsolicited event */ |
| 8726 | /* |
| 8727 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8728 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8729 | */ |
| 8730 | |
| 8731 | { } /* end */ |
| 8732 | }; |
| 8733 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8734 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8735 | /* HP */ |
| 8736 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8738 | /* Int speaker */ |
| 8739 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8741 | |
| 8742 | /* enable unsolicited event */ |
| 8743 | {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] | 8744 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8745 | |
| 8746 | { } /* end */ |
| 8747 | }; |
| 8748 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8749 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8750 | /* HP */ |
| 8751 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8752 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8753 | /* Subwoofer */ |
| 8754 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8756 | |
| 8757 | /* enable unsolicited event */ |
| 8758 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8759 | |
| 8760 | { } /* end */ |
| 8761 | }; |
| 8762 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8763 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8766 | |
| 8767 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8768 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8769 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8770 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8771 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8772 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8773 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8774 | /* Connect Mic jack to CLFE */ |
| 8775 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8776 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8777 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8778 | /* Connect Line-in jack to Surround */ |
| 8779 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8780 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8781 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8782 | /* Connect HP out jack to Front */ |
| 8783 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8784 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8785 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8786 | |
| 8787 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8788 | |
| 8789 | { } /* end */ |
| 8790 | }; |
| 8791 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8792 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8793 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8794 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8795 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8796 | { } /* end */ |
| 8797 | }; |
| 8798 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8799 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8800 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8801 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8802 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8803 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8804 | { } /* end */ |
| 8805 | }; |
| 8806 | |
| 8807 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8810 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8811 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8812 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8813 | { } /* end */ |
| 8814 | }; |
| 8815 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8816 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8819 | |
| 8820 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8821 | |
| 8822 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8823 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8824 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8825 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8826 | { } /* end */ |
| 8827 | }; |
| 8828 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8829 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8830 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8831 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8832 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8833 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8834 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8835 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8836 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8837 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8838 | { } /* end */ |
| 8839 | }; |
| 8840 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8841 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8842 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8843 | { } |
| 8844 | }; |
| 8845 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8846 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8847 | /* HP */ |
| 8848 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8849 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8850 | |
| 8851 | /* enable unsolicited event */ |
| 8852 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8853 | |
| 8854 | { } /* end */ |
| 8855 | }; |
| 8856 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8857 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8858 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8859 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8860 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8861 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8862 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8863 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8864 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8865 | } |
| 8866 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8867 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8868 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8869 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8870 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8871 | {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] | 8872 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8873 | }; |
| 8874 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8875 | /* |
| 8876 | * 2ch mode |
| 8877 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8878 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8879 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8880 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8881 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8882 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8883 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8884 | }; |
| 8885 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8886 | /* |
| 8887 | * 4ch mode |
| 8888 | */ |
| 8889 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8890 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8891 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8892 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8893 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8894 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8895 | { } /* end */ |
| 8896 | }; |
| 8897 | |
| 8898 | /* |
| 8899 | * 6ch mode |
| 8900 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8901 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8902 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8903 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8904 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8905 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8906 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8907 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8908 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8909 | }; |
| 8910 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8911 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8912 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8913 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8914 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8915 | }; |
| 8916 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8917 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8918 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8919 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8920 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8921 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8922 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8923 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8924 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8925 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8926 | } |
| 8927 | |
| 8928 | /* toggle RCA according to the front-jack state */ |
| 8929 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8930 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 8931 | unsigned int present = snd_hda_jack_detect(codec, 0x14); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8932 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8933 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8934 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8935 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8936 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8937 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8938 | unsigned int res) |
| 8939 | { |
| 8940 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8941 | alc888_lenovo_ms7195_front_automute(codec); |
| 8942 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8943 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8944 | } |
| 8945 | |
| 8946 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8948 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8949 | |
| 8950 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8951 | |
| 8952 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8953 | { } /* end */ |
| 8954 | }; |
| 8955 | |
| 8956 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8957 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8958 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8959 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8960 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8961 | spec->autocfg.hp_pins[0] = 0x14; |
| 8962 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8963 | } |
| 8964 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8965 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8966 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8967 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8968 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8969 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8970 | { |
| 8971 | unsigned int present; |
| 8972 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 8973 | present = snd_hda_jack_detect(codec, 0x18); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8974 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8975 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8976 | } |
| 8977 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8978 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8979 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8980 | struct alc_spec *spec = codec->spec; |
| 8981 | |
| 8982 | spec->autocfg.hp_pins[0] = 0x15; |
| 8983 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8984 | } |
| 8985 | |
| 8986 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8987 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8988 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8989 | alc883_clevo_m720_mic_automute(codec); |
| 8990 | } |
| 8991 | |
| 8992 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8993 | unsigned int res) |
| 8994 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8995 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8996 | case ALC880_MIC_EVENT: |
| 8997 | alc883_clevo_m720_mic_automute(codec); |
| 8998 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8999 | default: |
| 9000 | alc_automute_amp_unsol_event(codec, res); |
| 9001 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9002 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9003 | } |
| 9004 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9005 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9006 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9007 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9008 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9009 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9010 | spec->autocfg.hp_pins[0] = 0x14; |
| 9011 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9012 | } |
| 9013 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9014 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9015 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9016 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9017 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9018 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9019 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9020 | } |
| 9021 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9022 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 9023 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9024 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9025 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9026 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9027 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9028 | } |
| 9029 | |
| 9030 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 9031 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9032 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9033 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 9034 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9035 | HDA_AMP_MUTE, bits); |
| 9036 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9037 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9038 | } |
| 9039 | |
| 9040 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 9041 | unsigned int res) |
| 9042 | { |
| 9043 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9044 | alc883_lenovo_101e_all_automute(codec); |
| 9045 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 9046 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 9047 | } |
| 9048 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9049 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9050 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9051 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9052 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9053 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9054 | spec->autocfg.hp_pins[0] = 0x14; |
| 9055 | spec->autocfg.speaker_pins[0] = 0x15; |
| 9056 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9057 | } |
| 9058 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9059 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 9060 | /* HP Pin: output 0 (0x0c) */ |
| 9061 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9062 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9063 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9064 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9066 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9067 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9068 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9069 | /* eanable EAPD on medion laptop */ |
| 9070 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9071 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9072 | /* enable unsolicited event */ |
| 9073 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9074 | { } |
| 9075 | }; |
| 9076 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9077 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 9078 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9079 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 9080 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9081 | { } /* end */ |
| 9082 | }; |
| 9083 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9084 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9085 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9086 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9087 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9088 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9089 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9090 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9091 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9092 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9093 | } |
| 9094 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9095 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9096 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9097 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9098 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9099 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9100 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9101 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9102 | spec->autocfg.speaker_pins[2] = 0x16; |
| 9103 | spec->autocfg.speaker_pins[3] = 0x17; |
| 9104 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9105 | } |
| 9106 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9107 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9108 | { |
| 9109 | struct alc_spec *spec = codec->spec; |
| 9110 | |
| 9111 | spec->autocfg.hp_pins[0] = 0x15; |
| 9112 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9113 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9114 | } |
| 9115 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9116 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 9117 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9118 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9119 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9120 | /* enable unsolicited event */ |
| 9121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9122 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 9123 | { } /* end */ |
| 9124 | }; |
| 9125 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9126 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9127 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9128 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9129 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9130 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9131 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9132 | spec->autocfg.speaker_pins[1] = 0x15; |
| 9133 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9134 | spec->ext_mic.pin = 0x18; |
| 9135 | spec->int_mic.pin = 0x19; |
| 9136 | spec->ext_mic.mux_idx = 0; |
| 9137 | spec->int_mic.mux_idx = 1; |
| 9138 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9139 | } |
| 9140 | |
| 9141 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 9142 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9144 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9145 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9146 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9147 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 9148 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 9149 | /* enable unsolicited event */ |
| 9150 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9151 | { } /* end */ |
| 9152 | }; |
| 9153 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9154 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 9155 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9156 | struct alc_spec *spec = codec->spec; |
| 9157 | |
| 9158 | spec->autocfg.hp_pins[0] = 0x14; |
| 9159 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 9160 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9161 | } |
| 9162 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9163 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 9164 | /* Init rear pin (used as headphone output) */ |
| 9165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 9166 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 9167 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9168 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 9169 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 9170 | /* Init line 2 pin (used as headphone out by default) */ |
| 9171 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 9172 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 9173 | { } /* end */ |
| 9174 | }; |
| 9175 | |
| 9176 | /* Mute speakers according to the headphone jack state */ |
| 9177 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 9178 | { |
| 9179 | unsigned int present; |
| 9180 | |
| 9181 | /* Mute only in 2ch or 4ch mode */ |
| 9182 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 9183 | == 0x00) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 9184 | present = snd_hda_jack_detect(codec, 0x15); |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9185 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9186 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9187 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9188 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 9189 | } |
| 9190 | } |
| 9191 | |
| 9192 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9193 | { |
| 9194 | if ((res >> 26) == ALC880_HP_EVENT) |
| 9195 | alc889A_mb31_automute(codec); |
| 9196 | } |
| 9197 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9198 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9199 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9200 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9201 | #endif |
| 9202 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 9203 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9204 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 9205 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 9206 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 9207 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 9208 | |
| 9209 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 9210 | ALC1200_DIGOUT_NID, 0, |
| 9211 | }; |
| 9212 | |
| 9213 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 9214 | ALC883_DIGOUT_NID, 0, |
| 9215 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9216 | |
| 9217 | /* |
| 9218 | * configuration and preset |
| 9219 | */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9220 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 9221 | [ALC882_3ST_DIG] = "3stack-dig", |
| 9222 | [ALC882_6ST_DIG] = "6stack-dig", |
| 9223 | [ALC882_ARIMA] = "arima", |
| 9224 | [ALC882_W2JC] = "w2jc", |
| 9225 | [ALC882_TARGA] = "targa", |
| 9226 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 9227 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 9228 | [ALC885_MACPRO] = "macpro", |
| 9229 | [ALC885_MB5] = "mb5", |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9230 | [ALC885_MACMINI3] = "macmini3", |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9231 | [ALC885_MBA21] = "mba21", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9232 | [ALC885_MBP3] = "mbp3", |
| 9233 | [ALC885_IMAC24] = "imac24", |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9234 | [ALC885_IMAC91] = "imac91", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9235 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9236 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 9237 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9238 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9239 | [ALC883_TARGA_DIG] = "targa-dig", |
| 9240 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9241 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9242 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9243 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9244 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 9245 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9246 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9247 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9248 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9249 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9250 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9251 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9252 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 9253 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9254 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9255 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9256 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9257 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9258 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9259 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9260 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9261 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9262 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9263 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9264 | [ALC889A_INTEL] = "intel-alc889a", |
| 9265 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9266 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9267 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9268 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9269 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9270 | }; |
| 9271 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9272 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 9273 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 9274 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9275 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 9276 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 9277 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9278 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 9279 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 9280 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9281 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 9282 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9283 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
Takashi Iwai | 83dd740 | 2009-11-24 08:57:53 +0100 | [diff] [blame] | 9284 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9285 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 9286 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 9287 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 9288 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9289 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 9290 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 9291 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 9292 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 9293 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9294 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9295 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 9296 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 9297 | /* default Acer -- disabled as it causes more problems. |
| 9298 | * model=auto should work fine now |
| 9299 | */ |
| 9300 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9301 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9302 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9303 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 9304 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9305 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 9306 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 9307 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 9308 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 9309 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9310 | |
| 9311 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 9312 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 9313 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 9314 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9315 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 9316 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 9317 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9318 | 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] | 9319 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9320 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9321 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9322 | |
| 9323 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 9324 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9325 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9326 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9327 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 9328 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9329 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9330 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9331 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 9332 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9333 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 9334 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 9335 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9336 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Takashi Iwai | 2fef62c | 2009-12-18 08:48:42 +0100 | [diff] [blame] | 9337 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9338 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9339 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 9340 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9341 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 9342 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 9343 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 9344 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 9345 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 9346 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9347 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9348 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 9349 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 9350 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9351 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9352 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9353 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 9354 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 9355 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 9356 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 9357 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 9358 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 9359 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 9360 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Anisse Astier | b43f6e5 | 2010-03-10 19:17:46 +0100 | [diff] [blame] | 9361 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9362 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 9363 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9364 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9365 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9366 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 9367 | 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] | 9368 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 9369 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 9370 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9371 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9372 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9373 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 9374 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 9375 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9376 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9377 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9378 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9379 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 9380 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9381 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9382 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 9383 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 9384 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9385 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9386 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9387 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 9388 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 9389 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9390 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 9391 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 9392 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Daniel T Chen | 572c0e3 | 2010-03-14 23:44:03 -0400 | [diff] [blame] | 9393 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9394 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9395 | {} |
| 9396 | }; |
| 9397 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9398 | /* codec SSID table for Intel Mac */ |
| 9399 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 9400 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 9401 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 9402 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 9403 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 9404 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 9405 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 9406 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 9407 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 9408 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 9409 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9410 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9411 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9412 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, |
| 9413 | * so apparently no perfect solution yet |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9414 | */ |
| 9415 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
Daniel T Chen | 46ef6ec | 2009-11-11 14:32:10 -0500 | [diff] [blame] | 9416 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9417 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9418 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9419 | }; |
| 9420 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9421 | static struct alc_config_preset alc882_presets[] = { |
| 9422 | [ALC882_3ST_DIG] = { |
| 9423 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9424 | .init_verbs = { alc882_base_init_verbs, |
| 9425 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9426 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9427 | .dac_nids = alc882_dac_nids, |
| 9428 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9429 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9430 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9431 | .channel_mode = alc882_ch_modes, |
| 9432 | .need_dac_fix = 1, |
| 9433 | .input_mux = &alc882_capture_source, |
| 9434 | }, |
| 9435 | [ALC882_6ST_DIG] = { |
| 9436 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9437 | .init_verbs = { alc882_base_init_verbs, |
| 9438 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9439 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9440 | .dac_nids = alc882_dac_nids, |
| 9441 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9442 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9443 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9444 | .channel_mode = alc882_sixstack_modes, |
| 9445 | .input_mux = &alc882_capture_source, |
| 9446 | }, |
| 9447 | [ALC882_ARIMA] = { |
| 9448 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9449 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9450 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9451 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9452 | .dac_nids = alc882_dac_nids, |
| 9453 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 9454 | .channel_mode = alc882_sixstack_modes, |
| 9455 | .input_mux = &alc882_capture_source, |
| 9456 | }, |
| 9457 | [ALC882_W2JC] = { |
| 9458 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9459 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9460 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9461 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9462 | .dac_nids = alc882_dac_nids, |
| 9463 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9464 | .channel_mode = alc880_threestack_modes, |
| 9465 | .need_dac_fix = 1, |
| 9466 | .input_mux = &alc882_capture_source, |
| 9467 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9468 | }, |
Reimundo Heluani | 76e6f5a | 2010-02-23 01:19:51 -0800 | [diff] [blame] | 9469 | [ALC885_MBA21] = { |
| 9470 | .mixers = { alc885_mba21_mixer }, |
| 9471 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, |
| 9472 | .num_dacs = 2, |
| 9473 | .dac_nids = alc882_dac_nids, |
| 9474 | .channel_mode = alc885_mba21_ch_modes, |
| 9475 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), |
| 9476 | .input_mux = &alc882_capture_source, |
| 9477 | .unsol_event = alc_automute_amp_unsol_event, |
| 9478 | .setup = alc885_mba21_setup, |
| 9479 | .init_hook = alc_automute_amp, |
| 9480 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9481 | [ALC885_MBP3] = { |
| 9482 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 9483 | .init_verbs = { alc885_mbp3_init_verbs, |
| 9484 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9485 | .num_dacs = 2, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9486 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 9487 | .hp_nid = 0x04, |
| 9488 | .channel_mode = alc885_mbp_4ch_modes, |
| 9489 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9490 | .input_mux = &alc882_capture_source, |
| 9491 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9492 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9493 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9494 | .setup = alc885_mbp3_setup, |
| 9495 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9496 | }, |
| 9497 | [ALC885_MB5] = { |
| 9498 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 9499 | .init_verbs = { alc885_mb5_init_verbs, |
| 9500 | alc880_gpio1_init_verbs }, |
| 9501 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9502 | .dac_nids = alc882_dac_nids, |
| 9503 | .channel_mode = alc885_mb5_6ch_modes, |
| 9504 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 9505 | .input_mux = &mb5_capture_source, |
| 9506 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9507 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9508 | .unsol_event = alc_automute_amp_unsol_event, |
| 9509 | .setup = alc885_mb5_setup, |
| 9510 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9511 | }, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9512 | [ALC885_MACMINI3] = { |
| 9513 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, |
| 9514 | .init_verbs = { alc885_macmini3_init_verbs, |
| 9515 | alc880_gpio1_init_verbs }, |
| 9516 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9517 | .dac_nids = alc882_dac_nids, |
| 9518 | .channel_mode = alc885_macmini3_6ch_modes, |
| 9519 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), |
| 9520 | .input_mux = &macmini3_capture_source, |
| 9521 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9522 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9523 | .unsol_event = alc_automute_amp_unsol_event, |
| 9524 | .setup = alc885_macmini3_setup, |
| 9525 | .init_hook = alc_automute_amp, |
Luke Yelavich | e458b1f | 2010-02-12 16:28:29 +1100 | [diff] [blame] | 9526 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9527 | [ALC885_MACPRO] = { |
| 9528 | .mixers = { alc882_macpro_mixer }, |
| 9529 | .init_verbs = { alc882_macpro_init_verbs }, |
| 9530 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9531 | .dac_nids = alc882_dac_nids, |
| 9532 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9533 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9534 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9535 | .channel_mode = alc882_ch_modes, |
| 9536 | .input_mux = &alc882_capture_source, |
| 9537 | .init_hook = alc885_macpro_init_hook, |
| 9538 | }, |
| 9539 | [ALC885_IMAC24] = { |
| 9540 | .mixers = { alc885_imac24_mixer }, |
| 9541 | .init_verbs = { alc885_imac24_init_verbs }, |
| 9542 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9543 | .dac_nids = alc882_dac_nids, |
| 9544 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9545 | .dig_in_nid = ALC882_DIGIN_NID, |
| 9546 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 9547 | .channel_mode = alc882_ch_modes, |
| 9548 | .input_mux = &alc882_capture_source, |
| 9549 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9550 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9551 | .init_hook = alc885_imac24_init_hook, |
| 9552 | }, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9553 | [ALC885_IMAC91] = { |
| 9554 | .mixers = { alc885_imac91_mixer, alc882_chmode_mixer }, |
| 9555 | .init_verbs = { alc885_imac91_init_verbs, |
| 9556 | alc880_gpio1_init_verbs }, |
| 9557 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9558 | .dac_nids = alc882_dac_nids, |
| 9559 | .channel_mode = alc885_mbp_4ch_modes, |
| 9560 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
| 9561 | .input_mux = &alc882_capture_source, |
| 9562 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9563 | .dig_in_nid = ALC882_DIGIN_NID, |
Takashi Iwai | 9d54f08 | 2010-02-22 08:34:40 +0100 | [diff] [blame] | 9564 | .unsol_event = alc_automute_amp_unsol_event, |
| 9565 | .setup = alc885_imac91_setup, |
| 9566 | .init_hook = alc_automute_amp, |
Justin P. Mattock | 4b7e180 | 2009-12-07 15:07:46 -0800 | [diff] [blame] | 9567 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9568 | [ALC882_TARGA] = { |
| 9569 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9570 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 9571 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9572 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9573 | .dac_nids = alc882_dac_nids, |
| 9574 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9575 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9576 | .adc_nids = alc882_adc_nids, |
| 9577 | .capsrc_nids = alc882_capsrc_nids, |
| 9578 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9579 | .channel_mode = alc882_3ST_6ch_modes, |
| 9580 | .need_dac_fix = 1, |
| 9581 | .input_mux = &alc882_capture_source, |
| 9582 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9583 | .setup = alc882_targa_setup, |
| 9584 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9585 | }, |
| 9586 | [ALC882_ASUS_A7J] = { |
| 9587 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9588 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9589 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9590 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9591 | .dac_nids = alc882_dac_nids, |
| 9592 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9593 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9594 | .adc_nids = alc882_adc_nids, |
| 9595 | .capsrc_nids = alc882_capsrc_nids, |
| 9596 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9597 | .channel_mode = alc882_3ST_6ch_modes, |
| 9598 | .need_dac_fix = 1, |
| 9599 | .input_mux = &alc882_capture_source, |
| 9600 | }, |
| 9601 | [ALC882_ASUS_A7M] = { |
| 9602 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9603 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9604 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9605 | alc882_asus_a7m_verbs }, |
| 9606 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9607 | .dac_nids = alc882_dac_nids, |
| 9608 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9609 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9610 | .channel_mode = alc880_threestack_modes, |
| 9611 | .need_dac_fix = 1, |
| 9612 | .input_mux = &alc882_capture_source, |
| 9613 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9614 | [ALC883_3ST_2ch_DIG] = { |
| 9615 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9616 | .init_verbs = { alc883_init_verbs }, |
| 9617 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9618 | .dac_nids = alc883_dac_nids, |
| 9619 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9620 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9621 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9622 | .channel_mode = alc883_3ST_2ch_modes, |
| 9623 | .input_mux = &alc883_capture_source, |
| 9624 | }, |
| 9625 | [ALC883_3ST_6ch_DIG] = { |
| 9626 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9627 | .init_verbs = { alc883_init_verbs }, |
| 9628 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9629 | .dac_nids = alc883_dac_nids, |
| 9630 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9631 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9632 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9633 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9634 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9635 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9636 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9637 | [ALC883_3ST_6ch] = { |
| 9638 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9639 | .init_verbs = { alc883_init_verbs }, |
| 9640 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9641 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9642 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9643 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9644 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9645 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9646 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9647 | [ALC883_3ST_6ch_INTEL] = { |
| 9648 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9649 | .init_verbs = { alc883_init_verbs }, |
| 9650 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9651 | .dac_nids = alc883_dac_nids, |
| 9652 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9653 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9654 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9655 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9656 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9657 | .need_dac_fix = 1, |
| 9658 | .input_mux = &alc883_3stack_6ch_intel, |
| 9659 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9660 | [ALC889A_INTEL] = { |
| 9661 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9662 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9663 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9664 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9665 | .dac_nids = alc883_dac_nids, |
| 9666 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9667 | .adc_nids = alc889_adc_nids, |
| 9668 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9669 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9670 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9671 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9672 | .channel_mode = alc889_8ch_intel_modes, |
| 9673 | .capsrc_nids = alc889_capsrc_nids, |
| 9674 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9675 | .setup = alc889_automute_setup, |
| 9676 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9677 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9678 | .need_dac_fix = 1, |
| 9679 | }, |
| 9680 | [ALC889_INTEL] = { |
| 9681 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9682 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9683 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9684 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9685 | .dac_nids = alc883_dac_nids, |
| 9686 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9687 | .adc_nids = alc889_adc_nids, |
| 9688 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9689 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9690 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9691 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9692 | .channel_mode = alc889_8ch_intel_modes, |
| 9693 | .capsrc_nids = alc889_capsrc_nids, |
| 9694 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9695 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9696 | .init_hook = alc889_intel_init_hook, |
| 9697 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9698 | .need_dac_fix = 1, |
| 9699 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9700 | [ALC883_6ST_DIG] = { |
| 9701 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9702 | .init_verbs = { alc883_init_verbs }, |
| 9703 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9704 | .dac_nids = alc883_dac_nids, |
| 9705 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9706 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9707 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9708 | .channel_mode = alc883_sixstack_modes, |
| 9709 | .input_mux = &alc883_capture_source, |
| 9710 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9711 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9712 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9713 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9714 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9715 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9716 | .dac_nids = alc883_dac_nids, |
| 9717 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9718 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9719 | .channel_mode = alc883_3ST_6ch_modes, |
| 9720 | .need_dac_fix = 1, |
| 9721 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9722 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9723 | .setup = alc882_targa_setup, |
| 9724 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9725 | }, |
| 9726 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9727 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9728 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9729 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9730 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9731 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9732 | .adc_nids = alc883_adc_nids_alt, |
| 9733 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9734 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9735 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9737 | .channel_mode = alc883_3ST_2ch_modes, |
| 9738 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9739 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9740 | .setup = alc882_targa_setup, |
| 9741 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9742 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9743 | [ALC883_TARGA_8ch_DIG] = { |
Takashi Iwai | b99dba3 | 2009-09-17 18:23:00 +0200 | [diff] [blame] | 9744 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, |
| 9745 | alc883_chmode_mixer }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9746 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9747 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9749 | .dac_nids = alc883_dac_nids, |
| 9750 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9751 | .adc_nids = alc883_adc_nids_rev, |
| 9752 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9753 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9754 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9755 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9756 | .channel_mode = alc883_4ST_8ch_modes, |
| 9757 | .need_dac_fix = 1, |
| 9758 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9759 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9760 | .setup = alc882_targa_setup, |
| 9761 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9762 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9763 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9764 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9765 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9766 | * and the headphone jack. Turn this on and rely on the |
| 9767 | * standard mute methods whenever the user wants to turn |
| 9768 | * these outputs off. |
| 9769 | */ |
| 9770 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9771 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9772 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9773 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9774 | .channel_mode = alc883_3ST_2ch_modes, |
| 9775 | .input_mux = &alc883_capture_source, |
| 9776 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9777 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9778 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9779 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9780 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9781 | .dac_nids = alc883_dac_nids, |
| 9782 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9783 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9784 | .channel_mode = alc883_3ST_2ch_modes, |
| 9785 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9786 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9787 | .setup = alc883_acer_aspire_setup, |
| 9788 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9789 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9790 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9791 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9792 | alc883_chmode_mixer }, |
| 9793 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9794 | alc888_acer_aspire_4930g_verbs }, |
| 9795 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9796 | .dac_nids = alc883_dac_nids, |
| 9797 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9798 | .adc_nids = alc883_adc_nids_rev, |
| 9799 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9800 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9801 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9802 | .channel_mode = alc883_3ST_6ch_modes, |
| 9803 | .need_dac_fix = 1, |
Łukasz Wojniłowicz | 973b8cb | 2010-01-24 14:12:37 +0100 | [diff] [blame] | 9804 | .const_channel_count = 6, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9805 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9806 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9807 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9808 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9809 | .setup = alc888_acer_aspire_4930g_setup, |
| 9810 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9811 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9812 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9813 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9814 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9815 | alc888_acer_aspire_6530g_verbs }, |
| 9816 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9817 | .dac_nids = alc883_dac_nids, |
| 9818 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9819 | .adc_nids = alc883_adc_nids_rev, |
| 9820 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9821 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9823 | .channel_mode = alc883_3ST_2ch_modes, |
| 9824 | .num_mux_defs = |
| 9825 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9826 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9827 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9828 | .setup = alc888_acer_aspire_6530g_setup, |
| 9829 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9830 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9831 | [ALC888_ACER_ASPIRE_8930G] = { |
Hector Martin | 556eea9 | 2009-12-20 22:51:23 +0100 | [diff] [blame] | 9832 | .mixers = { alc889_acer_aspire_8930g_mixer, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9833 | alc883_chmode_mixer }, |
| 9834 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 0f86a22 | 2009-12-20 22:51:18 +0100 | [diff] [blame] | 9835 | alc889_acer_aspire_8930g_verbs, |
| 9836 | alc889_eapd_verbs}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9837 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9838 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9839 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9840 | .adc_nids = alc889_adc_nids, |
| 9841 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9842 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9843 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9844 | .channel_mode = alc883_3ST_6ch_modes, |
| 9845 | .need_dac_fix = 1, |
| 9846 | .const_channel_count = 6, |
| 9847 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9848 | ARRAY_SIZE(alc889_capture_sources), |
| 9849 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +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 = alc889_acer_aspire_8930g_setup, |
| 9852 | .init_hook = alc_automute_amp, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9853 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 9854 | .power_hook = alc_power_eapd, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 9855 | #endif |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9856 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9857 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9858 | .mixers = { alc883_3ST_6ch_mixer, |
| 9859 | alc883_chmode_mixer }, |
| 9860 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9861 | alc888_acer_aspire_7730G_verbs }, |
| 9862 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9863 | .dac_nids = alc883_dac_nids, |
| 9864 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9865 | .adc_nids = alc883_adc_nids_rev, |
| 9866 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9867 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9868 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9869 | .channel_mode = alc883_3ST_6ch_modes, |
| 9870 | .need_dac_fix = 1, |
| 9871 | .const_channel_count = 6, |
| 9872 | .input_mux = &alc883_capture_source, |
| 9873 | .unsol_event = alc_automute_amp_unsol_event, |
| 9874 | .setup = alc888_acer_aspire_6530g_setup, |
| 9875 | .init_hook = alc_automute_amp, |
| 9876 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9877 | [ALC883_MEDION] = { |
| 9878 | .mixers = { alc883_fivestack_mixer, |
| 9879 | alc883_chmode_mixer }, |
| 9880 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9881 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9882 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9883 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9884 | .adc_nids = alc883_adc_nids_alt, |
| 9885 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9886 | .capsrc_nids = alc883_capsrc_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9887 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9888 | .channel_mode = alc883_sixstack_modes, |
| 9889 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9890 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9891 | [ALC883_MEDION_MD2] = { |
| 9892 | .mixers = { alc883_medion_md2_mixer}, |
| 9893 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9895 | .dac_nids = alc883_dac_nids, |
| 9896 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9897 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9898 | .channel_mode = alc883_3ST_2ch_modes, |
| 9899 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9900 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9901 | .setup = alc883_medion_md2_setup, |
| 9902 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9903 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9904 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9905 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9906 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9907 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9908 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9909 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9910 | .channel_mode = alc883_3ST_2ch_modes, |
| 9911 | .input_mux = &alc883_capture_source, |
| 9912 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9913 | [ALC883_CLEVO_M540R] = { |
| 9914 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9915 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9916 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9917 | .dac_nids = alc883_dac_nids, |
| 9918 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9919 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9920 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9921 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9922 | .need_dac_fix = 1, |
| 9923 | .input_mux = &alc883_capture_source, |
| 9924 | /* This machine has the hardware HP auto-muting, thus |
| 9925 | * we need no software mute via unsol event |
| 9926 | */ |
| 9927 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9928 | [ALC883_CLEVO_M720] = { |
| 9929 | .mixers = { alc883_clevo_m720_mixer }, |
| 9930 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9931 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9932 | .dac_nids = alc883_dac_nids, |
| 9933 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9934 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9935 | .channel_mode = alc883_3ST_2ch_modes, |
| 9936 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9937 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9938 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9939 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9940 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9941 | [ALC883_LENOVO_101E_2ch] = { |
| 9942 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9943 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9944 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9945 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9946 | .adc_nids = alc883_adc_nids_alt, |
| 9947 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 9948 | .capsrc_nids = alc883_capsrc_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9949 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9950 | .channel_mode = alc883_3ST_2ch_modes, |
| 9951 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9952 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9953 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9954 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9955 | [ALC883_LENOVO_NB0763] = { |
| 9956 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9957 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9958 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9959 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9960 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9961 | .channel_mode = alc883_3ST_2ch_modes, |
| 9962 | .need_dac_fix = 1, |
| 9963 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9964 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9965 | .setup = alc883_medion_md2_setup, |
| 9966 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9967 | }, |
| 9968 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9969 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9970 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9971 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9972 | .dac_nids = alc883_dac_nids, |
| 9973 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9974 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9975 | .channel_mode = alc883_3ST_6ch_modes, |
| 9976 | .need_dac_fix = 1, |
| 9977 | .input_mux = &alc883_capture_source, |
| 9978 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9979 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9980 | }, |
| 9981 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9982 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9983 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9984 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9985 | .dac_nids = alc883_dac_nids, |
| 9986 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9987 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9988 | .channel_mode = alc883_3ST_2ch_modes, |
| 9989 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9990 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9991 | .setup = alc883_haier_w66_setup, |
| 9992 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9993 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9994 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9995 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9996 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9997 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9998 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9999 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 10000 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10001 | .need_dac_fix = 1, |
| 10002 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10003 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10004 | .setup = alc888_3st_hp_setup, |
| 10005 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 10006 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10007 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 10008 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10009 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 10010 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10011 | .dac_nids = alc883_dac_nids, |
| 10012 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10013 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10014 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10015 | .channel_mode = alc883_sixstack_modes, |
| 10016 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10017 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10018 | .setup = alc888_6st_dell_setup, |
| 10019 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 10020 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10021 | [ALC883_MITAC] = { |
| 10022 | .mixers = { alc883_mitac_mixer }, |
| 10023 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 10024 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10025 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10026 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10027 | .channel_mode = alc883_3ST_2ch_modes, |
| 10028 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10029 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10030 | .setup = alc883_mitac_setup, |
| 10031 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 10032 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10033 | [ALC883_FUJITSU_PI2515] = { |
| 10034 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 10035 | .init_verbs = { alc883_init_verbs, |
| 10036 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 10037 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10038 | .dac_nids = alc883_dac_nids, |
| 10039 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10040 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10041 | .channel_mode = alc883_3ST_2ch_modes, |
| 10042 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10043 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10044 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 10045 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 10046 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10047 | [ALC888_FUJITSU_XA3530] = { |
| 10048 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 10049 | .init_verbs = { alc883_init_verbs, |
| 10050 | alc888_fujitsu_xa3530_verbs }, |
| 10051 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10052 | .dac_nids = alc883_dac_nids, |
| 10053 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 10054 | .adc_nids = alc883_adc_nids_rev, |
| 10055 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 10056 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10057 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 10058 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 10059 | .num_mux_defs = |
| 10060 | ARRAY_SIZE(alc888_2_capture_sources), |
| 10061 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10062 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10063 | .setup = alc888_fujitsu_xa3530_setup, |
| 10064 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 10065 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10066 | [ALC888_LENOVO_SKY] = { |
| 10067 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 10068 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 10069 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10070 | .dac_nids = alc883_dac_nids, |
| 10071 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10072 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10073 | .channel_mode = alc883_sixstack_modes, |
| 10074 | .need_dac_fix = 1, |
| 10075 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10076 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10077 | .setup = alc888_lenovo_sky_setup, |
| 10078 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10079 | }, |
| 10080 | [ALC888_ASUS_M90V] = { |
| 10081 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 10082 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 10083 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10084 | .dac_nids = alc883_dac_nids, |
| 10085 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10086 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10087 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 10088 | .channel_mode = alc883_3ST_6ch_modes, |
| 10089 | .need_dac_fix = 1, |
| 10090 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10091 | .unsol_event = alc_sku_unsol_event, |
| 10092 | .setup = alc883_mode2_setup, |
| 10093 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10094 | }, |
| 10095 | [ALC888_ASUS_EEE1601] = { |
| 10096 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 10097 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10098 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 10099 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10100 | .dac_nids = alc883_dac_nids, |
| 10101 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10102 | .dig_in_nid = ALC883_DIGIN_NID, |
| 10103 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10104 | .channel_mode = alc883_3ST_2ch_modes, |
| 10105 | .need_dac_fix = 1, |
| 10106 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10107 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 10108 | .init_hook = alc883_eee1601_inithook, |
| 10109 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10110 | [ALC1200_ASUS_P5Q] = { |
| 10111 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 10112 | .init_verbs = { alc883_init_verbs }, |
| 10113 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10114 | .dac_nids = alc883_dac_nids, |
| 10115 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 10116 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 10117 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 10118 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 10119 | .channel_mode = alc883_sixstack_modes, |
| 10120 | .input_mux = &alc883_capture_source, |
| 10121 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10122 | [ALC889A_MB31] = { |
| 10123 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 10124 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 10125 | alc880_gpio1_init_verbs }, |
| 10126 | .adc_nids = alc883_adc_nids, |
| 10127 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
Takashi Iwai | 035eb0c | 2009-12-17 15:00:26 +0100 | [diff] [blame] | 10128 | .capsrc_nids = alc883_capsrc_nids, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 10129 | .dac_nids = alc883_dac_nids, |
| 10130 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10131 | .channel_mode = alc889A_mb31_6ch_modes, |
| 10132 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 10133 | .input_mux = &alc889A_mb31_capture_source, |
| 10134 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 10135 | .unsol_event = alc889A_mb31_unsol_event, |
| 10136 | .init_hook = alc889A_mb31_automute, |
| 10137 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10138 | [ALC883_SONY_VAIO_TT] = { |
| 10139 | .mixers = { alc883_vaiott_mixer }, |
| 10140 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 10141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 10142 | .dac_nids = alc883_dac_nids, |
| 10143 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 10144 | .channel_mode = alc883_3ST_2ch_modes, |
| 10145 | .input_mux = &alc883_capture_source, |
| 10146 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10147 | .setup = alc883_vaiott_setup, |
| 10148 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 10149 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10150 | }; |
| 10151 | |
| 10152 | |
| 10153 | /* |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10154 | * Pin config fixes |
| 10155 | */ |
| 10156 | enum { |
| 10157 | PINFIX_ABIT_AW9D_MAX |
| 10158 | }; |
| 10159 | |
| 10160 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 10161 | { 0x15, 0x01080104 }, /* side */ |
| 10162 | { 0x16, 0x01011012 }, /* rear */ |
| 10163 | { 0x17, 0x01016011 }, /* clfe */ |
| 10164 | { } |
| 10165 | }; |
| 10166 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10167 | static const struct alc_fixup alc882_fixups[] = { |
| 10168 | [PINFIX_ABIT_AW9D_MAX] = { |
| 10169 | .pins = alc882_abit_aw9d_pinfix |
| 10170 | }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10171 | }; |
| 10172 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10173 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10174 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 10175 | {} |
| 10176 | }; |
| 10177 | |
| 10178 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10179 | * BIOS auto configuration |
| 10180 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10181 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 10182 | const struct auto_pin_cfg *cfg) |
| 10183 | { |
| 10184 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 10185 | } |
| 10186 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10187 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10188 | hda_nid_t nid, int pin_type, |
| 10189 | int dac_idx) |
| 10190 | { |
| 10191 | /* set as output */ |
| 10192 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10193 | int idx; |
| 10194 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10195 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10196 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 10197 | idx = 4; |
Takashi Iwai | 6a4f2cc | 2010-03-25 15:00:15 +0100 | [diff] [blame] | 10198 | else { |
| 10199 | if (spec->multiout.num_dacs >= dac_idx) |
| 10200 | return; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10201 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 6a4f2cc | 2010-03-25 15:00:15 +0100 | [diff] [blame] | 10202 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10203 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 10204 | |
| 10205 | } |
| 10206 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10207 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10208 | { |
| 10209 | struct alc_spec *spec = codec->spec; |
| 10210 | int i; |
| 10211 | |
| 10212 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10213 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 10214 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10215 | if (nid) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10216 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10217 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10218 | } |
| 10219 | } |
| 10220 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10221 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10222 | { |
| 10223 | struct alc_spec *spec = codec->spec; |
| 10224 | hda_nid_t pin; |
| 10225 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10226 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10227 | if (pin) /* connect to front */ |
| 10228 | /* use dac 0 */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10229 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10230 | pin = spec->autocfg.speaker_pins[0]; |
| 10231 | if (pin) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10232 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10233 | } |
| 10234 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10235 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10236 | { |
| 10237 | struct alc_spec *spec = codec->spec; |
| 10238 | int i; |
| 10239 | |
| 10240 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10241 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10242 | if (!nid) |
| 10243 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 10244 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10245 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 10246 | snd_hda_codec_write(codec, nid, 0, |
| 10247 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10248 | AMP_OUT_MUTE); |
| 10249 | } |
| 10250 | } |
| 10251 | |
| 10252 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 10253 | { |
| 10254 | struct alc_spec *spec = codec->spec; |
| 10255 | int c; |
| 10256 | |
| 10257 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 10258 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 10259 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 10260 | unsigned int mux_idx; |
| 10261 | const struct hda_input_mux *imux; |
| 10262 | int conns, mute, idx, item; |
| 10263 | |
| 10264 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 10265 | ARRAY_SIZE(conn_list)); |
| 10266 | if (conns < 0) |
| 10267 | continue; |
| 10268 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 10269 | imux = &spec->input_mux[mux_idx]; |
Takashi Iwai | 5311114 | 2010-03-08 12:13:07 +0100 | [diff] [blame] | 10270 | if (!imux->num_items && mux_idx > 0) |
| 10271 | imux = &spec->input_mux[0]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10272 | for (idx = 0; idx < conns; idx++) { |
| 10273 | /* if the current connection is the selected one, |
| 10274 | * unmute it as default - otherwise mute it |
| 10275 | */ |
| 10276 | mute = AMP_IN_MUTE(idx); |
| 10277 | for (item = 0; item < imux->num_items; item++) { |
| 10278 | if (imux->items[item].index == idx) { |
| 10279 | if (spec->cur_mux[c] == item) |
| 10280 | mute = AMP_IN_UNMUTE(idx); |
| 10281 | break; |
| 10282 | } |
| 10283 | } |
| 10284 | /* check if we have a selector or mixer |
| 10285 | * we could check for the widget type instead, but |
| 10286 | * just check for Amp-In presence (in case of mixer |
| 10287 | * without amp-in there is something wrong, this |
| 10288 | * function shouldn't be used or capsrc nid is wrong) |
| 10289 | */ |
| 10290 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10291 | snd_hda_codec_write(codec, nid, 0, |
| 10292 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10293 | mute); |
| 10294 | else if (mute != AMP_IN_MUTE(idx)) |
| 10295 | snd_hda_codec_write(codec, nid, 0, |
| 10296 | AC_VERB_SET_CONNECT_SEL, |
| 10297 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10298 | } |
| 10299 | } |
| 10300 | } |
| 10301 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10302 | /* add mic boosts if needed */ |
| 10303 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10304 | { |
| 10305 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10306 | int err; |
| 10307 | hda_nid_t nid; |
| 10308 | |
| 10309 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 10310 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10311 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10312 | "Mic Boost", |
| 10313 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10314 | if (err < 0) |
| 10315 | return err; |
| 10316 | } |
| 10317 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 10318 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 10319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10320 | "Front Mic Boost", |
| 10321 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10322 | if (err < 0) |
| 10323 | return err; |
| 10324 | } |
| 10325 | return 0; |
| 10326 | } |
| 10327 | |
| 10328 | /* almost identical with ALC880 parser... */ |
| 10329 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 10330 | { |
| 10331 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10332 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 10333 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10334 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10335 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10336 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10337 | if (err < 0) |
| 10338 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10339 | if (!spec->autocfg.line_outs) |
| 10340 | return 0; /* can't find valid BIOS pin config */ |
| 10341 | |
| 10342 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 10343 | if (err < 0) |
| 10344 | return err; |
| 10345 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10346 | if (err < 0) |
| 10347 | return err; |
| 10348 | err = alc880_auto_create_extra_out(spec, |
| 10349 | spec->autocfg.speaker_pins[0], |
| 10350 | "Speaker"); |
| 10351 | if (err < 0) |
| 10352 | return err; |
| 10353 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 10354 | "Headphone"); |
| 10355 | if (err < 0) |
| 10356 | return err; |
| 10357 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 10358 | if (err < 0) |
| 10359 | return err; |
| 10360 | |
| 10361 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10362 | |
| 10363 | /* check multiple SPDIF-out (for recent codecs) */ |
| 10364 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 10365 | hda_nid_t dig_nid; |
| 10366 | err = snd_hda_get_connections(codec, |
| 10367 | spec->autocfg.dig_out_pins[i], |
| 10368 | &dig_nid, 1); |
| 10369 | if (err < 0) |
| 10370 | continue; |
| 10371 | if (!i) |
| 10372 | spec->multiout.dig_out_nid = dig_nid; |
| 10373 | else { |
| 10374 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10375 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10376 | break; |
Roel Kluin | 71121d9f | 2009-11-10 20:11:55 +0100 | [diff] [blame] | 10377 | spec->slave_dig_outs[i - 1] = dig_nid; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 10378 | } |
| 10379 | } |
| 10380 | if (spec->autocfg.dig_in_pin) |
| 10381 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 10382 | |
| 10383 | if (spec->kctls.list) |
| 10384 | add_mixer(spec, spec->kctls.list); |
| 10385 | |
| 10386 | add_verb(spec, alc883_auto_init_verbs); |
| 10387 | /* if ADC 0x07 is available, initialize it, too */ |
| 10388 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 10389 | add_verb(spec, alc882_adc1_init_verbs); |
| 10390 | |
| 10391 | spec->num_mux_defs = 1; |
| 10392 | spec->input_mux = &spec->private_imux[0]; |
| 10393 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 10394 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10395 | |
| 10396 | err = alc_auto_add_mic_boost(codec); |
| 10397 | if (err < 0) |
| 10398 | return err; |
| 10399 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10400 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10401 | } |
| 10402 | |
| 10403 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10404 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10405 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10406 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10407 | alc882_auto_init_multi_out(codec); |
| 10408 | alc882_auto_init_hp_out(codec); |
| 10409 | alc882_auto_init_analog_input(codec); |
| 10410 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10411 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 10412 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10413 | } |
| 10414 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10415 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10416 | { |
| 10417 | struct alc_spec *spec; |
| 10418 | int err, board_config; |
| 10419 | |
| 10420 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10421 | if (spec == NULL) |
| 10422 | return -ENOMEM; |
| 10423 | |
| 10424 | codec->spec = spec; |
| 10425 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10426 | alc_auto_parse_customize_define(codec); |
| 10427 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10428 | switch (codec->vendor_id) { |
| 10429 | case 0x10ec0882: |
| 10430 | case 0x10ec0885: |
| 10431 | break; |
| 10432 | default: |
| 10433 | /* ALC883 and variants */ |
| 10434 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 10435 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10436 | } |
| 10437 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10438 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 10439 | alc882_models, |
| 10440 | alc882_cfg_tbl); |
| 10441 | |
| 10442 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 10443 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 10444 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 10445 | |
| 10446 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 10447 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10448 | codec->chip_name); |
| 10449 | board_config = ALC882_AUTO; |
| 10450 | } |
| 10451 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 10452 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10453 | |
| 10454 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10455 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10456 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10457 | if (err < 0) { |
| 10458 | alc_free(codec); |
| 10459 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10460 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10461 | printk(KERN_INFO |
| 10462 | "hda_codec: Cannot set up configuration " |
| 10463 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10464 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10465 | } |
| 10466 | } |
| 10467 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 10468 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 10469 | if (err < 0) { |
| 10470 | alc_free(codec); |
| 10471 | return err; |
| 10472 | } |
| 10473 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10474 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 10475 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10476 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10477 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 10478 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 10479 | /* FIXME: setup DAC5 */ |
| 10480 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 10481 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 10482 | |
| 10483 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 10484 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 10485 | |
| 10486 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 10487 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10488 | |
| 10489 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10490 | int i, j; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10491 | spec->num_adc_nids = 0; |
| 10492 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10493 | const struct hda_input_mux *imux = spec->input_mux; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10494 | hda_nid_t cap; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10495 | hda_nid_t items[16]; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10496 | hda_nid_t nid = alc882_adc_nids[i]; |
| 10497 | unsigned int wcap = get_wcaps(codec, nid); |
| 10498 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 10499 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10500 | if (wcap != AC_WID_AUD_IN) |
| 10501 | continue; |
| 10502 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 10503 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 10504 | if (err < 0) |
| 10505 | continue; |
Takashi Iwai | d11f74c | 2009-12-08 12:52:47 +0100 | [diff] [blame] | 10506 | err = snd_hda_get_connections(codec, cap, items, |
| 10507 | ARRAY_SIZE(items)); |
| 10508 | if (err < 0) |
| 10509 | continue; |
| 10510 | for (j = 0; j < imux->num_items; j++) |
| 10511 | if (imux->items[j].index >= err) |
| 10512 | break; |
| 10513 | if (j < imux->num_items) |
| 10514 | continue; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10515 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 10516 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 10517 | } |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10518 | spec->adc_nids = spec->private_adc_nids; |
| 10519 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10520 | } |
| 10521 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 10522 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 10523 | |
| 10524 | if (spec->cdefine.enable_pcbeep) |
| 10525 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10526 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10527 | spec->vmaster_nid = 0x0c; |
| 10528 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10529 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10530 | if (board_config == ALC882_AUTO) |
| 10531 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10532 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10533 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10534 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10535 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10536 | |
| 10537 | return 0; |
| 10538 | } |
| 10539 | |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 10540 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10541 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10542 | * ALC262 support |
| 10543 | */ |
| 10544 | |
| 10545 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 10546 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 10547 | |
| 10548 | #define alc262_dac_nids alc260_dac_nids |
| 10549 | #define alc262_adc_nids alc882_adc_nids |
| 10550 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 10551 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 10552 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10553 | |
| 10554 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 10555 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10556 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10557 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 10558 | /* ADC0 */ |
| 10559 | 0x09 |
| 10560 | }; |
| 10561 | |
| 10562 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 10563 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10564 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 10565 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10566 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10567 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10568 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10569 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10570 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10571 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10572 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10573 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10574 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10575 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10576 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10577 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 10578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10579 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 10580 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10581 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10582 | }; |
| 10583 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10584 | /* update HP, line and mono-out pins according to the master switch */ |
| 10585 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 10586 | { |
| 10587 | struct alc_spec *spec = codec->spec; |
| 10588 | int val = spec->master_sw; |
| 10589 | |
| 10590 | /* HP & line-out */ |
| 10591 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 10592 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10593 | val ? PIN_HP : 0); |
| 10594 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10595 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10596 | val ? PIN_HP : 0); |
| 10597 | /* mono (speaker) depending on the HP jack sense */ |
| 10598 | val = val && !spec->jack_present; |
| 10599 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 10600 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10601 | val ? PIN_OUT : 0); |
| 10602 | } |
| 10603 | |
| 10604 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10605 | { |
| 10606 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10607 | |
| 10608 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10609 | alc262_hp_master_update(codec); |
| 10610 | } |
| 10611 | |
| 10612 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10613 | { |
| 10614 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10615 | return; |
| 10616 | alc262_hp_bpc_automute(codec); |
| 10617 | } |
| 10618 | |
| 10619 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10620 | { |
| 10621 | struct alc_spec *spec = codec->spec; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10622 | |
| 10623 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10624 | alc262_hp_master_update(codec); |
| 10625 | } |
| 10626 | |
| 10627 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10628 | unsigned int res) |
| 10629 | { |
| 10630 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10631 | return; |
| 10632 | alc262_hp_wildwest_automute(codec); |
| 10633 | } |
| 10634 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10635 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10636 | |
| 10637 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10638 | struct snd_ctl_elem_value *ucontrol) |
| 10639 | { |
| 10640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10641 | struct alc_spec *spec = codec->spec; |
| 10642 | int val = !!*ucontrol->value.integer.value; |
| 10643 | |
| 10644 | if (val == spec->master_sw) |
| 10645 | return 0; |
| 10646 | spec->master_sw = val; |
| 10647 | alc262_hp_master_update(codec); |
| 10648 | return 1; |
| 10649 | } |
| 10650 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10651 | #define ALC262_HP_MASTER_SWITCH \ |
| 10652 | { \ |
| 10653 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10654 | .name = "Master Playback Switch", \ |
| 10655 | .info = snd_ctl_boolean_mono_info, \ |
| 10656 | .get = alc262_hp_master_sw_get, \ |
| 10657 | .put = alc262_hp_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10658 | }, \ |
| 10659 | { \ |
| 10660 | .iface = NID_MAPPING, \ |
| 10661 | .name = "Master Playback Switch", \ |
| 10662 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10663 | } |
| 10664 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10665 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10666 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10667 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10669 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10670 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10671 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10672 | HDA_OUTPUT), |
| 10673 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10674 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10675 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10676 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10677 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10678 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10679 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10680 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10681 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10682 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10683 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10684 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10685 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10686 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10687 | { } /* end */ |
| 10688 | }; |
| 10689 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10690 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10691 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10692 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10693 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10694 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10695 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10696 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10697 | HDA_OUTPUT), |
| 10698 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10699 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10700 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10701 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10702 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10703 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10704 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10705 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10706 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10707 | { } /* end */ |
| 10708 | }; |
| 10709 | |
| 10710 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10711 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10712 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10713 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10714 | { } /* end */ |
| 10715 | }; |
| 10716 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10717 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10718 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10719 | { |
| 10720 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10721 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10722 | spec->autocfg.hp_pins[0] = 0x15; |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 10723 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10724 | } |
| 10725 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10726 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10727 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10728 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10729 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10730 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10732 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10733 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10734 | { } /* end */ |
| 10735 | }; |
| 10736 | |
| 10737 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10739 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10740 | |
| 10741 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10742 | { } |
| 10743 | }; |
| 10744 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10745 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10746 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10748 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10749 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10750 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10751 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10752 | { } /* end */ |
| 10753 | }; |
| 10754 | |
| 10755 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10756 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10757 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10758 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10760 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10761 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10765 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10766 | {} |
| 10767 | }; |
| 10768 | |
| 10769 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10770 | .num_items = 1, |
| 10771 | .items = { |
| 10772 | { "Line", 0x1 }, |
| 10773 | }, |
| 10774 | }; |
| 10775 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10776 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10777 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10778 | { |
| 10779 | struct alc_spec *spec = codec->spec; |
| 10780 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10781 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10782 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10783 | unsigned int mute; |
| 10784 | |
| 10785 | /* HP */ |
| 10786 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10787 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10788 | HDA_AMP_MUTE, mute); |
| 10789 | /* mute internal speaker per jack sense */ |
| 10790 | if (spec->jack_present) |
| 10791 | mute = HDA_AMP_MUTE; |
| 10792 | if (line_nid) |
| 10793 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10794 | HDA_AMP_MUTE, mute); |
| 10795 | if (speaker_nid && speaker_nid != line_nid) |
| 10796 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10797 | HDA_AMP_MUTE, mute); |
| 10798 | } |
| 10799 | |
| 10800 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10801 | |
| 10802 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10803 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10804 | { |
| 10805 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10806 | struct alc_spec *spec = codec->spec; |
| 10807 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10808 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10809 | if (val == spec->master_sw) |
| 10810 | return 0; |
| 10811 | spec->master_sw = val; |
| 10812 | alc262_hippo_master_update(codec); |
| 10813 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10814 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10815 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10816 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10817 | { \ |
| 10818 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10819 | .name = "Master Playback Switch", \ |
| 10820 | .info = snd_ctl_boolean_mono_info, \ |
| 10821 | .get = alc262_hippo_master_sw_get, \ |
| 10822 | .put = alc262_hippo_master_sw_put, \ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 10823 | }, \ |
| 10824 | { \ |
| 10825 | .iface = NID_MAPPING, \ |
| 10826 | .name = "Master Playback Switch", \ |
| 10827 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ |
| 10828 | (SUBDEV_SPEAKER(0) << 16), \ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10829 | } |
| 10830 | |
| 10831 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10832 | ALC262_HIPPO_MASTER_SWITCH, |
| 10833 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10834 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10835 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10836 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10837 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10838 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10839 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10841 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10842 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10843 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10844 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10845 | { } /* end */ |
| 10846 | }; |
| 10847 | |
| 10848 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10849 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10850 | ALC262_HIPPO_MASTER_SWITCH, |
| 10851 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10852 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10853 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10854 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10855 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10856 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10857 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10858 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10859 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10860 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10861 | { } /* end */ |
| 10862 | }; |
| 10863 | |
| 10864 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10865 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10866 | { |
| 10867 | struct alc_spec *spec = codec->spec; |
| 10868 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10869 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 10870 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10871 | alc262_hippo_master_update(codec); |
| 10872 | } |
| 10873 | |
| 10874 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10875 | { |
| 10876 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10877 | return; |
| 10878 | alc262_hippo_automute(codec); |
| 10879 | } |
| 10880 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10881 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10882 | { |
| 10883 | struct alc_spec *spec = codec->spec; |
| 10884 | |
| 10885 | spec->autocfg.hp_pins[0] = 0x15; |
| 10886 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10887 | } |
| 10888 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10889 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10890 | { |
| 10891 | struct alc_spec *spec = codec->spec; |
| 10892 | |
| 10893 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10894 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10895 | } |
| 10896 | |
| 10897 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10898 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10899 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10900 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10901 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10902 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10903 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10904 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10905 | { } /* end */ |
| 10906 | }; |
| 10907 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10908 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10909 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10910 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10911 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10914 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10915 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10916 | { } /* end */ |
| 10917 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10918 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10919 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10920 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10921 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10922 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10923 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10928 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10929 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10930 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10931 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10932 | { } /* end */ |
| 10933 | }; |
| 10934 | |
| 10935 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10936 | /* Headphone automute */ |
| 10937 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10940 | |
| 10941 | /* P11 AUX_IN, white 4-pin connector */ |
| 10942 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10943 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10944 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10945 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10946 | |
| 10947 | {} |
| 10948 | }; |
| 10949 | |
| 10950 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10951 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10952 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10953 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10954 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10955 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10956 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10957 | } |
| 10958 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10960 | #define alc262_capture_mixer alc882_capture_mixer |
| 10961 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10962 | |
| 10963 | /* |
| 10964 | * generic initialization of ADC, input mixers and output mixers |
| 10965 | */ |
| 10966 | static struct hda_verb alc262_init_verbs[] = { |
| 10967 | /* |
| 10968 | * Unmute ADC0-2 and set the default input to mic-in |
| 10969 | */ |
| 10970 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10971 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10972 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10973 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10974 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10975 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10976 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10977 | /* 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] | 10978 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10979 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10980 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10981 | */ |
| 10982 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10983 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10988 | |
| 10989 | /* |
| 10990 | * Set up output mixers (0x0c - 0x0e) |
| 10991 | */ |
| 10992 | /* set vol=0 to output mixers */ |
| 10993 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10994 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10995 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10996 | /* set up input amps for analog loopback */ |
| 10997 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10998 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10999 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11000 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11001 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11002 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11004 | |
| 11005 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11006 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11007 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11008 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11009 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11010 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11011 | |
| 11012 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11013 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11014 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11015 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11016 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11017 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11018 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11019 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11021 | /* FIXME: use matrix-type input source selection */ |
| 11022 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11023 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11024 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11025 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11026 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11027 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11028 | /* Input mixer2 */ |
| 11029 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11030 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11033 | /* Input mixer3 */ |
| 11034 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11037 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11038 | |
| 11039 | { } |
| 11040 | }; |
| 11041 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11042 | static struct hda_verb alc262_eapd_verbs[] = { |
| 11043 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11044 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11045 | { } |
| 11046 | }; |
| 11047 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11048 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 11049 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11050 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11051 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 11052 | |
| 11053 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11055 | {} |
| 11056 | }; |
| 11057 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11058 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 11059 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11061 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 11062 | |
| 11063 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11064 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 11065 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11066 | }; |
| 11067 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11068 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 11069 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11070 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11071 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11072 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11073 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11074 | { } /* end */ |
| 11075 | }; |
| 11076 | |
| 11077 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 11078 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11079 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11080 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11081 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11082 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 11083 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11084 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11085 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11086 | {} |
| 11087 | }; |
| 11088 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11089 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11090 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11091 | struct alc_spec *spec = codec->spec; |
| 11092 | |
| 11093 | spec->autocfg.hp_pins[0] = 0x15; |
| 11094 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11095 | spec->ext_mic.pin = 0x18; |
| 11096 | spec->ext_mic.mux_idx = 0; |
| 11097 | spec->int_mic.pin = 0x12; |
| 11098 | spec->int_mic.mux_idx = 9; |
| 11099 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11100 | } |
| 11101 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11102 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11103 | * nec model |
| 11104 | * 0x15 = headphone |
| 11105 | * 0x16 = internal speaker |
| 11106 | * 0x18 = external mic |
| 11107 | */ |
| 11108 | |
| 11109 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 11110 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 11111 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 11112 | |
| 11113 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11114 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11115 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11116 | |
| 11117 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 11118 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11119 | { } /* end */ |
| 11120 | }; |
| 11121 | |
| 11122 | static struct hda_verb alc262_nec_verbs[] = { |
| 11123 | /* Unmute Speaker */ |
| 11124 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11125 | |
| 11126 | /* Headphone */ |
| 11127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11128 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11129 | |
| 11130 | /* External mic to headphone */ |
| 11131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11132 | /* External mic to speaker */ |
| 11133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11134 | {} |
| 11135 | }; |
| 11136 | |
| 11137 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11138 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11139 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 11140 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11141 | */ |
| 11142 | |
| 11143 | #define ALC_HP_EVENT 0x37 |
| 11144 | |
| 11145 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 11146 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11147 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 11148 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11149 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11150 | {} |
| 11151 | }; |
| 11152 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11153 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 11154 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 11155 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11156 | {} |
| 11157 | }; |
| 11158 | |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 11159 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { |
| 11160 | /* Front Mic pin: input vref at 50% */ |
| 11161 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 11162 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11163 | {} |
| 11164 | }; |
| 11165 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11166 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11167 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11168 | .items = { |
| 11169 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11170 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11171 | { "CD", 0x4 }, |
| 11172 | }, |
| 11173 | }; |
| 11174 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11175 | static struct hda_input_mux alc262_HP_capture_source = { |
| 11176 | .num_items = 5, |
| 11177 | .items = { |
| 11178 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11179 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11180 | { "Line", 0x2 }, |
| 11181 | { "CD", 0x4 }, |
| 11182 | { "AUX IN", 0x6 }, |
| 11183 | }, |
| 11184 | }; |
| 11185 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11186 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 11187 | .num_items = 4, |
| 11188 | .items = { |
| 11189 | { "Mic", 0x0 }, |
| 11190 | { "Front Mic", 0x2 }, |
| 11191 | { "Line", 0x1 }, |
| 11192 | { "CD", 0x4 }, |
| 11193 | }, |
| 11194 | }; |
| 11195 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11196 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11197 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 11198 | { |
| 11199 | struct alc_spec *spec = codec->spec; |
| 11200 | unsigned int mute; |
| 11201 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11202 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11203 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || |
| 11204 | snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11205 | spec->sense_updated = 1; |
| 11206 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11207 | /* unmute internal speaker only if both HPs are unplugged and |
| 11208 | * master switch is on |
| 11209 | */ |
| 11210 | if (spec->jack_present) |
| 11211 | mute = HDA_AMP_MUTE; |
| 11212 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11213 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11214 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11215 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11216 | } |
| 11217 | |
| 11218 | /* unsolicited event for HP jack sensing */ |
| 11219 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 11220 | unsigned int res) |
| 11221 | { |
| 11222 | if ((res >> 26) != ALC_HP_EVENT) |
| 11223 | return; |
| 11224 | alc262_fujitsu_automute(codec, 1); |
| 11225 | } |
| 11226 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11227 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 11228 | { |
| 11229 | alc262_fujitsu_automute(codec, 1); |
| 11230 | } |
| 11231 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11232 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11233 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 11234 | .ops = &snd_hda_bind_vol, |
| 11235 | .values = { |
| 11236 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 11237 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 11238 | 0 |
| 11239 | }, |
| 11240 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11241 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11242 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11243 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 11244 | { |
| 11245 | struct alc_spec *spec = codec->spec; |
| 11246 | unsigned int mute; |
| 11247 | |
| 11248 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11249 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11250 | spec->sense_updated = 1; |
| 11251 | } |
| 11252 | if (spec->jack_present) { |
| 11253 | /* mute internal speaker */ |
| 11254 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11255 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11256 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11257 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 11258 | } else { |
| 11259 | /* unmute internal speaker if necessary */ |
| 11260 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 11261 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11262 | HDA_AMP_MUTE, mute); |
| 11263 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 11264 | HDA_AMP_MUTE, mute); |
| 11265 | } |
| 11266 | } |
| 11267 | |
| 11268 | /* unsolicited event for HP jack sensing */ |
| 11269 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 11270 | unsigned int res) |
| 11271 | { |
| 11272 | if ((res >> 26) != ALC_HP_EVENT) |
| 11273 | return; |
| 11274 | alc262_lenovo_3000_automute(codec, 1); |
| 11275 | } |
| 11276 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11277 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 11278 | int dir, int idx, long *valp) |
| 11279 | { |
| 11280 | int i, change = 0; |
| 11281 | |
| 11282 | for (i = 0; i < 2; i++, valp++) |
| 11283 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 11284 | HDA_AMP_MUTE, |
| 11285 | *valp ? 0 : HDA_AMP_MUTE); |
| 11286 | return change; |
| 11287 | } |
| 11288 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11289 | /* bind hp and internal speaker mute (with plug check) */ |
| 11290 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11291 | struct snd_ctl_elem_value *ucontrol) |
| 11292 | { |
| 11293 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11294 | long *valp = ucontrol->value.integer.value; |
| 11295 | int change; |
| 11296 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11297 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 11298 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11299 | if (change) |
| 11300 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11301 | return change; |
| 11302 | } |
| 11303 | |
| 11304 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 11305 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11306 | { |
| 11307 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11308 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11309 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11310 | .info = snd_hda_mixer_amp_switch_info, |
| 11311 | .get = snd_hda_mixer_amp_switch_get, |
| 11312 | .put = alc262_fujitsu_master_sw_put, |
| 11313 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11314 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11315 | { |
| 11316 | .iface = NID_MAPPING, |
| 11317 | .name = "Master Playback Switch", |
| 11318 | .private_value = 0x1b, |
| 11319 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11320 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11321 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11322 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11325 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11326 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11327 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11328 | { } /* end */ |
| 11329 | }; |
| 11330 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11331 | /* bind hp and internal speaker mute (with plug check) */ |
| 11332 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11333 | struct snd_ctl_elem_value *ucontrol) |
| 11334 | { |
| 11335 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11336 | long *valp = ucontrol->value.integer.value; |
| 11337 | int change; |
| 11338 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11339 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11340 | if (change) |
| 11341 | alc262_lenovo_3000_automute(codec, 0); |
| 11342 | return change; |
| 11343 | } |
| 11344 | |
| 11345 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 11346 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 11347 | { |
| 11348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11349 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 11350 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11351 | .info = snd_hda_mixer_amp_switch_info, |
| 11352 | .get = snd_hda_mixer_amp_switch_get, |
| 11353 | .put = alc262_lenovo_3000_master_sw_put, |
| 11354 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 11355 | }, |
| 11356 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11357 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11358 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11359 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11360 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11361 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11362 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11363 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11364 | { } /* end */ |
| 11365 | }; |
| 11366 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11367 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 11368 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11369 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11370 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11371 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11372 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11373 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11374 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11375 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11376 | { } /* end */ |
| 11377 | }; |
| 11378 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11379 | /* additional init verbs for Benq laptops */ |
| 11380 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 11381 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11382 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 11383 | {} |
| 11384 | }; |
| 11385 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11386 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 11387 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11388 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11389 | |
| 11390 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 11391 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 11392 | {} |
| 11393 | }; |
| 11394 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11395 | /* Samsung Q1 Ultra Vista model setup */ |
| 11396 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11397 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 11398 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11399 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 11400 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 11401 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11402 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11403 | { } /* end */ |
| 11404 | }; |
| 11405 | |
| 11406 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11407 | /* output mixer */ |
| 11408 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11409 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11410 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11411 | /* speaker */ |
| 11412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11413 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11414 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11415 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11416 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11417 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11418 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11420 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11421 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11422 | /* internal mic */ |
| 11423 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11424 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11425 | /* ADC, choose mic */ |
| 11426 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11427 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11428 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11429 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11430 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11431 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11432 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11433 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11434 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 11435 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11436 | {} |
| 11437 | }; |
| 11438 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11439 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11440 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 11441 | { |
| 11442 | struct alc_spec *spec = codec->spec; |
| 11443 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11444 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11445 | mute = 0; |
| 11446 | /* auto-mute only when HP is used as HP */ |
| 11447 | if (!spec->cur_mux[0]) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 11448 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11449 | if (spec->jack_present) |
| 11450 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11451 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11452 | /* mute/unmute internal speaker */ |
| 11453 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11454 | HDA_AMP_MUTE, mute); |
| 11455 | /* mute/unmute HP */ |
| 11456 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11457 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11458 | } |
| 11459 | |
| 11460 | /* unsolicited event for HP jack sensing */ |
| 11461 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 11462 | unsigned int res) |
| 11463 | { |
| 11464 | if ((res >> 26) != ALC880_HP_EVENT) |
| 11465 | return; |
| 11466 | alc262_ultra_automute(codec); |
| 11467 | } |
| 11468 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11469 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 11470 | .num_items = 2, |
| 11471 | .items = { |
| 11472 | { "Mic", 0x1 }, |
| 11473 | { "Headphone", 0x7 }, |
| 11474 | }, |
| 11475 | }; |
| 11476 | |
| 11477 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11478 | struct snd_ctl_elem_value *ucontrol) |
| 11479 | { |
| 11480 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11481 | struct alc_spec *spec = codec->spec; |
| 11482 | int ret; |
| 11483 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11484 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11485 | if (!ret) |
| 11486 | return 0; |
| 11487 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 11488 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 11489 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11490 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 11491 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 11492 | return ret; |
| 11493 | } |
| 11494 | |
| 11495 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 11496 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 11497 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 11498 | { |
| 11499 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11500 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11501 | .info = alc_mux_enum_info, |
| 11502 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11503 | .put = alc262_ultra_mux_enum_put, |
| 11504 | }, |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 11505 | { |
| 11506 | .iface = NID_MAPPING, |
| 11507 | .name = "Capture Source", |
| 11508 | .private_value = 0x15, |
| 11509 | }, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11510 | { } /* end */ |
| 11511 | }; |
| 11512 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11513 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 11514 | * and thus it's bound with a different mixer. |
| 11515 | * This function returns which mixer amp should be used. |
| 11516 | */ |
| 11517 | static int alc262_check_volbit(hda_nid_t nid) |
| 11518 | { |
| 11519 | if (!nid) |
| 11520 | return 0; |
| 11521 | else if (nid == 0x16) |
| 11522 | return 2; |
| 11523 | else |
| 11524 | return 1; |
| 11525 | } |
| 11526 | |
| 11527 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11528 | const char *pfx, int *vbits) |
| 11529 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11530 | unsigned long val; |
| 11531 | int vbit; |
| 11532 | |
| 11533 | vbit = alc262_check_volbit(nid); |
| 11534 | if (!vbit) |
| 11535 | return 0; |
| 11536 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 11537 | return 0; |
| 11538 | *vbits |= vbit; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11539 | if (vbit == 2) |
| 11540 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 11541 | else |
| 11542 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11543 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11544 | } |
| 11545 | |
| 11546 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 11547 | const char *pfx) |
| 11548 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11549 | unsigned long val; |
| 11550 | |
| 11551 | if (!nid) |
| 11552 | return 0; |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11553 | if (nid == 0x16) |
| 11554 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 11555 | else |
| 11556 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 11557 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11558 | } |
| 11559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11560 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11561 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11562 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11563 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11564 | const char *pfx; |
| 11565 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11566 | int err; |
| 11567 | |
| 11568 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11569 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11570 | spec->multiout.dac_nids[0] = 2; |
| 11571 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11572 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 11573 | pfx = "Master"; |
| 11574 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11575 | pfx = "Speaker"; |
| 11576 | else |
| 11577 | pfx = "Front"; |
| 11578 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 11579 | if (err < 0) |
| 11580 | return err; |
| 11581 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 11582 | if (err < 0) |
| 11583 | return err; |
| 11584 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 11585 | if (err < 0) |
| 11586 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11587 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 11588 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 11589 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 11590 | alc262_check_volbit(cfg->hp_pins[0]); |
| 11591 | if (vbits == 1 || vbits == 2) |
| 11592 | pfx = "Master"; /* only one mixer is used */ |
| 11593 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 11594 | pfx = "Speaker"; |
| 11595 | else |
| 11596 | pfx = "Front"; |
| 11597 | vbits = 0; |
| 11598 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11599 | if (err < 0) |
| 11600 | return err; |
| 11601 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11602 | &vbits); |
| 11603 | if (err < 0) |
| 11604 | return err; |
| 11605 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11606 | &vbits); |
| 11607 | if (err < 0) |
| 11608 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11609 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11610 | } |
| 11611 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11612 | #define alc262_auto_create_input_ctls \ |
Takashi Iwai | eaa9b3a | 2010-01-17 13:09:33 +0100 | [diff] [blame] | 11613 | alc882_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11614 | |
| 11615 | /* |
| 11616 | * generic initialization of ADC, input mixers and output mixers |
| 11617 | */ |
| 11618 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11619 | /* |
| 11620 | * Unmute ADC0-2 and set the default input to mic-in |
| 11621 | */ |
| 11622 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11623 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11624 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11625 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11626 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11627 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11628 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11629 | /* 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] | 11630 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11631 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11632 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11633 | */ |
| 11634 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11638 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11639 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11640 | |
| 11641 | /* |
| 11642 | * Set up output mixers (0x0c - 0x0f) |
| 11643 | */ |
| 11644 | /* set vol=0 to output mixers */ |
| 11645 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11646 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11647 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11648 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11649 | /* set up input amps for analog loopback */ |
| 11650 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11651 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11652 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11653 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11654 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11655 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11656 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11657 | |
| 11658 | /* FIXME: use matrix-type input source selection */ |
| 11659 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11660 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11661 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11662 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11663 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11665 | /* Input mixer2 */ |
| 11666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11667 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11669 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11670 | /* Input mixer3 */ |
| 11671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11673 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11674 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11675 | |
| 11676 | { } |
| 11677 | }; |
| 11678 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11679 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11680 | /* |
| 11681 | * Unmute ADC0-2 and set the default input to mic-in |
| 11682 | */ |
| 11683 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11685 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11686 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11687 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11688 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11689 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11690 | /* 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] | 11691 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11692 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11693 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11694 | */ |
| 11695 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11696 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11697 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11698 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11699 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11700 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11701 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11702 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11703 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11704 | /* |
| 11705 | * Set up output mixers (0x0c - 0x0e) |
| 11706 | */ |
| 11707 | /* set vol=0 to output mixers */ |
| 11708 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11709 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11710 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11711 | |
| 11712 | /* set up input amps for analog loopback */ |
| 11713 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11714 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11715 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11716 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11717 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11718 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11719 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11720 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11721 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11722 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11723 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11724 | |
| 11725 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11726 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11727 | |
| 11728 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11729 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11730 | |
| 11731 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11732 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11734 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11735 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11736 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11740 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11741 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11742 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11743 | |
| 11744 | |
| 11745 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11746 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11747 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11748 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11749 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11750 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11751 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11752 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11756 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11757 | /* Input mixer2 */ |
| 11758 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11760 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11761 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11762 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11763 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11764 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11765 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11766 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11767 | /* Input mixer3 */ |
| 11768 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11769 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11770 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11771 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11777 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11778 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11780 | { } |
| 11781 | }; |
| 11782 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11783 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11784 | /* |
| 11785 | * Unmute ADC0-2 and set the default input to mic-in |
| 11786 | */ |
| 11787 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11789 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11790 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11791 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11792 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11793 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11794 | /* 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] | 11795 | * mixer widget |
| 11796 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11797 | * panel mic (mic 2) |
| 11798 | */ |
| 11799 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11800 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11802 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11803 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11804 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11808 | /* |
| 11809 | * Set up output mixers (0x0c - 0x0e) |
| 11810 | */ |
| 11811 | /* set vol=0 to output mixers */ |
| 11812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11813 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11815 | |
| 11816 | /* set up input amps for analog loopback */ |
| 11817 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11820 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11822 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11824 | |
| 11825 | |
| 11826 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11827 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11829 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11832 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11833 | |
| 11834 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11836 | |
| 11837 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11839 | |
| 11840 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11841 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11842 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11843 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11844 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11845 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11846 | |
| 11847 | /* FIXME: use matrix-type input source selection */ |
| 11848 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11849 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11850 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11851 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11852 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11854 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11855 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11857 | /* Input mixer2 */ |
| 11858 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11861 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11863 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11864 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11865 | /* Input mixer3 */ |
| 11866 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11867 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11868 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11869 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11870 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11871 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11872 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11873 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11874 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11875 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11876 | { } |
| 11877 | }; |
| 11878 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11879 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11880 | |
| 11881 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11883 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11884 | |
| 11885 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11886 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11887 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11888 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11889 | |
| 11890 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11891 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11892 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11893 | {} |
| 11894 | }; |
| 11895 | |
| 11896 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11897 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11898 | #define alc262_loopbacks alc880_loopbacks |
| 11899 | #endif |
| 11900 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11901 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11902 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11903 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11904 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11905 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11906 | |
| 11907 | /* |
| 11908 | * BIOS auto configuration |
| 11909 | */ |
| 11910 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11911 | { |
| 11912 | struct alc_spec *spec = codec->spec; |
| 11913 | int err; |
| 11914 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11915 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11916 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11917 | alc262_ignore); |
| 11918 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11919 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11920 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11921 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11922 | spec->multiout.max_channels = 2; |
| 11923 | spec->no_analog = 1; |
| 11924 | goto dig_only; |
| 11925 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11926 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11927 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11928 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11929 | if (err < 0) |
| 11930 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11931 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11932 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11933 | return err; |
| 11934 | |
| 11935 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11936 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11937 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11938 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11939 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11940 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11941 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11942 | if (spec->autocfg.dig_in_pin) |
| 11943 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11944 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11945 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11946 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11947 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11948 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11949 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11950 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11951 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11952 | err = alc_auto_add_mic_boost(codec); |
| 11953 | if (err < 0) |
| 11954 | return err; |
| 11955 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 11956 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11958 | return 1; |
| 11959 | } |
| 11960 | |
| 11961 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11962 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11963 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11964 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11965 | |
| 11966 | |
| 11967 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11968 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11969 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11970 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11971 | alc262_auto_init_multi_out(codec); |
| 11972 | alc262_auto_init_hp_out(codec); |
| 11973 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11974 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11975 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11976 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11977 | } |
| 11978 | |
| 11979 | /* |
| 11980 | * configuration and preset |
| 11981 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11982 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11983 | [ALC262_BASIC] = "basic", |
| 11984 | [ALC262_HIPPO] = "hippo", |
| 11985 | [ALC262_HIPPO_1] = "hippo_1", |
| 11986 | [ALC262_FUJITSU] = "fujitsu", |
| 11987 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11988 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11989 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11990 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11991 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11992 | [ALC262_BENQ_T31] = "benq-t31", |
| 11993 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11994 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11995 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11996 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11997 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11998 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11999 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12000 | [ALC262_AUTO] = "auto", |
| 12001 | }; |
| 12002 | |
| 12003 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 12004 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12005 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12006 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 12007 | ALC262_HP_BPC), |
| 12008 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 12009 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 12010 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 12011 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12012 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12013 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12014 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12015 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12016 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12017 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12018 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12019 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12020 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 12021 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 12022 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12023 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 12024 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12025 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12026 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12027 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12028 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 12029 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 12030 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Daniel T Chen | 95491d9 | 2009-11-08 19:03:55 -0500 | [diff] [blame] | 12031 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), |
Takashi Iwai | 12929ba | 2009-11-17 15:58:35 +0100 | [diff] [blame] | 12032 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12033 | #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] | 12034 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 12035 | ALC262_SONY_ASSAMD), |
Takashi Iwai | c5b5165 | 2009-11-17 16:01:58 +0100 | [diff] [blame] | 12036 | #endif |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 12037 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12038 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 12039 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12040 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 12041 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12042 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 12043 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 12044 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 12045 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12046 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12047 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12048 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12049 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12050 | {} |
| 12051 | }; |
| 12052 | |
| 12053 | static struct alc_config_preset alc262_presets[] = { |
| 12054 | [ALC262_BASIC] = { |
| 12055 | .mixers = { alc262_base_mixer }, |
| 12056 | .init_verbs = { alc262_init_verbs }, |
| 12057 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12058 | .dac_nids = alc262_dac_nids, |
| 12059 | .hp_nid = 0x03, |
| 12060 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12061 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 12062 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12063 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12064 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12065 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12066 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12067 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12068 | .dac_nids = alc262_dac_nids, |
| 12069 | .hp_nid = 0x03, |
| 12070 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12071 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12072 | .channel_mode = alc262_modes, |
| 12073 | .input_mux = &alc262_capture_source, |
| 12074 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12075 | .setup = alc262_hippo_setup, |
| 12076 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12077 | }, |
| 12078 | [ALC262_HIPPO_1] = { |
| 12079 | .mixers = { alc262_hippo1_mixer }, |
| 12080 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 12081 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12082 | .dac_nids = alc262_dac_nids, |
| 12083 | .hp_nid = 0x02, |
| 12084 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12085 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12086 | .channel_mode = alc262_modes, |
| 12087 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12088 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12089 | .setup = alc262_hippo1_setup, |
| 12090 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 12091 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12092 | [ALC262_FUJITSU] = { |
| 12093 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 12094 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 12095 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12096 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12097 | .dac_nids = alc262_dac_nids, |
| 12098 | .hp_nid = 0x03, |
| 12099 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12100 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12101 | .channel_mode = alc262_modes, |
| 12102 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12103 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 12104 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 12105 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12106 | [ALC262_HP_BPC] = { |
| 12107 | .mixers = { alc262_HP_BPC_mixer }, |
| 12108 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 12109 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12110 | .dac_nids = alc262_dac_nids, |
| 12111 | .hp_nid = 0x03, |
| 12112 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12113 | .channel_mode = alc262_modes, |
| 12114 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12115 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 12116 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12117 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12118 | [ALC262_HP_BPC_D7000_WF] = { |
| 12119 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 12120 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12121 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12122 | .dac_nids = alc262_dac_nids, |
| 12123 | .hp_nid = 0x03, |
| 12124 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12125 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12126 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12127 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12128 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12129 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12130 | [ALC262_HP_BPC_D7000_WL] = { |
| 12131 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 12132 | alc262_HP_BPC_WildWest_option_mixer }, |
| 12133 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 12134 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12135 | .dac_nids = alc262_dac_nids, |
| 12136 | .hp_nid = 0x03, |
| 12137 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12138 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 12139 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 12140 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 12141 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12142 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12143 | [ALC262_HP_TC_T5735] = { |
| 12144 | .mixers = { alc262_hp_t5735_mixer }, |
| 12145 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 12146 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12147 | .dac_nids = alc262_dac_nids, |
| 12148 | .hp_nid = 0x03, |
| 12149 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12150 | .channel_mode = alc262_modes, |
| 12151 | .input_mux = &alc262_capture_source, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12152 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12153 | .setup = alc262_hp_t5735_setup, |
Takashi Iwai | dc99be4 | 2010-01-20 08:35:06 +0100 | [diff] [blame] | 12154 | .init_hook = alc_inithook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12155 | }, |
| 12156 | [ALC262_HP_RP5700] = { |
| 12157 | .mixers = { alc262_hp_rp5700_mixer }, |
| 12158 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 12159 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12160 | .dac_nids = alc262_dac_nids, |
| 12161 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12162 | .channel_mode = alc262_modes, |
| 12163 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 12164 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 12165 | [ALC262_BENQ_ED8] = { |
| 12166 | .mixers = { alc262_base_mixer }, |
| 12167 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 12168 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12169 | .dac_nids = alc262_dac_nids, |
| 12170 | .hp_nid = 0x03, |
| 12171 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12172 | .channel_mode = alc262_modes, |
| 12173 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12174 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12175 | [ALC262_SONY_ASSAMD] = { |
| 12176 | .mixers = { alc262_sony_mixer }, |
| 12177 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 12178 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12179 | .dac_nids = alc262_dac_nids, |
| 12180 | .hp_nid = 0x02, |
| 12181 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12182 | .channel_mode = alc262_modes, |
| 12183 | .input_mux = &alc262_capture_source, |
| 12184 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12185 | .setup = alc262_hippo_setup, |
| 12186 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12187 | }, |
| 12188 | [ALC262_BENQ_T31] = { |
| 12189 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 12190 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 12191 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12192 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12193 | .dac_nids = alc262_dac_nids, |
| 12194 | .hp_nid = 0x03, |
| 12195 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12196 | .channel_mode = alc262_modes, |
| 12197 | .input_mux = &alc262_capture_source, |
| 12198 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12199 | .setup = alc262_hippo_setup, |
| 12200 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12201 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12202 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 12203 | .mixers = { alc262_ultra_mixer }, |
| 12204 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12205 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12206 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12207 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12208 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12209 | .channel_mode = alc262_modes, |
| 12210 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 12211 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 12212 | .capsrc_nids = alc262_capsrc_nids, |
| 12213 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 12214 | .unsol_event = alc262_ultra_unsol_event, |
| 12215 | .init_hook = alc262_ultra_automute, |
| 12216 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12217 | [ALC262_LENOVO_3000] = { |
| 12218 | .mixers = { alc262_lenovo_3000_mixer }, |
| 12219 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
Daniel T Chen | e259532 | 2009-12-19 18:19:02 -0500 | [diff] [blame] | 12220 | alc262_lenovo_3000_unsol_verbs, |
| 12221 | alc262_lenovo_3000_init_verbs }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 12222 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12223 | .dac_nids = alc262_dac_nids, |
| 12224 | .hp_nid = 0x03, |
| 12225 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12226 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12227 | .channel_mode = alc262_modes, |
| 12228 | .input_mux = &alc262_fujitsu_capture_source, |
| 12229 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 12230 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 12231 | [ALC262_NEC] = { |
| 12232 | .mixers = { alc262_nec_mixer }, |
| 12233 | .init_verbs = { alc262_nec_verbs }, |
| 12234 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12235 | .dac_nids = alc262_dac_nids, |
| 12236 | .hp_nid = 0x03, |
| 12237 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12238 | .channel_mode = alc262_modes, |
| 12239 | .input_mux = &alc262_capture_source, |
| 12240 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12241 | [ALC262_TOSHIBA_S06] = { |
| 12242 | .mixers = { alc262_toshiba_s06_mixer }, |
| 12243 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 12244 | alc262_eapd_verbs }, |
| 12245 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12246 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 12247 | .dac_nids = alc262_dac_nids, |
| 12248 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 12249 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12250 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12251 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12252 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12253 | .unsol_event = alc_sku_unsol_event, |
| 12254 | .setup = alc262_toshiba_s06_setup, |
| 12255 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 12256 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12257 | [ALC262_TOSHIBA_RX1] = { |
| 12258 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 12259 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 12260 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12261 | .dac_nids = alc262_dac_nids, |
| 12262 | .hp_nid = 0x03, |
| 12263 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12264 | .channel_mode = alc262_modes, |
| 12265 | .input_mux = &alc262_capture_source, |
| 12266 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12267 | .setup = alc262_hippo_setup, |
| 12268 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 12269 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12270 | [ALC262_TYAN] = { |
| 12271 | .mixers = { alc262_tyan_mixer }, |
| 12272 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 12273 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 12274 | .dac_nids = alc262_dac_nids, |
| 12275 | .hp_nid = 0x02, |
| 12276 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 12277 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 12278 | .channel_mode = alc262_modes, |
| 12279 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12280 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12281 | .setup = alc262_tyan_setup, |
| 12282 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 12283 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12284 | }; |
| 12285 | |
| 12286 | static int patch_alc262(struct hda_codec *codec) |
| 12287 | { |
| 12288 | struct alc_spec *spec; |
| 12289 | int board_config; |
| 12290 | int err; |
| 12291 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12292 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12293 | if (spec == NULL) |
| 12294 | return -ENOMEM; |
| 12295 | |
| 12296 | codec->spec = spec; |
| 12297 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12298 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 12299 | * under-run |
| 12300 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12301 | { |
| 12302 | int tmp; |
| 12303 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12304 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 12305 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 12306 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 12307 | } |
| 12308 | #endif |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12309 | alc_auto_parse_customize_define(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12310 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 12311 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 12312 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12313 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 12314 | alc262_models, |
| 12315 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 12316 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12317 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12318 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12319 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12320 | board_config = ALC262_AUTO; |
| 12321 | } |
| 12322 | |
| 12323 | if (board_config == ALC262_AUTO) { |
| 12324 | /* automatic parse from the BIOS config */ |
| 12325 | err = alc262_parse_auto_config(codec); |
| 12326 | if (err < 0) { |
| 12327 | alc_free(codec); |
| 12328 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12329 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12330 | printk(KERN_INFO |
| 12331 | "hda_codec: Cannot set up configuration " |
| 12332 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12333 | board_config = ALC262_BASIC; |
| 12334 | } |
| 12335 | } |
| 12336 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12337 | if (!spec->no_analog) { |
| 12338 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12339 | if (err < 0) { |
| 12340 | alc_free(codec); |
| 12341 | return err; |
| 12342 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 12343 | } |
| 12344 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12345 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12346 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12347 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12348 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 12349 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12350 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12351 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 12352 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 12353 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12354 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12355 | int i; |
| 12356 | /* check whether the digital-mic has to be supported */ |
| 12357 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 12358 | if (spec->input_mux->items[i].index >= 9) |
| 12359 | break; |
| 12360 | } |
| 12361 | if (i < spec->input_mux->num_items) { |
| 12362 | /* use only ADC0 */ |
| 12363 | spec->adc_nids = alc262_dmic_adc_nids; |
| 12364 | spec->num_adc_nids = 1; |
| 12365 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12366 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12367 | /* all analog inputs */ |
| 12368 | /* check whether NID 0x07 is valid */ |
| 12369 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12370 | |
| 12371 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12372 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 12373 | if (wcap != AC_WID_AUD_IN) { |
| 12374 | spec->adc_nids = alc262_adc_nids_alt; |
| 12375 | spec->num_adc_nids = |
| 12376 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 12377 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 12378 | } else { |
| 12379 | spec->adc_nids = alc262_adc_nids; |
| 12380 | spec->num_adc_nids = |
| 12381 | ARRAY_SIZE(alc262_adc_nids); |
| 12382 | spec->capsrc_nids = alc262_capsrc_nids; |
| 12383 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12384 | } |
| 12385 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 12386 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 12387 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 12388 | if (!spec->no_analog && spec->cdefine.enable_pcbeep) |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 12389 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12390 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12391 | spec->vmaster_nid = 0x0c; |
| 12392 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12393 | codec->patch_ops = alc_patch_ops; |
| 12394 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12395 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12396 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12397 | if (!spec->loopback.amplist) |
| 12398 | spec->loopback.amplist = alc262_loopbacks; |
| 12399 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12400 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12401 | return 0; |
| 12402 | } |
| 12403 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12404 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12405 | * ALC268 channel source setting (2 channel) |
| 12406 | */ |
| 12407 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 12408 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12409 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12410 | static hda_nid_t alc268_dac_nids[2] = { |
| 12411 | /* front, hp */ |
| 12412 | 0x02, 0x03 |
| 12413 | }; |
| 12414 | |
| 12415 | static hda_nid_t alc268_adc_nids[2] = { |
| 12416 | /* ADC0-1 */ |
| 12417 | 0x08, 0x07 |
| 12418 | }; |
| 12419 | |
| 12420 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 12421 | /* ADC0 */ |
| 12422 | 0x08 |
| 12423 | }; |
| 12424 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12425 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 12426 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12427 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 12428 | /* output mixer control */ |
| 12429 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12430 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12431 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12433 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12434 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12435 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12436 | { } |
| 12437 | }; |
| 12438 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12439 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 12440 | /* output mixer control */ |
| 12441 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12442 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12443 | ALC262_HIPPO_MASTER_SWITCH, |
| 12444 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12445 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12446 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12447 | { } |
| 12448 | }; |
| 12449 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12450 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 12451 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 12452 | .ops = &snd_hda_bind_sw, |
| 12453 | .values = { |
| 12454 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 12455 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 12456 | 0 |
| 12457 | }, |
| 12458 | }; |
| 12459 | |
| 12460 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 12461 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 12462 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 12463 | { } |
| 12464 | }; |
| 12465 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12466 | static struct hda_verb alc268_eapd_verbs[] = { |
| 12467 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12468 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12469 | { } |
| 12470 | }; |
| 12471 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12472 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12473 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 12474 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12475 | { } /* end */ |
| 12476 | }; |
| 12477 | |
| 12478 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12479 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 12480 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 12481 | .ops = &snd_hda_bind_vol, |
| 12482 | .values = { |
| 12483 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 12484 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 12485 | 0 |
| 12486 | }, |
| 12487 | }; |
| 12488 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12489 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 12490 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 12491 | { |
| 12492 | struct alc_spec *spec = codec->spec; |
| 12493 | unsigned int mute; |
| 12494 | |
| 12495 | if (force || !spec->sense_updated) { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12496 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12497 | spec->sense_updated = 1; |
| 12498 | } |
| 12499 | if (spec->jack_present) |
| 12500 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 12501 | else /* unmute internal speaker if necessary */ |
| 12502 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 12503 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12504 | HDA_AMP_MUTE, mute); |
| 12505 | } |
| 12506 | |
| 12507 | |
| 12508 | /* bind hp and internal speaker mute (with plug check) */ |
| 12509 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 12510 | struct snd_ctl_elem_value *ucontrol) |
| 12511 | { |
| 12512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12513 | long *valp = ucontrol->value.integer.value; |
| 12514 | int change; |
| 12515 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 12516 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12517 | if (change) |
| 12518 | alc268_acer_automute(codec, 0); |
| 12519 | return change; |
| 12520 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12521 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12522 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 12523 | /* output mixer control */ |
| 12524 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12525 | { |
| 12526 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12527 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12528 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12529 | .info = snd_hda_mixer_amp_switch_info, |
| 12530 | .get = snd_hda_mixer_amp_switch_get, |
| 12531 | .put = alc268_acer_master_sw_put, |
| 12532 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12533 | }, |
| 12534 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 12535 | { } |
| 12536 | }; |
| 12537 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12538 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 12539 | /* output mixer control */ |
| 12540 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12541 | { |
| 12542 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12543 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12544 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12545 | .info = snd_hda_mixer_amp_switch_info, |
| 12546 | .get = snd_hda_mixer_amp_switch_get, |
| 12547 | .put = alc268_acer_master_sw_put, |
| 12548 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12549 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 12550 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12551 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12552 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12553 | { } |
| 12554 | }; |
| 12555 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12556 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 12557 | /* output mixer control */ |
| 12558 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12559 | { |
| 12560 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12561 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 12562 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12563 | .info = snd_hda_mixer_amp_switch_info, |
| 12564 | .get = snd_hda_mixer_amp_switch_get, |
| 12565 | .put = alc268_acer_master_sw_put, |
| 12566 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12567 | }, |
| 12568 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12569 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 12570 | { } |
| 12571 | }; |
| 12572 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12573 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 12574 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12576 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12577 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12578 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 12579 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 12580 | { } |
| 12581 | }; |
| 12582 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12583 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12584 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 12585 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12586 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12587 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12590 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12591 | { } |
| 12592 | }; |
| 12593 | |
| 12594 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12595 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12596 | #define alc268_toshiba_setup alc262_hippo_setup |
| 12597 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12598 | |
| 12599 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 12600 | unsigned int res) |
| 12601 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12602 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12603 | return; |
| 12604 | alc268_acer_automute(codec, 1); |
| 12605 | } |
| 12606 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12607 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12608 | { |
| 12609 | alc268_acer_automute(codec, 1); |
| 12610 | } |
| 12611 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12612 | /* toggle speaker-output according to the hp-jack state */ |
| 12613 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12614 | { |
| 12615 | unsigned int present; |
| 12616 | unsigned char bits; |
| 12617 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 12618 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12619 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12620 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12621 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12622 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 12623 | HDA_AMP_MUTE, bits); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12624 | } |
| 12625 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12626 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12627 | unsigned int res) |
| 12628 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12629 | switch (res >> 26) { |
| 12630 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12631 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12632 | break; |
| 12633 | case ALC880_MIC_EVENT: |
| 12634 | alc_mic_automute(codec); |
| 12635 | break; |
| 12636 | } |
| 12637 | } |
| 12638 | |
| 12639 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12640 | { |
| 12641 | struct alc_spec *spec = codec->spec; |
| 12642 | spec->ext_mic.pin = 0x18; |
| 12643 | spec->ext_mic.mux_idx = 0; |
| 12644 | spec->int_mic.pin = 0x12; |
| 12645 | spec->int_mic.mux_idx = 6; |
| 12646 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12647 | } |
| 12648 | |
| 12649 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12650 | { |
| 12651 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12652 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12653 | } |
| 12654 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12655 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12656 | /* output mixer control */ |
| 12657 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12658 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12659 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12660 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12661 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12662 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12663 | { } |
| 12664 | }; |
| 12665 | |
| 12666 | static struct hda_verb alc268_dell_verbs[] = { |
| 12667 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12669 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12670 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12671 | { } |
| 12672 | }; |
| 12673 | |
| 12674 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12675 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12676 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12677 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12678 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12679 | spec->autocfg.hp_pins[0] = 0x15; |
| 12680 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12681 | spec->ext_mic.pin = 0x18; |
| 12682 | spec->ext_mic.mux_idx = 0; |
| 12683 | spec->int_mic.pin = 0x19; |
| 12684 | spec->int_mic.mux_idx = 1; |
| 12685 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12686 | } |
| 12687 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12688 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12689 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12690 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12691 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12693 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12694 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12695 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12696 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12697 | { } |
| 12698 | }; |
| 12699 | |
| 12700 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12701 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12702 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12703 | { } |
| 12704 | }; |
| 12705 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12706 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12707 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12708 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12709 | spec->autocfg.hp_pins[0] = 0x15; |
| 12710 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12711 | spec->ext_mic.pin = 0x18; |
| 12712 | spec->ext_mic.mux_idx = 0; |
| 12713 | spec->int_mic.pin = 0x19; |
| 12714 | spec->int_mic.mux_idx = 1; |
| 12715 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12716 | } |
| 12717 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12718 | /* |
| 12719 | * generic initialization of ADC, input mixers and output mixers |
| 12720 | */ |
| 12721 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12722 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12723 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12724 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12725 | |
| 12726 | /* |
| 12727 | * Set up output mixers (0x0c - 0x0e) |
| 12728 | */ |
| 12729 | /* set vol=0 to output mixers */ |
| 12730 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12731 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12732 | |
| 12733 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12734 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12735 | |
| 12736 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12738 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12739 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12740 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12741 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12742 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12743 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12744 | |
| 12745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12747 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12749 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12750 | |
| 12751 | /* set PCBEEP vol = 0, mute connections */ |
| 12752 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12753 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12754 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12755 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12756 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12757 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12758 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12759 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12760 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12761 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12762 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12763 | { } |
| 12764 | }; |
| 12765 | |
| 12766 | /* |
| 12767 | * generic initialization of ADC, input mixers and output mixers |
| 12768 | */ |
| 12769 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12770 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12771 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12772 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12773 | |
| 12774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12775 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12777 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12778 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12779 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12782 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12783 | |
| 12784 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12786 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12787 | /* set PCBEEP vol = 0, mute connections */ |
| 12788 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12789 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12790 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12791 | |
| 12792 | { } |
| 12793 | }; |
| 12794 | |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12795 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12796 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12797 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12798 | { } /* end */ |
| 12799 | }; |
| 12800 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12801 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12802 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12803 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12804 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12805 | { } /* end */ |
| 12806 | }; |
| 12807 | |
| 12808 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12809 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12810 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12811 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12812 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12813 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12814 | { } /* end */ |
| 12815 | }; |
| 12816 | |
| 12817 | static struct hda_input_mux alc268_capture_source = { |
| 12818 | .num_items = 4, |
| 12819 | .items = { |
| 12820 | { "Mic", 0x0 }, |
| 12821 | { "Front Mic", 0x1 }, |
| 12822 | { "Line", 0x2 }, |
| 12823 | { "CD", 0x3 }, |
| 12824 | }, |
| 12825 | }; |
| 12826 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12827 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12828 | .num_items = 3, |
| 12829 | .items = { |
| 12830 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12831 | { "Internal Mic", 0x1 }, |
| 12832 | { "Line", 0x2 }, |
| 12833 | }, |
| 12834 | }; |
| 12835 | |
| 12836 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12837 | .num_items = 3, |
| 12838 | .items = { |
| 12839 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12840 | { "Internal Mic", 0x6 }, |
| 12841 | { "Line", 0x2 }, |
| 12842 | }, |
| 12843 | }; |
| 12844 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12845 | #ifdef CONFIG_SND_DEBUG |
| 12846 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12847 | /* Volume widgets */ |
| 12848 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12849 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12850 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12851 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12852 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12853 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12854 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12855 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12856 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12857 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12858 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12859 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12860 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12861 | /* The below appears problematic on some hardwares */ |
| 12862 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12863 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12864 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12865 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12866 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12867 | |
| 12868 | /* Modes for retasking pin widgets */ |
| 12869 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12870 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12871 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12872 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12873 | |
| 12874 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12875 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12876 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12877 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12878 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12879 | |
| 12880 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12881 | * The ALC268 does not have an SPDIF input. |
| 12882 | */ |
| 12883 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12884 | |
| 12885 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12886 | * this output to turn on an external amplifier. |
| 12887 | */ |
| 12888 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12889 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12890 | |
| 12891 | { } /* end */ |
| 12892 | }; |
| 12893 | #endif |
| 12894 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12895 | /* create input playback/capture controls for the given pin */ |
| 12896 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12897 | const char *ctlname, int idx) |
| 12898 | { |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12899 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12900 | int err; |
| 12901 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12902 | switch (nid) { |
| 12903 | case 0x14: |
| 12904 | case 0x16: |
| 12905 | dac = 0x02; |
| 12906 | break; |
| 12907 | case 0x15: |
| 12908 | dac = 0x03; |
| 12909 | break; |
| 12910 | default: |
| 12911 | return 0; |
| 12912 | } |
| 12913 | if (spec->multiout.dac_nids[0] != dac && |
| 12914 | spec->multiout.dac_nids[1] != dac) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12915 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12916 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12917 | HDA_OUTPUT)); |
| 12918 | if (err < 0) |
| 12919 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12920 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12921 | } |
| 12922 | |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12923 | if (nid != 0x16) |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12924 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12925 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12926 | else /* mono */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12927 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12928 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12929 | if (err < 0) |
| 12930 | return err; |
| 12931 | return 0; |
| 12932 | } |
| 12933 | |
| 12934 | /* add playback controls from the parsed DAC table */ |
| 12935 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12936 | const struct auto_pin_cfg *cfg) |
| 12937 | { |
| 12938 | hda_nid_t nid; |
| 12939 | int err; |
| 12940 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12941 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12942 | |
| 12943 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12944 | if (nid) { |
| 12945 | const char *name; |
| 12946 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12947 | name = "Speaker"; |
| 12948 | else |
| 12949 | name = "Front"; |
| 12950 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12951 | if (err < 0) |
| 12952 | return err; |
| 12953 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12954 | |
| 12955 | nid = cfg->speaker_pins[0]; |
| 12956 | if (nid == 0x1d) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12957 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12958 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12959 | if (err < 0) |
| 12960 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12961 | } else { |
| 12962 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12963 | if (err < 0) |
| 12964 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12965 | } |
| 12966 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12967 | if (nid) { |
| 12968 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12969 | if (err < 0) |
| 12970 | return err; |
| 12971 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12972 | |
| 12973 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12974 | if (nid == 0x16) { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 12975 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12976 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12977 | if (err < 0) |
| 12978 | return err; |
| 12979 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12980 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12981 | } |
| 12982 | |
| 12983 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12984 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12985 | const struct auto_pin_cfg *cfg) |
| 12986 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12987 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12988 | } |
| 12989 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12990 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12991 | hda_nid_t nid, int pin_type) |
| 12992 | { |
| 12993 | int idx; |
| 12994 | |
| 12995 | alc_set_pin_output(codec, nid, pin_type); |
| 12996 | if (nid == 0x14 || nid == 0x16) |
| 12997 | idx = 0; |
| 12998 | else |
| 12999 | idx = 1; |
| 13000 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 13001 | } |
| 13002 | |
| 13003 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 13004 | { |
| 13005 | struct alc_spec *spec = codec->spec; |
| 13006 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 13007 | if (nid) { |
| 13008 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 13009 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 13010 | } |
| 13011 | } |
| 13012 | |
| 13013 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 13014 | { |
| 13015 | struct alc_spec *spec = codec->spec; |
| 13016 | hda_nid_t pin; |
| 13017 | |
| 13018 | pin = spec->autocfg.hp_pins[0]; |
| 13019 | if (pin) |
| 13020 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 13021 | pin = spec->autocfg.speaker_pins[0]; |
| 13022 | if (pin) |
| 13023 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 13024 | } |
| 13025 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13026 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 13027 | { |
| 13028 | struct alc_spec *spec = codec->spec; |
| 13029 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 13030 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 13031 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 13032 | unsigned int dac_vol1, dac_vol2; |
| 13033 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13034 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13035 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 13036 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13037 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13038 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13039 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13040 | AMP_IN_UNMUTE(1)); |
| 13041 | snd_hda_codec_write(codec, 0x10, 0, |
| 13042 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13043 | AMP_IN_UNMUTE(1)); |
| 13044 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13045 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13046 | snd_hda_codec_write(codec, 0x0f, 0, |
| 13047 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13048 | snd_hda_codec_write(codec, 0x10, 0, |
| 13049 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 13050 | } |
| 13051 | |
| 13052 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13053 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13054 | dac_vol2 = AMP_OUT_ZERO; |
| 13055 | else if (line_nid == 0x15) |
| 13056 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13057 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13058 | dac_vol2 = AMP_OUT_ZERO; |
| 13059 | else if (hp_nid == 0x15) |
| 13060 | dac_vol1 = AMP_OUT_ZERO; |
| 13061 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 13062 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 13063 | spec->autocfg.line_out_pins[2] != 0x16) |
| 13064 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 13065 | |
| 13066 | snd_hda_codec_write(codec, 0x02, 0, |
| 13067 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 13068 | snd_hda_codec_write(codec, 0x03, 0, |
| 13069 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 13070 | } |
| 13071 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13072 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13073 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 13074 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13075 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13076 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 13077 | |
| 13078 | /* |
| 13079 | * BIOS auto configuration |
| 13080 | */ |
| 13081 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 13082 | { |
| 13083 | struct alc_spec *spec = codec->spec; |
| 13084 | int err; |
| 13085 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 13086 | |
| 13087 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13088 | alc268_ignore); |
| 13089 | if (err < 0) |
| 13090 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13091 | if (!spec->autocfg.line_outs) { |
| 13092 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 13093 | spec->multiout.max_channels = 2; |
| 13094 | spec->no_analog = 1; |
| 13095 | goto dig_only; |
| 13096 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13097 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13098 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13099 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13100 | if (err < 0) |
| 13101 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13102 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13103 | if (err < 0) |
| 13104 | return err; |
| 13105 | |
| 13106 | spec->multiout.max_channels = 2; |
| 13107 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13108 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13109 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13110 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13111 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13112 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 13113 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13114 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13115 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13116 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 13117 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13118 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13119 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13120 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13121 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13122 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13123 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13124 | err = alc_auto_add_mic_boost(codec); |
| 13125 | if (err < 0) |
| 13126 | return err; |
| 13127 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 13128 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13129 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13130 | return 1; |
| 13131 | } |
| 13132 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13133 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 13134 | |
| 13135 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13136 | static void alc268_auto_init(struct hda_codec *codec) |
| 13137 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13138 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13139 | alc268_auto_init_multi_out(codec); |
| 13140 | alc268_auto_init_hp_out(codec); |
| 13141 | alc268_auto_init_mono_speaker_out(codec); |
| 13142 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13143 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13144 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13145 | } |
| 13146 | |
| 13147 | /* |
| 13148 | * configuration and preset |
| 13149 | */ |
| 13150 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13151 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13152 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 13153 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13154 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13155 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13156 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13157 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13158 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13159 | #ifdef CONFIG_SND_DEBUG |
| 13160 | [ALC268_TEST] = "test", |
| 13161 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13162 | [ALC268_AUTO] = "auto", |
| 13163 | }; |
| 13164 | |
| 13165 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 13166 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13167 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 13168 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13169 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 13170 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13171 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 13172 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13173 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Daniel T Chen | a1bf808 | 2009-11-01 18:32:29 -0500 | [diff] [blame] | 13174 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, |
| 13175 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13176 | /* almost compatible with toshiba but with optional digital outs; |
| 13177 | * auto-probing seems working fine |
| 13178 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13179 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame] | 13180 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13181 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13182 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 13183 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 13184 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13185 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 13186 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13187 | {} |
| 13188 | }; |
| 13189 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13190 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 13191 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 13192 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 13193 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 13194 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 13195 | ALC268_TOSHIBA), |
| 13196 | {} |
| 13197 | }; |
| 13198 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13199 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13200 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13201 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 13202 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13203 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13204 | alc267_quanta_il1_verbs }, |
| 13205 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13206 | .dac_nids = alc268_dac_nids, |
| 13207 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13208 | .adc_nids = alc268_adc_nids_alt, |
| 13209 | .hp_nid = 0x03, |
| 13210 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13211 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13212 | .unsol_event = alc_sku_unsol_event, |
| 13213 | .setup = alc267_quanta_il1_setup, |
| 13214 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 13215 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13216 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13217 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13218 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13219 | .init_verbs = { alc268_base_init_verbs }, |
| 13220 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13221 | .dac_nids = alc268_dac_nids, |
| 13222 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13223 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13224 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13225 | .hp_nid = 0x03, |
| 13226 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13227 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13228 | .channel_mode = alc268_modes, |
| 13229 | .input_mux = &alc268_capture_source, |
| 13230 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13231 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 13232 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13233 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13234 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13235 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13236 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13237 | .dac_nids = alc268_dac_nids, |
| 13238 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13239 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13240 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13241 | .hp_nid = 0x03, |
| 13242 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13243 | .channel_mode = alc268_modes, |
| 13244 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13245 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13246 | .setup = alc268_toshiba_setup, |
| 13247 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13248 | }, |
| 13249 | [ALC268_ACER] = { |
Takashi Iwai | 432fd13 | 2009-09-30 08:13:44 +0200 | [diff] [blame] | 13250 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13251 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13252 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13253 | alc268_acer_verbs }, |
| 13254 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13255 | .dac_nids = alc268_dac_nids, |
| 13256 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13257 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13258 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13259 | .hp_nid = 0x02, |
| 13260 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13261 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 13262 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 13263 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 13264 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13265 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 13266 | [ALC268_ACER_DMIC] = { |
| 13267 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 13268 | alc268_beep_mixer }, |
| 13269 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13270 | alc268_acer_verbs }, |
| 13271 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13272 | .dac_nids = alc268_dac_nids, |
| 13273 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13274 | .adc_nids = alc268_adc_nids_alt, |
| 13275 | .capsrc_nids = alc268_capsrc_nids, |
| 13276 | .hp_nid = 0x02, |
| 13277 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13278 | .channel_mode = alc268_modes, |
| 13279 | .input_mux = &alc268_acer_dmic_capture_source, |
| 13280 | .unsol_event = alc268_acer_unsol_event, |
| 13281 | .init_hook = alc268_acer_init_hook, |
| 13282 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13283 | [ALC268_ACER_ASPIRE_ONE] = { |
| 13284 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13285 | alc268_beep_mixer, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13286 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13287 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13288 | alc268_acer_aspire_one_verbs }, |
| 13289 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13290 | .dac_nids = alc268_dac_nids, |
| 13291 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13292 | .adc_nids = alc268_adc_nids_alt, |
| 13293 | .capsrc_nids = alc268_capsrc_nids, |
| 13294 | .hp_nid = 0x03, |
| 13295 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13296 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13297 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13298 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 13299 | .init_hook = alc268_acer_lc_init_hook, |
| 13300 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13301 | [ALC268_DELL] = { |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13302 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 13303 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13304 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13305 | alc268_dell_verbs }, |
| 13306 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13307 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13308 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13309 | .adc_nids = alc268_adc_nids_alt, |
| 13310 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13311 | .hp_nid = 0x02, |
| 13312 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13313 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 13314 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13315 | .setup = alc268_dell_setup, |
| 13316 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13317 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13318 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13319 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 13320 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13321 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13322 | alc268_toshiba_verbs }, |
| 13323 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13324 | .dac_nids = alc268_dac_nids, |
| 13325 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13326 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13327 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13328 | .hp_nid = 0x03, |
| 13329 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13330 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13331 | .channel_mode = alc268_modes, |
| 13332 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13333 | .setup = alc268_toshiba_setup, |
| 13334 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 13335 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13336 | #ifdef CONFIG_SND_DEBUG |
| 13337 | [ALC268_TEST] = { |
| 13338 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 13339 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 13340 | alc268_volume_init_verbs }, |
| 13341 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 13342 | .dac_nids = alc268_dac_nids, |
| 13343 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 13344 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13345 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 13346 | .hp_nid = 0x03, |
| 13347 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 13348 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 13349 | .channel_mode = alc268_modes, |
| 13350 | .input_mux = &alc268_capture_source, |
| 13351 | }, |
| 13352 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13353 | }; |
| 13354 | |
| 13355 | static int patch_alc268(struct hda_codec *codec) |
| 13356 | { |
| 13357 | struct alc_spec *spec; |
| 13358 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13359 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13360 | |
Julia Lawall | ef86f58 | 2009-12-19 08:18:03 +0100 | [diff] [blame] | 13361 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13362 | if (spec == NULL) |
| 13363 | return -ENOMEM; |
| 13364 | |
| 13365 | codec->spec = spec; |
| 13366 | |
| 13367 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 13368 | alc268_models, |
| 13369 | alc268_cfg_tbl); |
| 13370 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13371 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 13372 | board_config = snd_hda_check_board_codec_sid_config(codec, |
Takashi Iwai | 50ae0aa | 2010-03-08 12:09:59 +0100 | [diff] [blame] | 13373 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 13374 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13375 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13376 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13377 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13378 | board_config = ALC268_AUTO; |
| 13379 | } |
| 13380 | |
| 13381 | if (board_config == ALC268_AUTO) { |
| 13382 | /* automatic parse from the BIOS config */ |
| 13383 | err = alc268_parse_auto_config(codec); |
| 13384 | if (err < 0) { |
| 13385 | alc_free(codec); |
| 13386 | return err; |
| 13387 | } else if (!err) { |
| 13388 | printk(KERN_INFO |
| 13389 | "hda_codec: Cannot set up configuration " |
| 13390 | "from BIOS. Using base mode...\n"); |
| 13391 | board_config = ALC268_3ST; |
| 13392 | } |
| 13393 | } |
| 13394 | |
| 13395 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13396 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13397 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13398 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 13399 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 13400 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13401 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13402 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 13403 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13404 | has_beep = 0; |
| 13405 | for (i = 0; i < spec->num_mixers; i++) { |
| 13406 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 13407 | has_beep = 1; |
| 13408 | break; |
| 13409 | } |
| 13410 | } |
| 13411 | |
| 13412 | if (has_beep) { |
| 13413 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13414 | if (err < 0) { |
| 13415 | alc_free(codec); |
| 13416 | return err; |
| 13417 | } |
| 13418 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 13419 | /* override the amp caps for beep generator */ |
| 13420 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13421 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 13422 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 13423 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 13424 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 13425 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 13426 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13427 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13428 | /* check whether NID 0x07 is valid */ |
| 13429 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13430 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13431 | |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13432 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13433 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 13434 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13435 | if (spec->auto_mic || |
| 13436 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13437 | spec->adc_nids = alc268_adc_nids_alt; |
| 13438 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | defb5ab | 2009-10-07 15:12:27 +0200 | [diff] [blame] | 13439 | if (spec->auto_mic) |
| 13440 | fixup_automic_adc(codec); |
Takashi Iwai | fdbc6626 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 13441 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 13442 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 13443 | else |
| 13444 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 13445 | } else { |
| 13446 | spec->adc_nids = alc268_adc_nids; |
| 13447 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13448 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13449 | } |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13450 | /* set default input source */ |
| 13451 | for (i = 0; i < spec->num_adc_nids; i++) |
| 13452 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 13453 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 13454 | i < spec->num_mux_defs ? |
| 13455 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 13456 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13457 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13458 | |
| 13459 | spec->vmaster_nid = 0x02; |
| 13460 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13461 | codec->patch_ops = alc_patch_ops; |
| 13462 | if (board_config == ALC268_AUTO) |
| 13463 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13464 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13465 | return 0; |
| 13466 | } |
| 13467 | |
| 13468 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13469 | * ALC269 channel source setting (2 channel) |
| 13470 | */ |
| 13471 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 13472 | |
| 13473 | #define alc269_dac_nids alc260_dac_nids |
| 13474 | |
| 13475 | static hda_nid_t alc269_adc_nids[1] = { |
| 13476 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13477 | 0x08, |
| 13478 | }; |
| 13479 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13480 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 13481 | 0x23, |
| 13482 | }; |
| 13483 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13484 | static hda_nid_t alc269vb_adc_nids[1] = { |
| 13485 | /* ADC1 */ |
| 13486 | 0x09, |
| 13487 | }; |
| 13488 | |
| 13489 | static hda_nid_t alc269vb_capsrc_nids[1] = { |
| 13490 | 0x22, |
| 13491 | }; |
| 13492 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 13493 | static hda_nid_t alc269_adc_candidates[] = { |
| 13494 | 0x08, 0x09, 0x07, |
| 13495 | }; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13496 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13497 | #define alc269_modes alc260_modes |
| 13498 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 13499 | |
| 13500 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 13501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13502 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13503 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13504 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13505 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13506 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13507 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13508 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13509 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13510 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 13511 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13512 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 13513 | { } /* end */ |
| 13514 | }; |
| 13515 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13516 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 13517 | /* output mixer control */ |
| 13518 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13519 | { |
| 13520 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13521 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13522 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13523 | .info = snd_hda_mixer_amp_switch_info, |
| 13524 | .get = snd_hda_mixer_amp_switch_get, |
| 13525 | .put = alc268_acer_master_sw_put, |
| 13526 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13527 | }, |
| 13528 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13529 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13530 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13531 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13532 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13533 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13534 | { } |
| 13535 | }; |
| 13536 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13537 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 13538 | /* output mixer control */ |
| 13539 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 13540 | { |
| 13541 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13542 | .name = "Master Playback Switch", |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 13543 | .subdevice = HDA_SUBDEV_AMP_FLAG, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13544 | .info = snd_hda_mixer_amp_switch_info, |
| 13545 | .get = snd_hda_mixer_amp_switch_get, |
| 13546 | .put = alc268_acer_master_sw_put, |
| 13547 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 13548 | }, |
| 13549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13550 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13551 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13552 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 13553 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 13554 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 13555 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 13556 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 13557 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13558 | { } |
| 13559 | }; |
| 13560 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13561 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13562 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13563 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 13564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 13565 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13566 | { } /* end */ |
| 13567 | }; |
| 13568 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13569 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { |
| 13570 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13571 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13572 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13573 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13574 | { } /* end */ |
| 13575 | }; |
| 13576 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13577 | /* capture mixer elements */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13578 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { |
| 13579 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13580 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 13581 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13582 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13583 | { } /* end */ |
| 13584 | }; |
| 13585 | |
| 13586 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13587 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 13588 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13589 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13590 | { } /* end */ |
| 13591 | }; |
| 13592 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13593 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { |
| 13594 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13595 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13596 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13597 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), |
| 13598 | { } /* end */ |
| 13599 | }; |
| 13600 | |
| 13601 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { |
| 13602 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13603 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13604 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 13605 | { } /* end */ |
| 13606 | }; |
| 13607 | |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13608 | /* FSC amilo */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13609 | #define alc269_fujitsu_mixer alc269_laptop_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13610 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13611 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 13612 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13613 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13614 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13615 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13616 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13617 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13618 | { } |
| 13619 | }; |
| 13620 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13621 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 13622 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13623 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13624 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13625 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13626 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13627 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13629 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 13630 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13631 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13632 | { } |
| 13633 | }; |
| 13634 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13635 | /* toggle speaker-output according to the hp-jack state */ |
| 13636 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 13637 | { |
| 13638 | unsigned int present; |
| 13639 | unsigned char bits; |
| 13640 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13641 | present = snd_hda_jack_detect(codec, 0x15); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13642 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13643 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13644 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13645 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13646 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13647 | |
| 13648 | snd_hda_codec_write(codec, 0x20, 0, |
| 13649 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13650 | snd_hda_codec_write(codec, 0x20, 0, |
| 13651 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13652 | |
| 13653 | snd_hda_codec_write(codec, 0x20, 0, |
| 13654 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13655 | snd_hda_codec_write(codec, 0x20, 0, |
| 13656 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13657 | } |
| 13658 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13659 | /* toggle speaker-output according to the hp-jacks state */ |
| 13660 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13661 | { |
| 13662 | unsigned int present; |
| 13663 | unsigned char bits; |
| 13664 | |
| 13665 | /* Check laptop headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13666 | present = snd_hda_jack_detect(codec, 0x15); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13667 | |
| 13668 | /* Check port replicator headphone socket */ |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13669 | present |= snd_hda_jack_detect(codec, 0x1a); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13670 | |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13671 | bits = present ? HDA_AMP_MUTE : 0; |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13672 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13673 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13674 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13675 | HDA_AMP_MUTE, bits); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13676 | |
| 13677 | snd_hda_codec_write(codec, 0x20, 0, |
| 13678 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13679 | snd_hda_codec_write(codec, 0x20, 0, |
| 13680 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13681 | |
| 13682 | snd_hda_codec_write(codec, 0x20, 0, |
| 13683 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13684 | snd_hda_codec_write(codec, 0x20, 0, |
| 13685 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13686 | } |
| 13687 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13688 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13689 | { |
| 13690 | unsigned int present_laptop; |
| 13691 | unsigned int present_dock; |
| 13692 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 13693 | present_laptop = snd_hda_jack_detect(codec, 0x18); |
| 13694 | present_dock = snd_hda_jack_detect(codec, 0x1b); |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13695 | |
| 13696 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13697 | if (present_dock) |
| 13698 | snd_hda_codec_write(codec, 0x23, 0, |
| 13699 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13700 | if (present_laptop) |
| 13701 | snd_hda_codec_write(codec, 0x23, 0, |
| 13702 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13703 | if (!present_dock && !present_laptop) |
| 13704 | snd_hda_codec_write(codec, 0x23, 0, |
| 13705 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13706 | } |
| 13707 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13708 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13709 | unsigned int res) |
| 13710 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13711 | switch (res >> 26) { |
| 13712 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13713 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13714 | break; |
| 13715 | case ALC880_MIC_EVENT: |
| 13716 | alc_mic_automute(codec); |
| 13717 | break; |
| 13718 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13719 | } |
| 13720 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13721 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13722 | unsigned int res) |
| 13723 | { |
| 13724 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13725 | alc269_lifebook_speaker_automute(codec); |
| 13726 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13727 | alc269_lifebook_mic_autoswitch(codec); |
| 13728 | } |
| 13729 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13730 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13731 | { |
| 13732 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13733 | spec->autocfg.hp_pins[0] = 0x15; |
| 13734 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13735 | spec->ext_mic.pin = 0x18; |
| 13736 | spec->ext_mic.mux_idx = 0; |
| 13737 | spec->int_mic.pin = 0x19; |
| 13738 | spec->int_mic.mux_idx = 1; |
| 13739 | spec->auto_mic = 1; |
| 13740 | } |
| 13741 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13742 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13743 | { |
| 13744 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13745 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13746 | } |
| 13747 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13748 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13749 | { |
| 13750 | alc269_lifebook_speaker_automute(codec); |
| 13751 | alc269_lifebook_mic_autoswitch(codec); |
| 13752 | } |
| 13753 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13754 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13755 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13756 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13757 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13759 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13760 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13761 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13762 | {} |
| 13763 | }; |
| 13764 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13765 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13766 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13767 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13768 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13769 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13770 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13771 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13772 | {} |
| 13773 | }; |
| 13774 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13775 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { |
| 13776 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13777 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 13778 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13779 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13780 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13781 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13782 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13783 | {} |
| 13784 | }; |
| 13785 | |
| 13786 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { |
| 13787 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13788 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13789 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13790 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13791 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13792 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13793 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13794 | {} |
| 13795 | }; |
| 13796 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13797 | /* toggle speaker-output according to the hp-jack state */ |
| 13798 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13799 | { |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13800 | struct alc_spec *spec = codec->spec; |
| 13801 | unsigned int nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13802 | unsigned int present; |
| 13803 | unsigned char bits; |
| 13804 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 13805 | present = snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13806 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13807 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13808 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13809 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 13810 | HDA_AMP_MUTE, bits); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13811 | } |
| 13812 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13813 | /* unsolicited event for HP jack sensing */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13814 | static void alc269_laptop_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13815 | unsigned int res) |
| 13816 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13817 | switch (res >> 26) { |
| 13818 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13819 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13820 | break; |
| 13821 | case ALC880_MIC_EVENT: |
| 13822 | alc_mic_automute(codec); |
| 13823 | break; |
| 13824 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13825 | } |
| 13826 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13827 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13828 | { |
| 13829 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13830 | spec->autocfg.hp_pins[0] = 0x15; |
| 13831 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13832 | spec->ext_mic.pin = 0x18; |
| 13833 | spec->ext_mic.mux_idx = 0; |
| 13834 | spec->int_mic.pin = 0x12; |
| 13835 | spec->int_mic.mux_idx = 5; |
| 13836 | spec->auto_mic = 1; |
| 13837 | } |
| 13838 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13839 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) |
| 13840 | { |
| 13841 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13842 | spec->autocfg.hp_pins[0] = 0x15; |
| 13843 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13844 | spec->ext_mic.pin = 0x18; |
| 13845 | spec->ext_mic.mux_idx = 0; |
| 13846 | spec->int_mic.pin = 0x12; |
| 13847 | spec->int_mic.mux_idx = 6; |
| 13848 | spec->auto_mic = 1; |
| 13849 | } |
| 13850 | |
| 13851 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13852 | { |
| 13853 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 20645d7 | 2010-03-02 11:14:01 +0100 | [diff] [blame] | 13854 | spec->autocfg.hp_pins[0] = 0x15; |
| 13855 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13856 | spec->ext_mic.pin = 0x18; |
| 13857 | spec->ext_mic.mux_idx = 0; |
| 13858 | spec->int_mic.pin = 0x19; |
| 13859 | spec->int_mic.mux_idx = 1; |
| 13860 | spec->auto_mic = 1; |
| 13861 | } |
| 13862 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13863 | static void alc269_laptop_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13864 | { |
| 13865 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13866 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13867 | } |
| 13868 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13869 | /* |
| 13870 | * generic initialization of ADC, input mixers and output mixers |
| 13871 | */ |
| 13872 | static struct hda_verb alc269_init_verbs[] = { |
| 13873 | /* |
| 13874 | * Unmute ADC0 and set the default input to mic-in |
| 13875 | */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13876 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13877 | |
| 13878 | /* |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13879 | * Set up output mixers (0x02 - 0x03) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13880 | */ |
| 13881 | /* set vol=0 to output mixers */ |
| 13882 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13883 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13884 | |
| 13885 | /* set up input amps for analog loopback */ |
| 13886 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13887 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13888 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13889 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13890 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13891 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13893 | |
| 13894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13895 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13896 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13897 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13898 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13899 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13900 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13901 | |
| 13902 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13903 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13904 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13905 | /* FIXME: use Mux-type input source selection */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13906 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13907 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13908 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13909 | |
| 13910 | /* set EAPD */ |
| 13911 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 13912 | { } |
| 13913 | }; |
| 13914 | |
| 13915 | static struct hda_verb alc269vb_init_verbs[] = { |
| 13916 | /* |
| 13917 | * Unmute ADC0 and set the default input to mic-in |
| 13918 | */ |
| 13919 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13920 | |
| 13921 | /* |
| 13922 | * Set up output mixers (0x02 - 0x03) |
| 13923 | */ |
| 13924 | /* set vol=0 to output mixers */ |
| 13925 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13926 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13927 | |
| 13928 | /* set up input amps for analog loopback */ |
| 13929 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13930 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13931 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13932 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13933 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13934 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13935 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13936 | |
| 13937 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13938 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13939 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13940 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13941 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13942 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13944 | |
| 13945 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13946 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13947 | |
| 13948 | /* FIXME: use Mux-type input source selection */ |
| 13949 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13950 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 13951 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13952 | |
| 13953 | /* set EAPD */ |
| 13954 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13955 | { } |
| 13956 | }; |
| 13957 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13958 | #define alc269_auto_create_multi_out_ctls \ |
| 13959 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13960 | #define alc269_auto_create_input_ctls \ |
| 13961 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13962 | |
| 13963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13964 | #define alc269_loopbacks alc880_loopbacks |
| 13965 | #endif |
| 13966 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13967 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13968 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13969 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13970 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13971 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13972 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13973 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13974 | .substreams = 1, |
| 13975 | .channels_min = 2, |
| 13976 | .channels_max = 8, |
| 13977 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13978 | /* NID is set in alc_build_pcms */ |
| 13979 | .ops = { |
| 13980 | .open = alc880_playback_pcm_open, |
| 13981 | .prepare = alc880_playback_pcm_prepare, |
| 13982 | .cleanup = alc880_playback_pcm_cleanup |
| 13983 | }, |
| 13984 | }; |
| 13985 | |
| 13986 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13987 | .substreams = 1, |
| 13988 | .channels_min = 2, |
| 13989 | .channels_max = 2, |
| 13990 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13991 | /* NID is set in alc_build_pcms */ |
| 13992 | }; |
| 13993 | |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 13994 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13995 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) |
| 13996 | { |
| 13997 | switch (codec->subsystem_id) { |
| 13998 | case 0x103c1586: |
| 13999 | return 1; |
| 14000 | } |
| 14001 | return 0; |
| 14002 | } |
| 14003 | |
| 14004 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) |
| 14005 | { |
| 14006 | /* update mute-LED according to the speaker mute state */ |
| 14007 | if (nid == 0x01 || nid == 0x14) { |
| 14008 | int pinval; |
| 14009 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & |
| 14010 | HDA_AMP_MUTE) |
| 14011 | pinval = 0x24; |
| 14012 | else |
| 14013 | pinval = 0x20; |
| 14014 | /* mic2 vref pin is used for mute LED control */ |
Takashi Iwai | a68d5a5 | 2010-03-30 18:03:44 +0200 | [diff] [blame^] | 14015 | snd_hda_codec_update_cache(codec, 0x19, 0, |
| 14016 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14017 | pinval); |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14018 | } |
| 14019 | return alc_check_power_status(codec, nid); |
| 14020 | } |
| 14021 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ |
| 14022 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14023 | /* |
| 14024 | * BIOS auto configuration |
| 14025 | */ |
| 14026 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 14027 | { |
| 14028 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 14029 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14030 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 14031 | |
| 14032 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14033 | alc269_ignore); |
| 14034 | if (err < 0) |
| 14035 | return err; |
| 14036 | |
| 14037 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14038 | if (err < 0) |
| 14039 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14040 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14041 | if (err < 0) |
| 14042 | return err; |
| 14043 | |
| 14044 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14045 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14046 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14047 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 14048 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14049 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14050 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14051 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14052 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
| 14053 | add_verb(spec, alc269vb_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14054 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14055 | } else { |
| 14056 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 14057 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14058 | } |
| 14059 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14060 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14061 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14062 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
| 14063 | sizeof(alc269_adc_candidates)); |
| 14064 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14065 | /* set default input source */ |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14066 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 14067 | 0, AC_VERB_SET_CONNECT_SEL, |
| 14068 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14069 | |
| 14070 | err = alc_auto_add_mic_boost(codec); |
| 14071 | if (err < 0) |
| 14072 | return err; |
| 14073 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 14074 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14075 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14076 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14077 | return 1; |
| 14078 | } |
| 14079 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 14080 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 14081 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14082 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 14083 | |
| 14084 | |
| 14085 | /* init callback for auto-configuration model -- overriding the default init */ |
| 14086 | static void alc269_auto_init(struct hda_codec *codec) |
| 14087 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14088 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14089 | alc269_auto_init_multi_out(codec); |
| 14090 | alc269_auto_init_hp_out(codec); |
| 14091 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14092 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14093 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14094 | } |
| 14095 | |
| 14096 | /* |
| 14097 | * configuration and preset |
| 14098 | */ |
| 14099 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14100 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 14101 | [ALC269_QUANTA_FL1] = "quanta", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14102 | [ALC269_AMIC] = "laptop-amic", |
| 14103 | [ALC269_DMIC] = "laptop-dmic", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14104 | [ALC269_FUJITSU] = "fujitsu", |
Takashi Iwai | 3d3792c | 2009-09-11 07:50:47 +0200 | [diff] [blame] | 14105 | [ALC269_LIFEBOOK] = "lifebook", |
| 14106 | [ALC269_AUTO] = "auto", |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14107 | }; |
| 14108 | |
| 14109 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14110 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14111 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14112 | ALC269_AMIC), |
| 14113 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), |
| 14114 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), |
| 14115 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), |
| 14116 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), |
| 14117 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), |
| 14118 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), |
| 14119 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
| 14120 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
| 14121 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
| 14122 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), |
| 14123 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
| 14124 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
| 14125 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
| 14126 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), |
| 14127 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), |
| 14128 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), |
| 14129 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), |
| 14130 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), |
| 14131 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), |
| 14132 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), |
| 14133 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), |
| 14134 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), |
| 14135 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), |
| 14136 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), |
| 14137 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), |
| 14138 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), |
| 14139 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), |
| 14140 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), |
| 14141 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), |
| 14142 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), |
| 14143 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), |
| 14144 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), |
| 14145 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), |
| 14146 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), |
| 14147 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), |
| 14148 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14149 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14150 | ALC269_DMIC), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14151 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14152 | ALC269_DMIC), |
| 14153 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
| 14154 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14155 | SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14156 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | 61c2d2b | 2010-02-25 08:49:06 +0100 | [diff] [blame] | 14157 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
| 14158 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
| 14159 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), |
| 14160 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), |
| 14161 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), |
| 14162 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14163 | {} |
| 14164 | }; |
| 14165 | |
| 14166 | static struct alc_config_preset alc269_presets[] = { |
| 14167 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14168 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14169 | .init_verbs = { alc269_init_verbs }, |
| 14170 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14171 | .dac_nids = alc269_dac_nids, |
| 14172 | .hp_nid = 0x03, |
| 14173 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14174 | .channel_mode = alc269_modes, |
| 14175 | .input_mux = &alc269_capture_source, |
| 14176 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14177 | [ALC269_QUANTA_FL1] = { |
| 14178 | .mixers = { alc269_quanta_fl1_mixer }, |
| 14179 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 14180 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14181 | .dac_nids = alc269_dac_nids, |
| 14182 | .hp_nid = 0x03, |
| 14183 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14184 | .channel_mode = alc269_modes, |
| 14185 | .input_mux = &alc269_capture_source, |
| 14186 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 14187 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 14188 | .init_hook = alc269_quanta_fl1_init_hook, |
| 14189 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14190 | [ALC269_AMIC] = { |
| 14191 | .mixers = { alc269_laptop_mixer }, |
| 14192 | .cap_mixer = alc269_laptop_analog_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14193 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14194 | alc269_laptop_amic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14195 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14196 | .dac_nids = alc269_dac_nids, |
| 14197 | .hp_nid = 0x03, |
| 14198 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14199 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14200 | .unsol_event = alc269_laptop_unsol_event, |
| 14201 | .setup = alc269_laptop_amic_setup, |
| 14202 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14203 | }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14204 | [ALC269_DMIC] = { |
| 14205 | .mixers = { alc269_laptop_mixer }, |
| 14206 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14207 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14208 | alc269_laptop_dmic_init_verbs }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14209 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14210 | .dac_nids = alc269_dac_nids, |
| 14211 | .hp_nid = 0x03, |
| 14212 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14213 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14214 | .unsol_event = alc269_laptop_unsol_event, |
| 14215 | .setup = alc269_laptop_dmic_setup, |
| 14216 | .init_hook = alc269_laptop_inithook, |
| 14217 | }, |
| 14218 | [ALC269VB_AMIC] = { |
| 14219 | .mixers = { alc269vb_laptop_mixer }, |
| 14220 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, |
| 14221 | .init_verbs = { alc269vb_init_verbs, |
| 14222 | alc269vb_laptop_amic_init_verbs }, |
| 14223 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14224 | .dac_nids = alc269_dac_nids, |
| 14225 | .hp_nid = 0x03, |
| 14226 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14227 | .channel_mode = alc269_modes, |
| 14228 | .unsol_event = alc269_laptop_unsol_event, |
| 14229 | .setup = alc269_laptop_amic_setup, |
| 14230 | .init_hook = alc269_laptop_inithook, |
| 14231 | }, |
| 14232 | [ALC269VB_DMIC] = { |
| 14233 | .mixers = { alc269vb_laptop_mixer }, |
| 14234 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, |
| 14235 | .init_verbs = { alc269vb_init_verbs, |
| 14236 | alc269vb_laptop_dmic_init_verbs }, |
| 14237 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14238 | .dac_nids = alc269_dac_nids, |
| 14239 | .hp_nid = 0x03, |
| 14240 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14241 | .channel_mode = alc269_modes, |
| 14242 | .unsol_event = alc269_laptop_unsol_event, |
| 14243 | .setup = alc269vb_laptop_dmic_setup, |
| 14244 | .init_hook = alc269_laptop_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 14245 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14246 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14247 | .mixers = { alc269_fujitsu_mixer }, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14248 | .cap_mixer = alc269_laptop_digital_capture_mixer, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14249 | .init_verbs = { alc269_init_verbs, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14250 | alc269_laptop_dmic_init_verbs }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14251 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14252 | .dac_nids = alc269_dac_nids, |
| 14253 | .hp_nid = 0x03, |
| 14254 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14255 | .channel_mode = alc269_modes, |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14256 | .unsol_event = alc269_laptop_unsol_event, |
| 14257 | .setup = alc269_laptop_dmic_setup, |
| 14258 | .init_hook = alc269_laptop_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 14259 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 14260 | [ALC269_LIFEBOOK] = { |
| 14261 | .mixers = { alc269_lifebook_mixer }, |
| 14262 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 14263 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 14264 | .dac_nids = alc269_dac_nids, |
| 14265 | .hp_nid = 0x03, |
| 14266 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14267 | .channel_mode = alc269_modes, |
| 14268 | .input_mux = &alc269_capture_source, |
| 14269 | .unsol_event = alc269_lifebook_unsol_event, |
| 14270 | .init_hook = alc269_lifebook_init_hook, |
| 14271 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14272 | }; |
| 14273 | |
| 14274 | static int patch_alc269(struct hda_codec *codec) |
| 14275 | { |
| 14276 | struct alc_spec *spec; |
| 14277 | int board_config; |
| 14278 | int err; |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14279 | int is_alc269vb = 0; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14280 | |
| 14281 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14282 | if (spec == NULL) |
| 14283 | return -ENOMEM; |
| 14284 | |
| 14285 | codec->spec = spec; |
| 14286 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14287 | alc_auto_parse_customize_define(codec); |
| 14288 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14289 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14290 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 14291 | spec->cdefine.platform_type == 1) |
| 14292 | alc_codec_rename(codec, "ALC271X"); |
| 14293 | else |
| 14294 | alc_codec_rename(codec, "ALC259"); |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14295 | is_alc269vb = 1; |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 14296 | } else |
| 14297 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 14298 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14299 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 14300 | alc269_models, |
| 14301 | alc269_cfg_tbl); |
| 14302 | |
| 14303 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14304 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14305 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14306 | board_config = ALC269_AUTO; |
| 14307 | } |
| 14308 | |
| 14309 | if (board_config == ALC269_AUTO) { |
| 14310 | /* automatic parse from the BIOS config */ |
| 14311 | err = alc269_parse_auto_config(codec); |
| 14312 | if (err < 0) { |
| 14313 | alc_free(codec); |
| 14314 | return err; |
| 14315 | } else if (!err) { |
| 14316 | printk(KERN_INFO |
| 14317 | "hda_codec: Cannot set up configuration " |
| 14318 | "from BIOS. Using base mode...\n"); |
| 14319 | board_config = ALC269_BASIC; |
| 14320 | } |
| 14321 | } |
| 14322 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14323 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 14324 | if (err < 0) { |
| 14325 | alc_free(codec); |
| 14326 | return err; |
| 14327 | } |
| 14328 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14329 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14330 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14331 | |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14332 | if (board_config == ALC269_QUANTA_FL1) { |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 14333 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 14334 | * fix the sample rate of analog I/O to 44.1kHz |
| 14335 | */ |
| 14336 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 14337 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 14338 | } else { |
| 14339 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 14340 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 14341 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14342 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 14343 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 14344 | |
Takashi Iwai | 6694635 | 2010-03-29 17:21:45 +0200 | [diff] [blame] | 14345 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 14346 | if (!is_alc269vb) { |
| 14347 | spec->adc_nids = alc269_adc_nids; |
| 14348 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 14349 | spec->capsrc_nids = alc269_capsrc_nids; |
| 14350 | } else { |
| 14351 | spec->adc_nids = alc269vb_adc_nids; |
| 14352 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
| 14353 | spec->capsrc_nids = alc269vb_capsrc_nids; |
| 14354 | } |
Kailang Yang | 84898e8 | 2010-02-04 14:16:14 +0100 | [diff] [blame] | 14355 | } |
| 14356 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14357 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14358 | set_capture_mixer(codec); |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 14359 | if (spec->cdefine.enable_pcbeep) |
| 14360 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14361 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 14362 | spec->vmaster_nid = 0x02; |
| 14363 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14364 | codec->patch_ops = alc_patch_ops; |
| 14365 | if (board_config == ALC269_AUTO) |
| 14366 | spec->init_hook = alc269_auto_init; |
| 14367 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14368 | if (!spec->loopback.amplist) |
| 14369 | spec->loopback.amplist = alc269_loopbacks; |
Takashi Iwai | ad35879 | 2010-03-30 18:00:59 +0200 | [diff] [blame] | 14370 | if (alc269_mic2_for_mute_led(codec)) |
| 14371 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14372 | #endif |
| 14373 | |
| 14374 | return 0; |
| 14375 | } |
| 14376 | |
| 14377 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14378 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 14379 | */ |
| 14380 | |
| 14381 | /* |
| 14382 | * set the path ways for 2 channel output |
| 14383 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 14384 | */ |
| 14385 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 14386 | /* set pin widget 1Ah (line in) for input */ |
| 14387 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14388 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14389 | * the vref |
| 14390 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14391 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14392 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14393 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14394 | #if 0 |
| 14395 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14396 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14397 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14398 | { } /* end */ |
| 14399 | }; |
| 14400 | /* |
| 14401 | * 6ch mode |
| 14402 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 14403 | */ |
| 14404 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 14405 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14406 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14407 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14408 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14409 | |
| 14410 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14411 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14412 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14413 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14414 | #if 0 |
| 14415 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14416 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14417 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14418 | { } /* end */ |
| 14419 | }; |
| 14420 | |
| 14421 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 14422 | { 2, alc861_threestack_ch2_init }, |
| 14423 | { 6, alc861_threestack_ch6_init }, |
| 14424 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14425 | /* Set mic1 as input and unmute the mixer */ |
| 14426 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 14427 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14428 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14429 | { } /* end */ |
| 14430 | }; |
| 14431 | /* Set mic1 as output and mute mixer */ |
| 14432 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 14433 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14434 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14435 | { } /* end */ |
| 14436 | }; |
| 14437 | |
| 14438 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 14439 | { 2, alc861_uniwill_m31_ch2_init }, |
| 14440 | { 4, alc861_uniwill_m31_ch4_init }, |
| 14441 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14442 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14443 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 14444 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 14445 | /* set pin widget 1Ah (line in) for input */ |
| 14446 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14447 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 14448 | * the vref |
| 14449 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14450 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14451 | |
| 14452 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 14453 | #if 0 |
| 14454 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 14455 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 14456 | #endif |
| 14457 | { } /* end */ |
| 14458 | }; |
| 14459 | /* Set mic1 nad line-in as output and mute mixer */ |
| 14460 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 14461 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 14462 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14463 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14464 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 14465 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14466 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 14467 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14468 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14469 | |
| 14470 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 14471 | #if 0 |
| 14472 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 14473 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 14474 | #endif |
| 14475 | { } /* end */ |
| 14476 | }; |
| 14477 | |
| 14478 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 14479 | { 2, alc861_asus_ch2_init }, |
| 14480 | { 6, alc861_asus_ch6_init }, |
| 14481 | }; |
| 14482 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14483 | /* patch-ALC861 */ |
| 14484 | |
| 14485 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 14486 | /* output mixer control */ |
| 14487 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14488 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14489 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14490 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14491 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14492 | |
| 14493 | /*Input mixer control */ |
| 14494 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14495 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14497 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14498 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14499 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14500 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14501 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14502 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14504 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14505 | { } /* end */ |
| 14506 | }; |
| 14507 | |
| 14508 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 14509 | /* output mixer control */ |
| 14510 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14511 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14512 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14513 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14514 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14515 | |
| 14516 | /* Input mixer control */ |
| 14517 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14518 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14520 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14521 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14522 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14525 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14526 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14527 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14528 | { |
| 14529 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14530 | .name = "Channel Mode", |
| 14531 | .info = alc_ch_mode_info, |
| 14532 | .get = alc_ch_mode_get, |
| 14533 | .put = alc_ch_mode_put, |
| 14534 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 14535 | }, |
| 14536 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14537 | }; |
| 14538 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14539 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14540 | /* output mixer control */ |
| 14541 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14542 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14543 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14544 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14545 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14546 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14547 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14548 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 14549 | /* output mixer control */ |
| 14550 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14551 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14552 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14553 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14554 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 14555 | |
| 14556 | /* Input mixer control */ |
| 14557 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14558 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 14559 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14560 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14561 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14562 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14563 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14564 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14565 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 14566 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14567 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14568 | { |
| 14569 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14570 | .name = "Channel Mode", |
| 14571 | .info = alc_ch_mode_info, |
| 14572 | .get = alc_ch_mode_get, |
| 14573 | .put = alc_ch_mode_put, |
| 14574 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14575 | }, |
| 14576 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14577 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14578 | |
| 14579 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 14580 | /* output mixer control */ |
| 14581 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 14582 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 14583 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 14584 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 14585 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 14586 | |
| 14587 | /* Input mixer control */ |
| 14588 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 14589 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 14590 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14591 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 14592 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 14593 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 14594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 14595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 14596 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14597 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 14598 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14599 | { |
| 14600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14601 | .name = "Channel Mode", |
| 14602 | .info = alc_ch_mode_info, |
| 14603 | .get = alc_ch_mode_get, |
| 14604 | .put = alc_ch_mode_put, |
| 14605 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 14606 | }, |
| 14607 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14608 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14609 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14610 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 14611 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14612 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 14613 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14614 | { } |
| 14615 | }; |
| 14616 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14617 | /* |
| 14618 | * generic initialization of ADC, input mixers and output mixers |
| 14619 | */ |
| 14620 | static struct hda_verb alc861_base_init_verbs[] = { |
| 14621 | /* |
| 14622 | * Unmute ADC0 and set the default input to mic-in |
| 14623 | */ |
| 14624 | /* port-A for surround (rear panel) */ |
| 14625 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14626 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14627 | /* port-B for mic-in (rear panel) with vref */ |
| 14628 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14629 | /* port-C for line-in (rear panel) */ |
| 14630 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14631 | /* port-D for Front */ |
| 14632 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14633 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14634 | /* port-E for HP out (front panel) */ |
| 14635 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14636 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14637 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14638 | /* port-F for mic-in (front panel) with vref */ |
| 14639 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14640 | /* port-G for CLFE (rear panel) */ |
| 14641 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14642 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14643 | /* port-H for side (rear panel) */ |
| 14644 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14645 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14646 | /* CD-in */ |
| 14647 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14648 | /* route front mic to ADC1*/ |
| 14649 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14650 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14651 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14652 | /* Unmute DAC0~3 & spdif out*/ |
| 14653 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14654 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14655 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14656 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14657 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14658 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14659 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14660 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14661 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14662 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14663 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14664 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14665 | /* Unmute Stereo Mixer 15 */ |
| 14666 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14667 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14668 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14669 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14670 | |
| 14671 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14672 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14673 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14674 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14675 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14676 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14677 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14678 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14679 | /* hp used DAC 3 (Front) */ |
| 14680 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14681 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14682 | |
| 14683 | { } |
| 14684 | }; |
| 14685 | |
| 14686 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 14687 | /* |
| 14688 | * Unmute ADC0 and set the default input to mic-in |
| 14689 | */ |
| 14690 | /* port-A for surround (rear panel) */ |
| 14691 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14692 | /* port-B for mic-in (rear panel) with vref */ |
| 14693 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14694 | /* port-C for line-in (rear panel) */ |
| 14695 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14696 | /* port-D for Front */ |
| 14697 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14698 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14699 | /* port-E for HP out (front panel) */ |
| 14700 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 14701 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14702 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14703 | /* port-F for mic-in (front panel) with vref */ |
| 14704 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14705 | /* port-G for CLFE (rear panel) */ |
| 14706 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14707 | /* port-H for side (rear panel) */ |
| 14708 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14709 | /* CD-in */ |
| 14710 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14711 | /* route front mic to ADC1*/ |
| 14712 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14713 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14714 | /* Unmute DAC0~3 & spdif out*/ |
| 14715 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14716 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14717 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14718 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14719 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14720 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14721 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14722 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14723 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14724 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14725 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14727 | /* Unmute Stereo Mixer 15 */ |
| 14728 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14732 | |
| 14733 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14734 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14735 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14736 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14737 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14738 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14740 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14741 | /* hp used DAC 3 (Front) */ |
| 14742 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14743 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14744 | { } |
| 14745 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14746 | |
| 14747 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 14748 | /* |
| 14749 | * Unmute ADC0 and set the default input to mic-in |
| 14750 | */ |
| 14751 | /* port-A for surround (rear panel) */ |
| 14752 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14753 | /* port-B for mic-in (rear panel) with vref */ |
| 14754 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14755 | /* port-C for line-in (rear panel) */ |
| 14756 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14757 | /* port-D for Front */ |
| 14758 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14759 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14760 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14761 | /* this has to be set to VREF80 */ |
| 14762 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14763 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14764 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14765 | /* port-F for mic-in (front panel) with vref */ |
| 14766 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14767 | /* port-G for CLFE (rear panel) */ |
| 14768 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14769 | /* port-H for side (rear panel) */ |
| 14770 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14771 | /* CD-in */ |
| 14772 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14773 | /* route front mic to ADC1*/ |
| 14774 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14775 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14776 | /* Unmute DAC0~3 & spdif out*/ |
| 14777 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14778 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14779 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14780 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14781 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14782 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14783 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14784 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14785 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14786 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14787 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14788 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14789 | /* Unmute Stereo Mixer 15 */ |
| 14790 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14792 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14794 | |
| 14795 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14796 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14797 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14798 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14801 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14802 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14803 | /* hp used DAC 3 (Front) */ |
| 14804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14806 | { } |
| 14807 | }; |
| 14808 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14809 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 14810 | /* |
| 14811 | * Unmute ADC0 and set the default input to mic-in |
| 14812 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14813 | /* port-A for surround (rear panel) |
| 14814 | * according to codec#0 this is the HP jack |
| 14815 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14816 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 14817 | /* route front PCM to HP */ |
| 14818 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 14819 | /* port-B for mic-in (rear panel) with vref */ |
| 14820 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14821 | /* port-C for line-in (rear panel) */ |
| 14822 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14823 | /* port-D for Front */ |
| 14824 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14825 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14826 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14827 | /* this has to be set to VREF80 */ |
| 14828 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14829 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14830 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14831 | /* port-F for mic-in (front panel) with vref */ |
| 14832 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14833 | /* port-G for CLFE (rear panel) */ |
| 14834 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14835 | /* port-H for side (rear panel) */ |
| 14836 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14837 | /* CD-in */ |
| 14838 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14839 | /* route front mic to ADC1*/ |
| 14840 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14841 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14842 | /* Unmute DAC0~3 & spdif out*/ |
| 14843 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14844 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14845 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14846 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14847 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14848 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14849 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14850 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14851 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14852 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14853 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14854 | /* Unmute Stereo Mixer 15 */ |
| 14855 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14856 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14857 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14858 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14859 | |
| 14860 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14861 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14862 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14863 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14864 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14865 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14866 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14867 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14868 | /* hp used DAC 3 (Front) */ |
| 14869 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14870 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14871 | { } |
| 14872 | }; |
| 14873 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14874 | /* additional init verbs for ASUS laptops */ |
| 14875 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14876 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14877 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14878 | { } |
| 14879 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14880 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14881 | /* |
| 14882 | * generic initialization of ADC, input mixers and output mixers |
| 14883 | */ |
| 14884 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14885 | /* |
| 14886 | * Unmute ADC0 and set the default input to mic-in |
| 14887 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14888 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14889 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14890 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14891 | /* Unmute DAC0~3 & spdif out*/ |
| 14892 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14893 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14894 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14895 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14897 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14898 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14899 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14900 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14901 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14902 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14904 | /* Unmute Stereo Mixer 15 */ |
| 14905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14906 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14907 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14909 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14910 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14911 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14912 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14913 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14914 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14915 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14916 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14917 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14918 | |
| 14919 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14920 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14921 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14923 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14924 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14925 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14926 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14927 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14928 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14929 | |
| 14930 | { } |
| 14931 | }; |
| 14932 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14933 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14934 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14935 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14936 | { } |
| 14937 | }; |
| 14938 | |
| 14939 | /* toggle speaker-output according to the hp-jack state */ |
| 14940 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14941 | { |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 14942 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14943 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14944 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14945 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14946 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14947 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14948 | } |
| 14949 | |
| 14950 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14951 | unsigned int res) |
| 14952 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14953 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14954 | alc861_toshiba_automute(codec); |
| 14955 | } |
| 14956 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14957 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14958 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14959 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14960 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14961 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14962 | |
| 14963 | |
| 14964 | #define ALC861_DIGOUT_NID 0x07 |
| 14965 | |
| 14966 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14967 | { 8, NULL } |
| 14968 | }; |
| 14969 | |
| 14970 | static hda_nid_t alc861_dac_nids[4] = { |
| 14971 | /* front, surround, clfe, side */ |
| 14972 | 0x03, 0x06, 0x05, 0x04 |
| 14973 | }; |
| 14974 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14975 | static hda_nid_t alc660_dac_nids[3] = { |
| 14976 | /* front, clfe, surround */ |
| 14977 | 0x03, 0x05, 0x06 |
| 14978 | }; |
| 14979 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14980 | static hda_nid_t alc861_adc_nids[1] = { |
| 14981 | /* ADC0-2 */ |
| 14982 | 0x08, |
| 14983 | }; |
| 14984 | |
| 14985 | static struct hda_input_mux alc861_capture_source = { |
| 14986 | .num_items = 5, |
| 14987 | .items = { |
| 14988 | { "Mic", 0x0 }, |
| 14989 | { "Front Mic", 0x3 }, |
| 14990 | { "Line", 0x1 }, |
| 14991 | { "CD", 0x4 }, |
| 14992 | { "Mixer", 0x5 }, |
| 14993 | }, |
| 14994 | }; |
| 14995 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14996 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14997 | { |
| 14998 | struct alc_spec *spec = codec->spec; |
| 14999 | hda_nid_t mix, srcs[5]; |
| 15000 | int i, j, num; |
| 15001 | |
| 15002 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 15003 | return 0; |
| 15004 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15005 | if (num < 0) |
| 15006 | return 0; |
| 15007 | for (i = 0; i < num; i++) { |
| 15008 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 15009 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15010 | if (type != AC_WID_AUD_OUT) |
| 15011 | continue; |
| 15012 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 15013 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 15014 | break; |
| 15015 | if (j >= spec->multiout.num_dacs) |
| 15016 | return srcs[i]; |
| 15017 | } |
| 15018 | return 0; |
| 15019 | } |
| 15020 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15021 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15022 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15023 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15024 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15025 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15026 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15027 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15028 | |
| 15029 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 15030 | for (i = 0; i < cfg->line_outs; i++) { |
| 15031 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15032 | dac = alc861_look_for_dac(codec, nid); |
| 15033 | if (!dac) |
| 15034 | continue; |
| 15035 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15036 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15037 | return 0; |
| 15038 | } |
| 15039 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15040 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 15041 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15042 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 15043 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15044 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 15045 | } |
| 15046 | |
| 15047 | /* add playback controls from the parsed DAC table */ |
| 15048 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 15049 | const struct auto_pin_cfg *cfg) |
| 15050 | { |
| 15051 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15052 | static const char *chname[4] = { |
| 15053 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 15054 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15055 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15056 | int i, err; |
| 15057 | |
| 15058 | if (cfg->line_outs == 1) { |
| 15059 | const char *pfx = NULL; |
| 15060 | if (!cfg->hp_outs) |
| 15061 | pfx = "Master"; |
| 15062 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15063 | pfx = "Speaker"; |
| 15064 | if (pfx) { |
| 15065 | nid = spec->multiout.dac_nids[0]; |
| 15066 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 15067 | } |
| 15068 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15069 | |
| 15070 | for (i = 0; i < cfg->line_outs; i++) { |
| 15071 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15072 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15073 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15074 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15075 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15076 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15077 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15078 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15079 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15080 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15081 | return err; |
| 15082 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15083 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15084 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15085 | return err; |
| 15086 | } |
| 15087 | } |
| 15088 | return 0; |
| 15089 | } |
| 15090 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15091 | 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] | 15092 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15093 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15094 | int err; |
| 15095 | hda_nid_t nid; |
| 15096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15097 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15098 | return 0; |
| 15099 | |
| 15100 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15101 | nid = alc861_look_for_dac(codec, pin); |
| 15102 | if (nid) { |
| 15103 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 15104 | if (err < 0) |
| 15105 | return err; |
| 15106 | spec->multiout.hp_nid = nid; |
| 15107 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15108 | } |
| 15109 | return 0; |
| 15110 | } |
| 15111 | |
| 15112 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15113 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15114 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15115 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15116 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15117 | } |
| 15118 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15119 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15120 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15121 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15122 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15123 | hda_nid_t mix, srcs[5]; |
| 15124 | int i, num; |
| 15125 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 15126 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 15127 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15128 | 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] | 15129 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15130 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 15131 | return; |
| 15132 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 15133 | if (num < 0) |
| 15134 | return; |
| 15135 | for (i = 0; i < num; i++) { |
| 15136 | unsigned int mute; |
| 15137 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 15138 | mute = AMP_IN_UNMUTE(i); |
| 15139 | else |
| 15140 | mute = AMP_IN_MUTE(i); |
| 15141 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 15142 | mute); |
| 15143 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15144 | } |
| 15145 | |
| 15146 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 15147 | { |
| 15148 | struct alc_spec *spec = codec->spec; |
| 15149 | int i; |
| 15150 | |
| 15151 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 15152 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15153 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15154 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15155 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15156 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15157 | } |
| 15158 | } |
| 15159 | |
| 15160 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 15161 | { |
| 15162 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15163 | |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15164 | if (spec->autocfg.hp_outs) |
| 15165 | alc861_auto_set_output_and_unmute(codec, |
| 15166 | spec->autocfg.hp_pins[0], |
| 15167 | PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15168 | spec->multiout.hp_nid); |
Takashi Iwai | 15870f0 | 2009-10-05 08:25:13 +0200 | [diff] [blame] | 15169 | if (spec->autocfg.speaker_outs) |
| 15170 | alc861_auto_set_output_and_unmute(codec, |
| 15171 | spec->autocfg.speaker_pins[0], |
| 15172 | PIN_OUT, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15173 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15174 | } |
| 15175 | |
| 15176 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 15177 | { |
| 15178 | struct alc_spec *spec = codec->spec; |
| 15179 | int i; |
| 15180 | |
| 15181 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15182 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15183 | if (nid >= 0x0c && nid <= 0x11) |
| 15184 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15185 | } |
| 15186 | } |
| 15187 | |
| 15188 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15189 | /* return 1 if successful, 0 if the proper config is not found, |
| 15190 | * or a negative error code |
| 15191 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15192 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 15193 | { |
| 15194 | struct alc_spec *spec = codec->spec; |
| 15195 | int err; |
| 15196 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 15197 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15198 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15199 | alc861_ignore); |
| 15200 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15201 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15202 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15203 | return 0; /* can't find valid BIOS pin config */ |
| 15204 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15205 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15206 | if (err < 0) |
| 15207 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15208 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15209 | if (err < 0) |
| 15210 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 15211 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15212 | if (err < 0) |
| 15213 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15214 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15215 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15216 | return err; |
| 15217 | |
| 15218 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15219 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15220 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15221 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 15222 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15223 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15224 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15225 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15226 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15227 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 15228 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15229 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15230 | |
| 15231 | spec->adc_nids = alc861_adc_nids; |
| 15232 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15233 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15234 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 15235 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15237 | return 1; |
| 15238 | } |
| 15239 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15240 | /* additional initialization for auto-configuration model */ |
| 15241 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15242 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15243 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15244 | alc861_auto_init_multi_out(codec); |
| 15245 | alc861_auto_init_hp_out(codec); |
| 15246 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15247 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15248 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15249 | } |
| 15250 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15251 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15252 | static struct hda_amp_list alc861_loopbacks[] = { |
| 15253 | { 0x15, HDA_INPUT, 0 }, |
| 15254 | { 0x15, HDA_INPUT, 1 }, |
| 15255 | { 0x15, HDA_INPUT, 2 }, |
| 15256 | { 0x15, HDA_INPUT, 3 }, |
| 15257 | { } /* end */ |
| 15258 | }; |
| 15259 | #endif |
| 15260 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15261 | |
| 15262 | /* |
| 15263 | * configuration and preset |
| 15264 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15265 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 15266 | [ALC861_3ST] = "3stack", |
| 15267 | [ALC660_3ST] = "3stack-660", |
| 15268 | [ALC861_3ST_DIG] = "3stack-dig", |
| 15269 | [ALC861_6ST_DIG] = "6stack-dig", |
| 15270 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 15271 | [ALC861_TOSHIBA] = "toshiba", |
| 15272 | [ALC861_ASUS] = "asus", |
| 15273 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 15274 | [ALC861_AUTO] = "auto", |
| 15275 | }; |
| 15276 | |
| 15277 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 15278 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15279 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15280 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 15281 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15282 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 15283 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 15284 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 15285 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 15286 | * Any other models that need this preset? |
| 15287 | */ |
| 15288 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 15289 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 15290 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15291 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 15292 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 15293 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 15294 | /* FIXME: the below seems conflict */ |
| 15295 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 15296 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 15297 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15298 | {} |
| 15299 | }; |
| 15300 | |
| 15301 | static struct alc_config_preset alc861_presets[] = { |
| 15302 | [ALC861_3ST] = { |
| 15303 | .mixers = { alc861_3ST_mixer }, |
| 15304 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15305 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15306 | .dac_nids = alc861_dac_nids, |
| 15307 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15308 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15309 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15310 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15311 | .adc_nids = alc861_adc_nids, |
| 15312 | .input_mux = &alc861_capture_source, |
| 15313 | }, |
| 15314 | [ALC861_3ST_DIG] = { |
| 15315 | .mixers = { alc861_base_mixer }, |
| 15316 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15317 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15318 | .dac_nids = alc861_dac_nids, |
| 15319 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15320 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15321 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15322 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15323 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15324 | .adc_nids = alc861_adc_nids, |
| 15325 | .input_mux = &alc861_capture_source, |
| 15326 | }, |
| 15327 | [ALC861_6ST_DIG] = { |
| 15328 | .mixers = { alc861_base_mixer }, |
| 15329 | .init_verbs = { alc861_base_init_verbs }, |
| 15330 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15331 | .dac_nids = alc861_dac_nids, |
| 15332 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15333 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 15334 | .channel_mode = alc861_8ch_modes, |
| 15335 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15336 | .adc_nids = alc861_adc_nids, |
| 15337 | .input_mux = &alc861_capture_source, |
| 15338 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15339 | [ALC660_3ST] = { |
| 15340 | .mixers = { alc861_3ST_mixer }, |
| 15341 | .init_verbs = { alc861_threestack_init_verbs }, |
| 15342 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 15343 | .dac_nids = alc660_dac_nids, |
| 15344 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 15345 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 15346 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15347 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15348 | .adc_nids = alc861_adc_nids, |
| 15349 | .input_mux = &alc861_capture_source, |
| 15350 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 15351 | [ALC861_UNIWILL_M31] = { |
| 15352 | .mixers = { alc861_uniwill_m31_mixer }, |
| 15353 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 15354 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15355 | .dac_nids = alc861_dac_nids, |
| 15356 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15357 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 15358 | .channel_mode = alc861_uniwill_m31_modes, |
| 15359 | .need_dac_fix = 1, |
| 15360 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15361 | .adc_nids = alc861_adc_nids, |
| 15362 | .input_mux = &alc861_capture_source, |
| 15363 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15364 | [ALC861_TOSHIBA] = { |
| 15365 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15366 | .init_verbs = { alc861_base_init_verbs, |
| 15367 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 15368 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15369 | .dac_nids = alc861_dac_nids, |
| 15370 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15371 | .channel_mode = alc883_3ST_2ch_modes, |
| 15372 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15373 | .adc_nids = alc861_adc_nids, |
| 15374 | .input_mux = &alc861_capture_source, |
| 15375 | .unsol_event = alc861_toshiba_unsol_event, |
| 15376 | .init_hook = alc861_toshiba_automute, |
| 15377 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 15378 | [ALC861_ASUS] = { |
| 15379 | .mixers = { alc861_asus_mixer }, |
| 15380 | .init_verbs = { alc861_asus_init_verbs }, |
| 15381 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15382 | .dac_nids = alc861_dac_nids, |
| 15383 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15384 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 15385 | .channel_mode = alc861_asus_modes, |
| 15386 | .need_dac_fix = 1, |
| 15387 | .hp_nid = 0x06, |
| 15388 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15389 | .adc_nids = alc861_adc_nids, |
| 15390 | .input_mux = &alc861_capture_source, |
| 15391 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 15392 | [ALC861_ASUS_LAPTOP] = { |
| 15393 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 15394 | .init_verbs = { alc861_asus_init_verbs, |
| 15395 | alc861_asus_laptop_init_verbs }, |
| 15396 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 15397 | .dac_nids = alc861_dac_nids, |
| 15398 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 15399 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 15400 | .channel_mode = alc883_3ST_2ch_modes, |
| 15401 | .need_dac_fix = 1, |
| 15402 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 15403 | .adc_nids = alc861_adc_nids, |
| 15404 | .input_mux = &alc861_capture_source, |
| 15405 | }, |
| 15406 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15407 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15408 | /* Pin config fixes */ |
| 15409 | enum { |
| 15410 | PINFIX_FSC_AMILO_PI1505, |
| 15411 | }; |
| 15412 | |
| 15413 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { |
| 15414 | { 0x0b, 0x0221101f }, /* HP */ |
| 15415 | { 0x0f, 0x90170310 }, /* speaker */ |
| 15416 | { } |
| 15417 | }; |
| 15418 | |
| 15419 | static const struct alc_fixup alc861_fixups[] = { |
| 15420 | [PINFIX_FSC_AMILO_PI1505] = { |
| 15421 | .pins = alc861_fsc_amilo_pi1505_pinfix |
| 15422 | }, |
| 15423 | }; |
| 15424 | |
| 15425 | static struct snd_pci_quirk alc861_fixup_tbl[] = { |
| 15426 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), |
| 15427 | {} |
| 15428 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15429 | |
| 15430 | static int patch_alc861(struct hda_codec *codec) |
| 15431 | { |
| 15432 | struct alc_spec *spec; |
| 15433 | int board_config; |
| 15434 | int err; |
| 15435 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 15436 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15437 | if (spec == NULL) |
| 15438 | return -ENOMEM; |
| 15439 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15440 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15441 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15442 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 15443 | alc861_models, |
| 15444 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15445 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 15446 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15447 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15448 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15449 | board_config = ALC861_AUTO; |
| 15450 | } |
| 15451 | |
Takashi Iwai | cfc9b06 | 2009-12-01 12:19:37 +0100 | [diff] [blame] | 15452 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); |
| 15453 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15454 | if (board_config == ALC861_AUTO) { |
| 15455 | /* automatic parse from the BIOS config */ |
| 15456 | err = alc861_parse_auto_config(codec); |
| 15457 | if (err < 0) { |
| 15458 | alc_free(codec); |
| 15459 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15460 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 15461 | printk(KERN_INFO |
| 15462 | "hda_codec: Cannot set up configuration " |
| 15463 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15464 | board_config = ALC861_3ST_DIG; |
| 15465 | } |
| 15466 | } |
| 15467 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15468 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15469 | if (err < 0) { |
| 15470 | alc_free(codec); |
| 15471 | return err; |
| 15472 | } |
| 15473 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15474 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15475 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15476 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15477 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 15478 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 15479 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15480 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 15481 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 15482 | |
Takashi Iwai | c7a8eb1 | 2010-01-14 12:39:02 +0100 | [diff] [blame] | 15483 | if (!spec->cap_mixer) |
| 15484 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15485 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 15486 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15487 | spec->vmaster_nid = 0x03; |
| 15488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15489 | codec->patch_ops = alc_patch_ops; |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15490 | if (board_config == ALC861_AUTO) { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 15491 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15492 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 15493 | spec->power_hook = alc_power_eapd; |
| 15494 | #endif |
| 15495 | } |
| 15496 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15497 | if (!spec->loopback.amplist) |
| 15498 | spec->loopback.amplist = alc861_loopbacks; |
| 15499 | #endif |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15500 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 15501 | return 0; |
| 15502 | } |
| 15503 | |
| 15504 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15505 | * ALC861-VD support |
| 15506 | * |
| 15507 | * Based on ALC882 |
| 15508 | * |
| 15509 | * In addition, an independent DAC |
| 15510 | */ |
| 15511 | #define ALC861VD_DIGOUT_NID 0x06 |
| 15512 | |
| 15513 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 15514 | /* front, surr, clfe, side surr */ |
| 15515 | 0x02, 0x03, 0x04, 0x05 |
| 15516 | }; |
| 15517 | |
| 15518 | /* dac_nids for ALC660vd are in a different order - according to |
| 15519 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15520 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15521 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 15522 | * - and it is the same as in 861vd. |
| 15523 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 15524 | */ |
| 15525 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 15526 | /* front, rear, clfe, rear_surr */ |
| 15527 | 0x02, 0x04, 0x03 |
| 15528 | }; |
| 15529 | |
| 15530 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 15531 | /* ADC0 */ |
| 15532 | 0x09, |
| 15533 | }; |
| 15534 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15535 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 15536 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15537 | /* input MUX */ |
| 15538 | /* FIXME: should be a matrix-type input source selection */ |
| 15539 | static struct hda_input_mux alc861vd_capture_source = { |
| 15540 | .num_items = 4, |
| 15541 | .items = { |
| 15542 | { "Mic", 0x0 }, |
| 15543 | { "Front Mic", 0x1 }, |
| 15544 | { "Line", 0x2 }, |
| 15545 | { "CD", 0x4 }, |
| 15546 | }, |
| 15547 | }; |
| 15548 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15549 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15550 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15551 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15552 | { "Ext Mic", 0x0 }, |
| 15553 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15554 | }, |
| 15555 | }; |
| 15556 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15557 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 15558 | .num_items = 2, |
| 15559 | .items = { |
| 15560 | { "Front Mic", 0x0 }, |
| 15561 | { "ATAPI Mic", 0x1 }, |
| 15562 | }, |
| 15563 | }; |
| 15564 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15565 | /* |
| 15566 | * 2ch mode |
| 15567 | */ |
| 15568 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 15569 | { 2, NULL } |
| 15570 | }; |
| 15571 | |
| 15572 | /* |
| 15573 | * 6ch mode |
| 15574 | */ |
| 15575 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 15576 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15577 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15578 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15579 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15580 | { } /* end */ |
| 15581 | }; |
| 15582 | |
| 15583 | /* |
| 15584 | * 8ch mode |
| 15585 | */ |
| 15586 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 15587 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15588 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15589 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15590 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15591 | { } /* end */ |
| 15592 | }; |
| 15593 | |
| 15594 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 15595 | { 6, alc861vd_6stack_ch6_init }, |
| 15596 | { 8, alc861vd_6stack_ch8_init }, |
| 15597 | }; |
| 15598 | |
| 15599 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 15600 | { |
| 15601 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15602 | .name = "Channel Mode", |
| 15603 | .info = alc_ch_mode_info, |
| 15604 | .get = alc_ch_mode_get, |
| 15605 | .put = alc_ch_mode_put, |
| 15606 | }, |
| 15607 | { } /* end */ |
| 15608 | }; |
| 15609 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15610 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15611 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15612 | */ |
| 15613 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 15614 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15615 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15616 | |
| 15617 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15618 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15619 | |
| 15620 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 15621 | HDA_OUTPUT), |
| 15622 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 15623 | HDA_OUTPUT), |
| 15624 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 15625 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 15626 | |
| 15627 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 15628 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 15629 | |
| 15630 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15631 | |
| 15632 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15634 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15635 | |
| 15636 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15637 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15638 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15639 | |
| 15640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15642 | |
| 15643 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15644 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15645 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15646 | { } /* end */ |
| 15647 | }; |
| 15648 | |
| 15649 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 15650 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15651 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15652 | |
| 15653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15654 | |
| 15655 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15656 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15658 | |
| 15659 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15660 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15661 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15662 | |
| 15663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15665 | |
| 15666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15668 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15669 | { } /* end */ |
| 15670 | }; |
| 15671 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15672 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 15673 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15674 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 15675 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15676 | |
| 15677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15678 | |
| 15679 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 15680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15682 | |
| 15683 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 15684 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15685 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15686 | |
| 15687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15689 | |
| 15690 | { } /* end */ |
| 15691 | }; |
| 15692 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15693 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 15694 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15695 | */ |
| 15696 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15697 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15698 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15699 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15700 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15701 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 15702 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15703 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15704 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 15705 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15706 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15707 | { } /* end */ |
| 15708 | }; |
| 15709 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15710 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 15711 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 15712 | */ |
| 15713 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 15714 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15715 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15716 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15717 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 15718 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15719 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15720 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15721 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15722 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15723 | { } /* end */ |
| 15724 | }; |
| 15725 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15726 | /* |
| 15727 | * generic initialization of ADC, input mixers and output mixers |
| 15728 | */ |
| 15729 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 15730 | /* |
| 15731 | * Unmute ADC0 and set the default input to mic-in |
| 15732 | */ |
| 15733 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15734 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15735 | |
| 15736 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 15737 | * the analog-loopback mixer widget |
| 15738 | */ |
| 15739 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15745 | |
| 15746 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15747 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15748 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15749 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15750 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15751 | |
| 15752 | /* |
| 15753 | * Set up output mixers (0x02 - 0x05) |
| 15754 | */ |
| 15755 | /* set vol=0 to output mixers */ |
| 15756 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15757 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15758 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15759 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15760 | |
| 15761 | /* set up input amps for analog loopback */ |
| 15762 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 15763 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15764 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15765 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15766 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15767 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15768 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15769 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15770 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15771 | |
| 15772 | { } |
| 15773 | }; |
| 15774 | |
| 15775 | /* |
| 15776 | * 3-stack pin configuration: |
| 15777 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 15778 | */ |
| 15779 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 15780 | /* |
| 15781 | * Set pin mode and muting |
| 15782 | */ |
| 15783 | /* set front pin widgets 0x14 for output */ |
| 15784 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15785 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15786 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15787 | |
| 15788 | /* Mic (rear) pin: input vref at 80% */ |
| 15789 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15790 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15791 | /* Front Mic pin: input vref at 80% */ |
| 15792 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15793 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15794 | /* Line In pin: input */ |
| 15795 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15796 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15797 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15798 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15799 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15800 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15801 | /* CD pin widget for input */ |
| 15802 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15803 | |
| 15804 | { } |
| 15805 | }; |
| 15806 | |
| 15807 | /* |
| 15808 | * 6-stack pin configuration: |
| 15809 | */ |
| 15810 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 15811 | /* |
| 15812 | * Set pin mode and muting |
| 15813 | */ |
| 15814 | /* set front pin widgets 0x14 for output */ |
| 15815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15816 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15817 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15818 | |
| 15819 | /* Rear Pin: output 1 (0x0d) */ |
| 15820 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15821 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15822 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 15823 | /* CLFE Pin: output 2 (0x0e) */ |
| 15824 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15825 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15826 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 15827 | /* Side Pin: output 3 (0x0f) */ |
| 15828 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15829 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15830 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 15831 | |
| 15832 | /* Mic (rear) pin: input vref at 80% */ |
| 15833 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15835 | /* Front Mic pin: input vref at 80% */ |
| 15836 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15837 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15838 | /* Line In pin: input */ |
| 15839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15840 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15841 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15842 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15843 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15844 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15845 | /* CD pin widget for input */ |
| 15846 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15847 | |
| 15848 | { } |
| 15849 | }; |
| 15850 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15851 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15852 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15853 | { } |
| 15854 | }; |
| 15855 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15856 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15857 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15858 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15859 | { } |
| 15860 | }; |
| 15861 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15862 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15863 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15864 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15865 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15866 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15868 | {} |
| 15869 | }; |
| 15870 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15871 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15872 | { |
| 15873 | unsigned int present; |
| 15874 | unsigned char bits; |
| 15875 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15876 | present = snd_hda_jack_detect(codec, 0x18); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15877 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 15878 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15879 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15880 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15881 | } |
| 15882 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15883 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15884 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15885 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15886 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15887 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15888 | } |
| 15889 | |
| 15890 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15891 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15892 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15893 | alc861vd_lenovo_mic_automute(codec); |
| 15894 | } |
| 15895 | |
| 15896 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15897 | unsigned int res) |
| 15898 | { |
| 15899 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15900 | case ALC880_MIC_EVENT: |
| 15901 | alc861vd_lenovo_mic_automute(codec); |
| 15902 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15903 | default: |
| 15904 | alc_automute_amp_unsol_event(codec, res); |
| 15905 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15906 | } |
| 15907 | } |
| 15908 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15909 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15910 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15911 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15912 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15913 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15914 | |
| 15915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15917 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15920 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15921 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15922 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15923 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15925 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15926 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15927 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15928 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15929 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15930 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15931 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15932 | |
| 15933 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15934 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15935 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15936 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15937 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15939 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15940 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15941 | |
| 15942 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15943 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15944 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15945 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15946 | |
| 15947 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15948 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15949 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15950 | |
| 15951 | { } /* end */ |
| 15952 | }; |
| 15953 | |
| 15954 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15955 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15956 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15957 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15958 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15959 | spec->autocfg.hp_pins[0] = 0x15; |
| 15960 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15961 | } |
| 15962 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15963 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15964 | #define alc861vd_loopbacks alc880_loopbacks |
| 15965 | #endif |
| 15966 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15967 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15968 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15969 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15970 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15971 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15972 | |
| 15973 | /* |
| 15974 | * configuration and preset |
| 15975 | */ |
| 15976 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15977 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15978 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15979 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15980 | [ALC861VD_3ST] = "3stack", |
| 15981 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15982 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15983 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15984 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15985 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15986 | [ALC861VD_AUTO] = "auto", |
| 15987 | }; |
| 15988 | |
| 15989 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15990 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15991 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15992 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 15993 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15994 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15995 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15996 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15997 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15998 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15999 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 16000 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 16001 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 16002 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16003 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 16004 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16005 | {} |
| 16006 | }; |
| 16007 | |
| 16008 | static struct alc_config_preset alc861vd_presets[] = { |
| 16009 | [ALC660VD_3ST] = { |
| 16010 | .mixers = { alc861vd_3st_mixer }, |
| 16011 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16012 | alc861vd_3stack_init_verbs }, |
| 16013 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16014 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16015 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16016 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16017 | .input_mux = &alc861vd_capture_source, |
| 16018 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16019 | [ALC660VD_3ST_DIG] = { |
| 16020 | .mixers = { alc861vd_3st_mixer }, |
| 16021 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16022 | alc861vd_3stack_init_verbs }, |
| 16023 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16024 | .dac_nids = alc660vd_dac_nids, |
| 16025 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 16026 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16027 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16028 | .input_mux = &alc861vd_capture_source, |
| 16029 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16030 | [ALC861VD_3ST] = { |
| 16031 | .mixers = { alc861vd_3st_mixer }, |
| 16032 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16033 | alc861vd_3stack_init_verbs }, |
| 16034 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16035 | .dac_nids = alc861vd_dac_nids, |
| 16036 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16037 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16038 | .input_mux = &alc861vd_capture_source, |
| 16039 | }, |
| 16040 | [ALC861VD_3ST_DIG] = { |
| 16041 | .mixers = { alc861vd_3st_mixer }, |
| 16042 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16043 | alc861vd_3stack_init_verbs }, |
| 16044 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16045 | .dac_nids = alc861vd_dac_nids, |
| 16046 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16047 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16048 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16049 | .input_mux = &alc861vd_capture_source, |
| 16050 | }, |
| 16051 | [ALC861VD_6ST_DIG] = { |
| 16052 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 16053 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16054 | alc861vd_6stack_init_verbs }, |
| 16055 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16056 | .dac_nids = alc861vd_dac_nids, |
| 16057 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16058 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 16059 | .channel_mode = alc861vd_6stack_modes, |
| 16060 | .input_mux = &alc861vd_capture_source, |
| 16061 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16062 | [ALC861VD_LENOVO] = { |
| 16063 | .mixers = { alc861vd_lenovo_mixer }, |
| 16064 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16065 | alc861vd_3stack_init_verbs, |
| 16066 | alc861vd_eapd_verbs, |
| 16067 | alc861vd_lenovo_unsol_verbs }, |
| 16068 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16069 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16070 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16071 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16072 | .input_mux = &alc861vd_capture_source, |
| 16073 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16074 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16075 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16076 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16077 | [ALC861VD_DALLAS] = { |
| 16078 | .mixers = { alc861vd_dallas_mixer }, |
| 16079 | .init_verbs = { alc861vd_dallas_verbs }, |
| 16080 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16081 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 16082 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16083 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16084 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16085 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16086 | .setup = alc861vd_dallas_setup, |
| 16087 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16088 | }, |
| 16089 | [ALC861VD_HP] = { |
| 16090 | .mixers = { alc861vd_hp_mixer }, |
| 16091 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 16092 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 16093 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16094 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16095 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16096 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16097 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16098 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16099 | .setup = alc861vd_dallas_setup, |
| 16100 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16101 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16102 | [ALC660VD_ASUS_V1S] = { |
| 16103 | .mixers = { alc861vd_lenovo_mixer }, |
| 16104 | .init_verbs = { alc861vd_volume_init_verbs, |
| 16105 | alc861vd_3stack_init_verbs, |
| 16106 | alc861vd_eapd_verbs, |
| 16107 | alc861vd_lenovo_unsol_verbs }, |
| 16108 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 16109 | .dac_nids = alc660vd_dac_nids, |
| 16110 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 16111 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 16112 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 16113 | .input_mux = &alc861vd_capture_source, |
| 16114 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16115 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 16116 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 16117 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16118 | }; |
| 16119 | |
| 16120 | /* |
| 16121 | * BIOS auto configuration |
| 16122 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16123 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 16124 | const struct auto_pin_cfg *cfg) |
| 16125 | { |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16126 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16127 | } |
| 16128 | |
| 16129 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16130 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 16131 | hda_nid_t nid, int pin_type, int dac_idx) |
| 16132 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16133 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16134 | } |
| 16135 | |
| 16136 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 16137 | { |
| 16138 | struct alc_spec *spec = codec->spec; |
| 16139 | int i; |
| 16140 | |
| 16141 | for (i = 0; i <= HDA_SIDE; i++) { |
| 16142 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16143 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16144 | if (nid) |
| 16145 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 16146 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16147 | } |
| 16148 | } |
| 16149 | |
| 16150 | |
| 16151 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 16152 | { |
| 16153 | struct alc_spec *spec = codec->spec; |
| 16154 | hda_nid_t pin; |
| 16155 | |
| 16156 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16157 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16158 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16159 | pin = spec->autocfg.speaker_pins[0]; |
| 16160 | if (pin) |
| 16161 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16162 | } |
| 16163 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16164 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 16165 | |
| 16166 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 16167 | { |
| 16168 | struct alc_spec *spec = codec->spec; |
| 16169 | int i; |
| 16170 | |
| 16171 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 16172 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16173 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 16174 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 16175 | if (nid != ALC861VD_PIN_CD_NID && |
| 16176 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16177 | snd_hda_codec_write(codec, nid, 0, |
| 16178 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 16179 | AMP_OUT_MUTE); |
| 16180 | } |
| 16181 | } |
| 16182 | } |
| 16183 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16184 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 16185 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16186 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 16187 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 16188 | |
| 16189 | /* add playback controls from the parsed DAC table */ |
| 16190 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16191 | * different NIDs for mute/unmute switch and volume control */ |
| 16192 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16193 | const struct auto_pin_cfg *cfg) |
| 16194 | { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16195 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 16196 | hda_nid_t nid_v, nid_s; |
| 16197 | int i, err; |
| 16198 | |
| 16199 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16200 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16201 | continue; |
| 16202 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16203 | alc880_dac_to_idx( |
| 16204 | spec->multiout.dac_nids[i])); |
| 16205 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16206 | alc880_dac_to_idx( |
| 16207 | spec->multiout.dac_nids[i])); |
| 16208 | |
| 16209 | if (i == 2) { |
| 16210 | /* Center/LFE */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16211 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16212 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16213 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 16214 | HDA_OUTPUT)); |
| 16215 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16216 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16217 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
| 16218 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16219 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 16220 | HDA_OUTPUT)); |
| 16221 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16222 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16223 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16224 | "Center", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16225 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 16226 | HDA_INPUT)); |
| 16227 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16228 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16229 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
| 16230 | "LFE", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16231 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 16232 | HDA_INPUT)); |
| 16233 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16234 | return err; |
| 16235 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16236 | const char *pfx; |
| 16237 | if (cfg->line_outs == 1 && |
| 16238 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 16239 | if (!cfg->hp_pins) |
| 16240 | pfx = "Speaker"; |
| 16241 | else |
| 16242 | pfx = "PCM"; |
| 16243 | } else |
| 16244 | pfx = chname[i]; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16245 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16246 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 16247 | HDA_OUTPUT)); |
| 16248 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16249 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 16250 | if (cfg->line_outs == 1 && |
| 16251 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 16252 | pfx = "Speaker"; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16253 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 16254 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16255 | HDA_INPUT)); |
| 16256 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16257 | return err; |
| 16258 | } |
| 16259 | } |
| 16260 | return 0; |
| 16261 | } |
| 16262 | |
| 16263 | /* add playback controls for speaker and HP outputs */ |
| 16264 | /* Based on ALC880 version. But ALC861VD has separate, |
| 16265 | * different NIDs for mute/unmute switch and volume control */ |
| 16266 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 16267 | hda_nid_t pin, const char *pfx) |
| 16268 | { |
| 16269 | hda_nid_t nid_v, nid_s; |
| 16270 | int err; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16271 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16272 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16273 | return 0; |
| 16274 | |
| 16275 | if (alc880_is_fixed_pin(pin)) { |
| 16276 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 16277 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16278 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16279 | spec->multiout.hp_nid = nid_v; |
| 16280 | else |
| 16281 | spec->multiout.extra_out_nid[0] = nid_v; |
| 16282 | /* control HP volume/switch on the output mixer amp */ |
| 16283 | nid_v = alc861vd_idx_to_mixer_vol( |
| 16284 | alc880_fixed_pin_idx(pin)); |
| 16285 | nid_s = alc861vd_idx_to_mixer_switch( |
| 16286 | alc880_fixed_pin_idx(pin)); |
| 16287 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16288 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16289 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 16290 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16291 | return err; |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16292 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16293 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 16294 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16295 | return err; |
| 16296 | } else if (alc880_is_multi_pin(pin)) { |
| 16297 | /* set manual connection */ |
| 16298 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 16299 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16300 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 16301 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16302 | return err; |
| 16303 | } |
| 16304 | return 0; |
| 16305 | } |
| 16306 | |
| 16307 | /* parse the BIOS configuration and set up the alc_spec |
| 16308 | * return 1 if successful, 0 if the proper config is not found, |
| 16309 | * or a negative error code |
| 16310 | * Based on ALC880 version - had to change it to override |
| 16311 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 16312 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 16313 | { |
| 16314 | struct alc_spec *spec = codec->spec; |
| 16315 | int err; |
| 16316 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 16317 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16318 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 16319 | alc861vd_ignore); |
| 16320 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16321 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16322 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16323 | return 0; /* can't find valid BIOS pin config */ |
| 16324 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16325 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 16326 | if (err < 0) |
| 16327 | return err; |
| 16328 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 16329 | if (err < 0) |
| 16330 | return err; |
| 16331 | err = alc861vd_auto_create_extra_out(spec, |
| 16332 | spec->autocfg.speaker_pins[0], |
| 16333 | "Speaker"); |
| 16334 | if (err < 0) |
| 16335 | return err; |
| 16336 | err = alc861vd_auto_create_extra_out(spec, |
| 16337 | spec->autocfg.hp_pins[0], |
| 16338 | "Headphone"); |
| 16339 | if (err < 0) |
| 16340 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 16341 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16342 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16343 | return err; |
| 16344 | |
| 16345 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 16346 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 16347 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16348 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 16349 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 16350 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16351 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16352 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16353 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16354 | |
| 16355 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 16356 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16357 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 16358 | err = alc_auto_add_mic_boost(codec); |
| 16359 | if (err < 0) |
| 16360 | return err; |
| 16361 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 16362 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 16363 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16364 | return 1; |
| 16365 | } |
| 16366 | |
| 16367 | /* additional initialization for auto-configuration model */ |
| 16368 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 16369 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16370 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16371 | alc861vd_auto_init_multi_out(codec); |
| 16372 | alc861vd_auto_init_hp_out(codec); |
| 16373 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 16374 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 16375 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 16376 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16377 | } |
| 16378 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16379 | enum { |
| 16380 | ALC660VD_FIX_ASUS_GPIO1 |
| 16381 | }; |
| 16382 | |
| 16383 | /* reset GPIO1 */ |
| 16384 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { |
| 16385 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 16386 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 16387 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 16388 | { } |
| 16389 | }; |
| 16390 | |
| 16391 | static const struct alc_fixup alc861vd_fixups[] = { |
| 16392 | [ALC660VD_FIX_ASUS_GPIO1] = { |
| 16393 | .verbs = alc660vd_fix_asus_gpio1_verbs, |
| 16394 | }, |
| 16395 | }; |
| 16396 | |
| 16397 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
| 16398 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
| 16399 | {} |
| 16400 | }; |
| 16401 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16402 | static int patch_alc861vd(struct hda_codec *codec) |
| 16403 | { |
| 16404 | struct alc_spec *spec; |
| 16405 | int err, board_config; |
| 16406 | |
| 16407 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 16408 | if (spec == NULL) |
| 16409 | return -ENOMEM; |
| 16410 | |
| 16411 | codec->spec = spec; |
| 16412 | |
| 16413 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 16414 | alc861vd_models, |
| 16415 | alc861vd_cfg_tbl); |
| 16416 | |
| 16417 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 16418 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 16419 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16420 | board_config = ALC861VD_AUTO; |
| 16421 | } |
| 16422 | |
Takashi Iwai | f8f25ba | 2009-10-06 08:31:29 +0200 | [diff] [blame] | 16423 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); |
| 16424 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16425 | if (board_config == ALC861VD_AUTO) { |
| 16426 | /* automatic parse from the BIOS config */ |
| 16427 | err = alc861vd_parse_auto_config(codec); |
| 16428 | if (err < 0) { |
| 16429 | alc_free(codec); |
| 16430 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16431 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16432 | printk(KERN_INFO |
| 16433 | "hda_codec: Cannot set up configuration " |
| 16434 | "from BIOS. Using base mode...\n"); |
| 16435 | board_config = ALC861VD_3ST; |
| 16436 | } |
| 16437 | } |
| 16438 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 16439 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 16440 | if (err < 0) { |
| 16441 | alc_free(codec); |
| 16442 | return err; |
| 16443 | } |
| 16444 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16445 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 16446 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16447 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16448 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 16449 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 16450 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 16451 | } |
| 16452 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16453 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 16454 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 16455 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16456 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 16457 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 16458 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 16459 | if (!spec->adc_nids) { |
| 16460 | spec->adc_nids = alc861vd_adc_nids; |
| 16461 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 16462 | } |
| 16463 | if (!spec->capsrc_nids) |
| 16464 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16465 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16466 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 16467 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16468 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 16469 | spec->vmaster_nid = 0x02; |
| 16470 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16471 | codec->patch_ops = alc_patch_ops; |
| 16472 | |
| 16473 | if (board_config == ALC861VD_AUTO) |
| 16474 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16475 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16476 | if (!spec->loopback.amplist) |
| 16477 | spec->loopback.amplist = alc861vd_loopbacks; |
| 16478 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 16479 | |
| 16480 | return 0; |
| 16481 | } |
| 16482 | |
| 16483 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16484 | * ALC662 support |
| 16485 | * |
| 16486 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 16487 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 16488 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 16489 | * 6-channel independent captures. |
| 16490 | * |
| 16491 | * In addition, an independent DAC for the multi-playback (not used in this |
| 16492 | * driver yet). |
| 16493 | */ |
| 16494 | #define ALC662_DIGOUT_NID 0x06 |
| 16495 | #define ALC662_DIGIN_NID 0x0a |
| 16496 | |
| 16497 | static hda_nid_t alc662_dac_nids[4] = { |
| 16498 | /* front, rear, clfe, rear_surr */ |
| 16499 | 0x02, 0x03, 0x04 |
| 16500 | }; |
| 16501 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16502 | static hda_nid_t alc272_dac_nids[2] = { |
| 16503 | 0x02, 0x03 |
| 16504 | }; |
| 16505 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16506 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16507 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16508 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16509 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16510 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16511 | static hda_nid_t alc272_adc_nids[1] = { |
| 16512 | /* ADC1-2 */ |
| 16513 | 0x08, |
| 16514 | }; |
| 16515 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 16516 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16517 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 16518 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 16519 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16520 | /* input MUX */ |
| 16521 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16522 | static struct hda_input_mux alc662_capture_source = { |
| 16523 | .num_items = 4, |
| 16524 | .items = { |
| 16525 | { "Mic", 0x0 }, |
| 16526 | { "Front Mic", 0x1 }, |
| 16527 | { "Line", 0x2 }, |
| 16528 | { "CD", 0x4 }, |
| 16529 | }, |
| 16530 | }; |
| 16531 | |
| 16532 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 16533 | .num_items = 2, |
| 16534 | .items = { |
| 16535 | { "Mic", 0x1 }, |
| 16536 | { "Line", 0x2 }, |
| 16537 | }, |
| 16538 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16539 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16540 | static struct hda_input_mux alc663_capture_source = { |
| 16541 | .num_items = 3, |
| 16542 | .items = { |
| 16543 | { "Mic", 0x0 }, |
| 16544 | { "Front Mic", 0x1 }, |
| 16545 | { "Line", 0x2 }, |
| 16546 | }, |
| 16547 | }; |
| 16548 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16549 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16550 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 16551 | .num_items = 16, |
| 16552 | .items = { |
| 16553 | { "Autoselect Mic", 0x0 }, |
| 16554 | { "Internal Mic", 0x1 }, |
| 16555 | { "In-0x02", 0x2 }, |
| 16556 | { "In-0x03", 0x3 }, |
| 16557 | { "In-0x04", 0x4 }, |
| 16558 | { "In-0x05", 0x5 }, |
| 16559 | { "In-0x06", 0x6 }, |
| 16560 | { "In-0x07", 0x7 }, |
| 16561 | { "In-0x08", 0x8 }, |
| 16562 | { "In-0x09", 0x9 }, |
| 16563 | { "In-0x0a", 0x0a }, |
| 16564 | { "In-0x0b", 0x0b }, |
| 16565 | { "In-0x0c", 0x0c }, |
| 16566 | { "In-0x0d", 0x0d }, |
| 16567 | { "In-0x0e", 0x0e }, |
| 16568 | { "In-0x0f", 0x0f }, |
| 16569 | }, |
| 16570 | }; |
| 16571 | #endif |
| 16572 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16573 | /* |
| 16574 | * 2ch mode |
| 16575 | */ |
| 16576 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 16577 | { 2, NULL } |
| 16578 | }; |
| 16579 | |
| 16580 | /* |
| 16581 | * 2ch mode |
| 16582 | */ |
| 16583 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 16584 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 16585 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16586 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 16587 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 16588 | { } /* end */ |
| 16589 | }; |
| 16590 | |
| 16591 | /* |
| 16592 | * 6ch mode |
| 16593 | */ |
| 16594 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 16595 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16596 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16597 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 16598 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16599 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 16600 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 16601 | { } /* end */ |
| 16602 | }; |
| 16603 | |
| 16604 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 16605 | { 2, alc662_3ST_ch2_init }, |
| 16606 | { 6, alc662_3ST_ch6_init }, |
| 16607 | }; |
| 16608 | |
| 16609 | /* |
| 16610 | * 2ch mode |
| 16611 | */ |
| 16612 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 16613 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16614 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 16615 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16616 | { } /* end */ |
| 16617 | }; |
| 16618 | |
| 16619 | /* |
| 16620 | * 6ch mode |
| 16621 | */ |
| 16622 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 16623 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16624 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16625 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 16626 | { } /* end */ |
| 16627 | }; |
| 16628 | |
| 16629 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 16630 | { 2, alc662_sixstack_ch6_init }, |
| 16631 | { 6, alc662_sixstack_ch8_init }, |
| 16632 | }; |
| 16633 | |
| 16634 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 16635 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 16636 | */ |
| 16637 | |
| 16638 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 16639 | /* output mixer control */ |
| 16640 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16641 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16642 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16643 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16644 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16645 | 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] | 16646 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16647 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16648 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16649 | |
| 16650 | /*Input mixer control */ |
| 16651 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 16652 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 16653 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 16654 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 16655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 16656 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 16657 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 16658 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16659 | { } /* end */ |
| 16660 | }; |
| 16661 | |
| 16662 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 16663 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16664 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16666 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16667 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16668 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16669 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16670 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16671 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16672 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16673 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16674 | { } /* end */ |
| 16675 | }; |
| 16676 | |
| 16677 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 16678 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16679 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16680 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 16681 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16682 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16683 | 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] | 16684 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 16685 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16686 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16687 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 16688 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 16689 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16690 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16691 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16692 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16693 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16694 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16695 | { } /* end */ |
| 16696 | }; |
| 16697 | |
| 16698 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 16699 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16700 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 16701 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16702 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16708 | { } /* end */ |
| 16709 | }; |
| 16710 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16711 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16712 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16713 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16714 | |
| 16715 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 16716 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16717 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16718 | |
| 16719 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16720 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16721 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16722 | { } /* end */ |
| 16723 | }; |
| 16724 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16725 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16726 | ALC262_HIPPO_MASTER_SWITCH, |
| 16727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16728 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16729 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 16730 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16731 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 16732 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16733 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16734 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16735 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16736 | { } /* end */ |
| 16737 | }; |
| 16738 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16739 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 16740 | .ops = &snd_hda_bind_vol, |
| 16741 | .values = { |
| 16742 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16743 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 16744 | 0 |
| 16745 | }, |
| 16746 | }; |
| 16747 | |
| 16748 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 16749 | .ops = &snd_hda_bind_sw, |
| 16750 | .values = { |
| 16751 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16752 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16753 | 0 |
| 16754 | }, |
| 16755 | }; |
| 16756 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16757 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16758 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16759 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 16760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16761 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16762 | { } /* end */ |
| 16763 | }; |
| 16764 | |
| 16765 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 16766 | .ops = &snd_hda_bind_sw, |
| 16767 | .values = { |
| 16768 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16769 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16770 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16771 | 0 |
| 16772 | }, |
| 16773 | }; |
| 16774 | |
| 16775 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 16776 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16777 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 16778 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16779 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16780 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16781 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16782 | |
| 16783 | { } /* end */ |
| 16784 | }; |
| 16785 | |
| 16786 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 16787 | .ops = &snd_hda_bind_sw, |
| 16788 | .values = { |
| 16789 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16790 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16791 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16792 | 0 |
| 16793 | }, |
| 16794 | }; |
| 16795 | |
| 16796 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 16797 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16798 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 16799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16801 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16802 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16803 | { } /* end */ |
| 16804 | }; |
| 16805 | |
| 16806 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16807 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16808 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16809 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16812 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16813 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16814 | { } /* end */ |
| 16815 | }; |
| 16816 | |
| 16817 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 16818 | .ops = &snd_hda_bind_vol, |
| 16819 | .values = { |
| 16820 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 16821 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 16822 | 0 |
| 16823 | }, |
| 16824 | }; |
| 16825 | |
| 16826 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 16827 | .ops = &snd_hda_bind_sw, |
| 16828 | .values = { |
| 16829 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16830 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 16831 | 0 |
| 16832 | }, |
| 16833 | }; |
| 16834 | |
| 16835 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 16836 | HDA_BIND_VOL("Master Playback Volume", |
| 16837 | &alc663_asus_two_bind_master_vol), |
| 16838 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16839 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16840 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16843 | { } /* end */ |
| 16844 | }; |
| 16845 | |
| 16846 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 16847 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 16848 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 16849 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16850 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16851 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16852 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16853 | { } /* end */ |
| 16854 | }; |
| 16855 | |
| 16856 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 16857 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16858 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16860 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16861 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16862 | |
| 16863 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16864 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16865 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16866 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16867 | { } /* end */ |
| 16868 | }; |
| 16869 | |
| 16870 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16871 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16872 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16874 | |
| 16875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16877 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16878 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16879 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16880 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16881 | { } /* end */ |
| 16882 | }; |
| 16883 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 16884 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { |
| 16885 | .ops = &snd_hda_bind_sw, |
| 16886 | .values = { |
| 16887 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16888 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 16889 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16890 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 16891 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 16892 | 0 |
| 16893 | }, |
| 16894 | }; |
| 16895 | |
| 16896 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { |
| 16897 | .ops = &snd_hda_bind_sw, |
| 16898 | .values = { |
| 16899 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 16900 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 16901 | 0 |
| 16902 | }, |
| 16903 | }; |
| 16904 | |
| 16905 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { |
| 16906 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16907 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16908 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16909 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 16910 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16911 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16912 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16913 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16914 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16915 | { } /* end */ |
| 16916 | }; |
| 16917 | |
| 16918 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { |
| 16919 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), |
| 16920 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), |
| 16921 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), |
| 16922 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 16923 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16924 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16925 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16926 | { } /* end */ |
| 16927 | }; |
| 16928 | |
| 16929 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16930 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16931 | { |
| 16932 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16933 | .name = "Channel Mode", |
| 16934 | .info = alc_ch_mode_info, |
| 16935 | .get = alc_ch_mode_get, |
| 16936 | .put = alc_ch_mode_put, |
| 16937 | }, |
| 16938 | { } /* end */ |
| 16939 | }; |
| 16940 | |
| 16941 | static struct hda_verb alc662_init_verbs[] = { |
| 16942 | /* ADC: mute amp left and right */ |
| 16943 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16944 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16945 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16946 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16948 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16949 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16950 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16952 | |
| 16953 | /* Front Pin: output 0 (0x0c) */ |
| 16954 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16955 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16956 | |
| 16957 | /* Rear Pin: output 1 (0x0d) */ |
| 16958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16959 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16960 | |
| 16961 | /* CLFE Pin: output 2 (0x0e) */ |
| 16962 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16963 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16964 | |
| 16965 | /* Mic (rear) pin: input vref at 80% */ |
| 16966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16967 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16968 | /* Front Mic pin: input vref at 80% */ |
| 16969 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16970 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16971 | /* Line In pin: input */ |
| 16972 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16973 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16974 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16975 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16976 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16977 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16978 | /* CD pin widget for input */ |
| 16979 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16980 | |
| 16981 | /* FIXME: use matrix-type input source selection */ |
| 16982 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16983 | /* Input mixer */ |
| 16984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16985 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16986 | |
| 16987 | /* always trun on EAPD */ |
| 16988 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16989 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16990 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16991 | { } |
| 16992 | }; |
| 16993 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 16994 | static struct hda_verb alc663_init_verbs[] = { |
| 16995 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16996 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16997 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16998 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16999 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17000 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17001 | { } |
| 17002 | }; |
| 17003 | |
| 17004 | static struct hda_verb alc272_init_verbs[] = { |
| 17005 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17006 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 17007 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17008 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17009 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17010 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17011 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 17012 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17013 | { } |
| 17014 | }; |
| 17015 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17016 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 17017 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17018 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17019 | {} |
| 17020 | }; |
| 17021 | |
| 17022 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 17023 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17024 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17025 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17026 | }; |
| 17027 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17028 | /* Set Unsolicited Event*/ |
| 17029 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 17030 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17031 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17032 | {} |
| 17033 | }; |
| 17034 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17035 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17036 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17037 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17038 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17039 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17040 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17041 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17042 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17043 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17044 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17045 | {} |
| 17046 | }; |
| 17047 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17048 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 17049 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17050 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17051 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17054 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17055 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17056 | {} |
| 17057 | }; |
| 17058 | |
| 17059 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 17060 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17061 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17062 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17063 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17066 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17068 | {} |
| 17069 | }; |
| 17070 | |
| 17071 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 17072 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17073 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17074 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17075 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17076 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17077 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17078 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17079 | {} |
| 17080 | }; |
| 17081 | |
| 17082 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 17083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17084 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17085 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17086 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17087 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17089 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 17090 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17092 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17093 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17095 | {} |
| 17096 | }; |
| 17097 | |
| 17098 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 17099 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17100 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17101 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17102 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17105 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17106 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 17108 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17109 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17110 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17111 | {} |
| 17112 | }; |
| 17113 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17114 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 17115 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17116 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 17117 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 17118 | |
| 17119 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17120 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17121 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17122 | |
| 17123 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 17124 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 17125 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 17126 | {} |
| 17127 | }; |
| 17128 | |
| 17129 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 17130 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17131 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17132 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 17133 | |
| 17134 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17135 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17136 | {} |
| 17137 | }; |
| 17138 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17139 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 17140 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 17141 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17142 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17143 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17144 | {} |
| 17145 | }; |
| 17146 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17147 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 17148 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17149 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17150 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17151 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17152 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17153 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17154 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17157 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17158 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17159 | {} |
| 17160 | }; |
| 17161 | |
| 17162 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 17163 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17164 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17165 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17166 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17167 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17168 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17169 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17170 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17171 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17172 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17173 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17174 | {} |
| 17175 | }; |
| 17176 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17177 | static struct hda_verb alc663_mode7_init_verbs[] = { |
| 17178 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17179 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17180 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17181 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17182 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17183 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17184 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17185 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17186 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17187 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17188 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17189 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17190 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17191 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17192 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17193 | {} |
| 17194 | }; |
| 17195 | |
| 17196 | static struct hda_verb alc663_mode8_init_verbs[] = { |
| 17197 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17198 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 17201 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17202 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 17203 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17204 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 17205 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 17206 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 17207 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 17208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 17209 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 17210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17211 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 17212 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 17213 | {} |
| 17214 | }; |
| 17215 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17216 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 17217 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 17218 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 17219 | { } /* end */ |
| 17220 | }; |
| 17221 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17222 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 17223 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 17224 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 17225 | { } /* end */ |
| 17226 | }; |
| 17227 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17228 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 17229 | { |
| 17230 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17231 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17232 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17233 | present = snd_hda_jack_detect(codec, 0x14); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17234 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17235 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17236 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17237 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17238 | } |
| 17239 | |
| 17240 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 17241 | { |
| 17242 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17243 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17244 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17245 | present = snd_hda_jack_detect(codec, 0x1b); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17246 | bits = present ? HDA_AMP_MUTE : 0; |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17247 | |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 17248 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17249 | HDA_AMP_MUTE, bits); |
| 17250 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17251 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17252 | } |
| 17253 | |
| 17254 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 17255 | unsigned int res) |
| 17256 | { |
| 17257 | if ((res >> 26) == ALC880_HP_EVENT) |
| 17258 | alc662_lenovo_101e_all_automute(codec); |
| 17259 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 17260 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 17261 | } |
| 17262 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17263 | /* unsolicited event for HP jack sensing */ |
| 17264 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 17265 | unsigned int res) |
| 17266 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17267 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17268 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17269 | else |
| 17270 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17271 | } |
| 17272 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17273 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17274 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17275 | struct alc_spec *spec = codec->spec; |
| 17276 | |
| 17277 | alc262_hippo1_setup(codec); |
| 17278 | spec->ext_mic.pin = 0x18; |
| 17279 | spec->ext_mic.mux_idx = 0; |
| 17280 | spec->int_mic.pin = 0x19; |
| 17281 | spec->int_mic.mux_idx = 1; |
| 17282 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17283 | } |
| 17284 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17285 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 17286 | { |
| 17287 | alc262_hippo_automute(codec); |
| 17288 | alc_mic_automute(codec); |
| 17289 | } |
| 17290 | |
| 17291 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17292 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17293 | struct alc_spec *spec = codec->spec; |
| 17294 | |
| 17295 | spec->autocfg.hp_pins[0] = 0x14; |
| 17296 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17297 | } |
| 17298 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17299 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 17300 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17301 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 17302 | { |
| 17303 | unsigned int present; |
| 17304 | unsigned char bits; |
| 17305 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17306 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17307 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17308 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17309 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17310 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17311 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17312 | } |
| 17313 | |
| 17314 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 17315 | { |
| 17316 | unsigned int present; |
| 17317 | unsigned char bits; |
| 17318 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17319 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17320 | bits = present ? HDA_AMP_MUTE : 0; |
| 17321 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17322 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17323 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17324 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17325 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17326 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17327 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17328 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17329 | } |
| 17330 | |
| 17331 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 17332 | { |
| 17333 | unsigned int present; |
| 17334 | unsigned char bits; |
| 17335 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17336 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17337 | bits = present ? HDA_AMP_MUTE : 0; |
| 17338 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17339 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17340 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17341 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17342 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17343 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17344 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17345 | HDA_AMP_MUTE, bits); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17346 | } |
| 17347 | |
| 17348 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 17349 | { |
| 17350 | unsigned int present; |
| 17351 | unsigned char bits; |
| 17352 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17353 | present = snd_hda_jack_detect(codec, 0x1b); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17354 | bits = present ? 0 : PIN_OUT; |
| 17355 | snd_hda_codec_write(codec, 0x14, 0, |
| 17356 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 17357 | } |
| 17358 | |
| 17359 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 17360 | { |
| 17361 | unsigned int present1, present2; |
| 17362 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17363 | present1 = snd_hda_jack_detect(codec, 0x21); |
| 17364 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17365 | |
| 17366 | if (present1 || present2) { |
| 17367 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17368 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17369 | } else { |
| 17370 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17371 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17372 | } |
| 17373 | } |
| 17374 | |
| 17375 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 17376 | { |
| 17377 | unsigned int present1, present2; |
| 17378 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17379 | present1 = snd_hda_jack_detect(codec, 0x1b); |
| 17380 | present2 = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17381 | |
| 17382 | if (present1 || present2) { |
| 17383 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17384 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17385 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17386 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17387 | } else { |
| 17388 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17389 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17390 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
Takashi Iwai | 5dbd5ec | 2010-03-29 09:16:24 +0200 | [diff] [blame] | 17391 | HDA_AMP_MUTE, 0); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17392 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17393 | } |
| 17394 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17395 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) |
| 17396 | { |
| 17397 | unsigned int present1, present2; |
| 17398 | |
| 17399 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 17400 | AC_VERB_GET_PIN_SENSE, 0) |
| 17401 | & AC_PINSENSE_PRESENCE; |
| 17402 | present2 = snd_hda_codec_read(codec, 0x21, 0, |
| 17403 | AC_VERB_GET_PIN_SENSE, 0) |
| 17404 | & AC_PINSENSE_PRESENCE; |
| 17405 | |
| 17406 | if (present1 || present2) { |
| 17407 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17408 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17409 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17410 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17411 | } else { |
| 17412 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17413 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17414 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17415 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17416 | } |
| 17417 | } |
| 17418 | |
| 17419 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) |
| 17420 | { |
| 17421 | unsigned int present1, present2; |
| 17422 | |
| 17423 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 17424 | AC_VERB_GET_PIN_SENSE, 0) |
| 17425 | & AC_PINSENSE_PRESENCE; |
| 17426 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 17427 | AC_VERB_GET_PIN_SENSE, 0) |
| 17428 | & AC_PINSENSE_PRESENCE; |
| 17429 | |
| 17430 | if (present1 || present2) { |
| 17431 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17432 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17433 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17434 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 17435 | } else { |
| 17436 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 17437 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17438 | snd_hda_codec_write_cache(codec, 0x17, 0, |
| 17439 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 17440 | } |
| 17441 | } |
| 17442 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17443 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 17444 | unsigned int res) |
| 17445 | { |
| 17446 | switch (res >> 26) { |
| 17447 | case ALC880_HP_EVENT: |
| 17448 | alc663_m51va_speaker_automute(codec); |
| 17449 | break; |
| 17450 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17451 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17452 | break; |
| 17453 | } |
| 17454 | } |
| 17455 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17456 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 17457 | { |
| 17458 | struct alc_spec *spec = codec->spec; |
| 17459 | spec->ext_mic.pin = 0x18; |
| 17460 | spec->ext_mic.mux_idx = 0; |
| 17461 | spec->int_mic.pin = 0x12; |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17462 | spec->int_mic.mux_idx = 9; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17463 | spec->auto_mic = 1; |
| 17464 | } |
| 17465 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17466 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 17467 | { |
| 17468 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17469 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17470 | } |
| 17471 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17472 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17473 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17474 | |
| 17475 | static void alc663_mode1_setup(struct hda_codec *codec) |
| 17476 | { |
| 17477 | struct alc_spec *spec = codec->spec; |
| 17478 | spec->ext_mic.pin = 0x18; |
| 17479 | spec->ext_mic.mux_idx = 0; |
| 17480 | spec->int_mic.pin = 0x19; |
| 17481 | spec->int_mic.mux_idx = 1; |
| 17482 | spec->auto_mic = 1; |
| 17483 | } |
| 17484 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17485 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17486 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17487 | /* ***************** Mode2 ******************************/ |
| 17488 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 17489 | unsigned int res) |
| 17490 | { |
| 17491 | switch (res >> 26) { |
| 17492 | case ALC880_HP_EVENT: |
| 17493 | alc662_f5z_speaker_automute(codec); |
| 17494 | break; |
| 17495 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17496 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17497 | break; |
| 17498 | } |
| 17499 | } |
| 17500 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17501 | #define alc662_mode2_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17502 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17503 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 17504 | { |
| 17505 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17506 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17507 | } |
| 17508 | /* ***************** Mode3 ******************************/ |
| 17509 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 17510 | unsigned int res) |
| 17511 | { |
| 17512 | switch (res >> 26) { |
| 17513 | case ALC880_HP_EVENT: |
| 17514 | alc663_two_hp_m1_speaker_automute(codec); |
| 17515 | break; |
| 17516 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17517 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17518 | break; |
| 17519 | } |
| 17520 | } |
| 17521 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17522 | #define alc663_mode3_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17523 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17524 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 17525 | { |
| 17526 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17527 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17528 | } |
| 17529 | /* ***************** Mode4 ******************************/ |
| 17530 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 17531 | unsigned int res) |
| 17532 | { |
| 17533 | switch (res >> 26) { |
| 17534 | case ALC880_HP_EVENT: |
| 17535 | alc663_21jd_two_speaker_automute(codec); |
| 17536 | break; |
| 17537 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17538 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17539 | break; |
| 17540 | } |
| 17541 | } |
| 17542 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17543 | #define alc663_mode4_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17544 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17545 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 17546 | { |
| 17547 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17548 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17549 | } |
| 17550 | /* ***************** Mode5 ******************************/ |
| 17551 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 17552 | unsigned int res) |
| 17553 | { |
| 17554 | switch (res >> 26) { |
| 17555 | case ALC880_HP_EVENT: |
| 17556 | alc663_15jd_two_speaker_automute(codec); |
| 17557 | break; |
| 17558 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17559 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17560 | break; |
| 17561 | } |
| 17562 | } |
| 17563 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17564 | #define alc663_mode5_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17565 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17566 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 17567 | { |
| 17568 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17569 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17570 | } |
| 17571 | /* ***************** Mode6 ******************************/ |
| 17572 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 17573 | unsigned int res) |
| 17574 | { |
| 17575 | switch (res >> 26) { |
| 17576 | case ALC880_HP_EVENT: |
| 17577 | alc663_two_hp_m2_speaker_automute(codec); |
| 17578 | break; |
| 17579 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17580 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17581 | break; |
| 17582 | } |
| 17583 | } |
| 17584 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17585 | #define alc663_mode6_setup alc663_mode1_setup |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17586 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17587 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 17588 | { |
| 17589 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17590 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17591 | } |
| 17592 | |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17593 | /* ***************** Mode7 ******************************/ |
| 17594 | static void alc663_mode7_unsol_event(struct hda_codec *codec, |
| 17595 | unsigned int res) |
| 17596 | { |
| 17597 | switch (res >> 26) { |
| 17598 | case ALC880_HP_EVENT: |
| 17599 | alc663_two_hp_m7_speaker_automute(codec); |
| 17600 | break; |
| 17601 | case ALC880_MIC_EVENT: |
| 17602 | alc_mic_automute(codec); |
| 17603 | break; |
| 17604 | } |
| 17605 | } |
| 17606 | |
| 17607 | #define alc663_mode7_setup alc663_mode1_setup |
| 17608 | |
| 17609 | static void alc663_mode7_inithook(struct hda_codec *codec) |
| 17610 | { |
| 17611 | alc663_two_hp_m7_speaker_automute(codec); |
| 17612 | alc_mic_automute(codec); |
| 17613 | } |
| 17614 | |
| 17615 | /* ***************** Mode8 ******************************/ |
| 17616 | static void alc663_mode8_unsol_event(struct hda_codec *codec, |
| 17617 | unsigned int res) |
| 17618 | { |
| 17619 | switch (res >> 26) { |
| 17620 | case ALC880_HP_EVENT: |
| 17621 | alc663_two_hp_m8_speaker_automute(codec); |
| 17622 | break; |
| 17623 | case ALC880_MIC_EVENT: |
| 17624 | alc_mic_automute(codec); |
| 17625 | break; |
| 17626 | } |
| 17627 | } |
| 17628 | |
| 17629 | #define alc663_mode8_setup alc663_m51va_setup |
| 17630 | |
| 17631 | static void alc663_mode8_inithook(struct hda_codec *codec) |
| 17632 | { |
| 17633 | alc663_two_hp_m8_speaker_automute(codec); |
| 17634 | alc_mic_automute(codec); |
| 17635 | } |
| 17636 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17637 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 17638 | { |
| 17639 | unsigned int present; |
| 17640 | unsigned char bits; |
| 17641 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17642 | present = snd_hda_jack_detect(codec, 0x21); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17643 | bits = present ? HDA_AMP_MUTE : 0; |
| 17644 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 17645 | HDA_AMP_MUTE, bits); |
| 17646 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17647 | HDA_AMP_MUTE, bits); |
| 17648 | } |
| 17649 | |
| 17650 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 17651 | { |
| 17652 | unsigned int present; |
| 17653 | unsigned char bits; |
| 17654 | |
Wu Fengguang | 864f92b | 2009-11-18 12:38:02 +0800 | [diff] [blame] | 17655 | present = snd_hda_jack_detect(codec, 0x15); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17656 | bits = present ? HDA_AMP_MUTE : 0; |
| 17657 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 17658 | HDA_AMP_MUTE, bits); |
| 17659 | } |
| 17660 | |
| 17661 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 17662 | unsigned int res) |
| 17663 | { |
| 17664 | switch (res >> 26) { |
| 17665 | case ALC880_HP_EVENT: |
| 17666 | alc663_g71v_hp_automute(codec); |
| 17667 | break; |
| 17668 | case ALC880_FRONT_EVENT: |
| 17669 | alc663_g71v_front_automute(codec); |
| 17670 | break; |
| 17671 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17672 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17673 | break; |
| 17674 | } |
| 17675 | } |
| 17676 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17677 | #define alc663_g71v_setup alc663_m51va_setup |
| 17678 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17679 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 17680 | { |
| 17681 | alc663_g71v_front_automute(codec); |
| 17682 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17683 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17684 | } |
| 17685 | |
| 17686 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 17687 | unsigned int res) |
| 17688 | { |
| 17689 | switch (res >> 26) { |
| 17690 | case ALC880_HP_EVENT: |
| 17691 | alc663_m51va_speaker_automute(codec); |
| 17692 | break; |
| 17693 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17694 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17695 | break; |
| 17696 | } |
| 17697 | } |
| 17698 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17699 | #define alc663_g50v_setup alc663_m51va_setup |
| 17700 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17701 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 17702 | { |
| 17703 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17704 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17705 | } |
| 17706 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17707 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 17708 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17709 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17710 | |
| 17711 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 17712 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17713 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17714 | |
| 17715 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 17716 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17717 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17718 | { } /* end */ |
| 17719 | }; |
| 17720 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17721 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 17722 | /* Master Playback automatically created from Speaker and Headphone */ |
| 17723 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 17724 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 17725 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 17726 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 17727 | |
| 17728 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 17729 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 17730 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 17731 | |
| 17732 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 17733 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 17734 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 17735 | { } /* end */ |
| 17736 | }; |
| 17737 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17738 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17739 | #define alc662_loopbacks alc880_loopbacks |
| 17740 | #endif |
| 17741 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17742 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 17743 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17744 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 17745 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 17746 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 17747 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 17748 | |
| 17749 | /* |
| 17750 | * configuration and preset |
| 17751 | */ |
| 17752 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 17753 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 17754 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 17755 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 17756 | [ALC662_5ST_DIG] = "6stack-dig", |
| 17757 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 17758 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17759 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17760 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17761 | [ALC663_ASUS_M51VA] = "m51va", |
| 17762 | [ALC663_ASUS_G71V] = "g71v", |
| 17763 | [ALC663_ASUS_H13] = "h13", |
| 17764 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17765 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 17766 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 17767 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 17768 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 17769 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 17770 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17771 | [ALC663_ASUS_MODE7] = "asus-mode7", |
| 17772 | [ALC663_ASUS_MODE8] = "asus-mode8", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 17773 | [ALC272_DELL] = "dell", |
| 17774 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17775 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17776 | [ALC662_AUTO] = "auto", |
| 17777 | }; |
| 17778 | |
| 17779 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17780 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17781 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 17782 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17783 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 17784 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17785 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17786 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 17787 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17788 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 17789 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17790 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), |
| 17791 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17792 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17793 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), |
| 17794 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), |
| 17795 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), |
| 17796 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), |
| 17797 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17798 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17799 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), |
| 17800 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17801 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 17802 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 17803 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 17804 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 17805 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17806 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 17807 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 17808 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17809 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 17810 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 17811 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 17812 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17813 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17814 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 17815 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17816 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17817 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 17818 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 17819 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17820 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 17821 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17822 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 17823 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17824 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 17825 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 17826 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17827 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17828 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 17829 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17830 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17831 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 17832 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17833 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 17834 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 17835 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17836 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17837 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 17838 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 17839 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17840 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17841 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17842 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 17843 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 17844 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | 4dee8ba | 2010-01-13 17:20:08 +0100 | [diff] [blame] | 17845 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17846 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 17847 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 17848 | ALC662_3ST_6ch_DIG), |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 17849 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17850 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 17851 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17852 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 17853 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 17854 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 17855 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 17856 | ALC663_ASUS_H13), |
David Santinoli | 7aee674 | 2009-12-09 12:34:26 +0100 | [diff] [blame] | 17857 | SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17858 | {} |
| 17859 | }; |
| 17860 | |
| 17861 | static struct alc_config_preset alc662_presets[] = { |
| 17862 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17863 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17864 | .init_verbs = { alc662_init_verbs }, |
| 17865 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17866 | .dac_nids = alc662_dac_nids, |
| 17867 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17868 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17869 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17870 | .channel_mode = alc662_3ST_2ch_modes, |
| 17871 | .input_mux = &alc662_capture_source, |
| 17872 | }, |
| 17873 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17874 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17875 | .init_verbs = { alc662_init_verbs }, |
| 17876 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17877 | .dac_nids = alc662_dac_nids, |
| 17878 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17879 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17880 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17881 | .channel_mode = alc662_3ST_6ch_modes, |
| 17882 | .need_dac_fix = 1, |
| 17883 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17884 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17885 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17886 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17887 | .init_verbs = { alc662_init_verbs }, |
| 17888 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17889 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17890 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17891 | .channel_mode = alc662_3ST_6ch_modes, |
| 17892 | .need_dac_fix = 1, |
| 17893 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17894 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17895 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17896 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17897 | .init_verbs = { alc662_init_verbs }, |
| 17898 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17899 | .dac_nids = alc662_dac_nids, |
| 17900 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17901 | .dig_in_nid = ALC662_DIGIN_NID, |
| 17902 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 17903 | .channel_mode = alc662_5stack_modes, |
| 17904 | .input_mux = &alc662_capture_source, |
| 17905 | }, |
| 17906 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17907 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17908 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 17909 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17910 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17911 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17912 | .channel_mode = alc662_3ST_2ch_modes, |
| 17913 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 17914 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 17915 | .init_hook = alc662_lenovo_101e_all_automute, |
| 17916 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17917 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17918 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17919 | .init_verbs = { alc662_init_verbs, |
| 17920 | alc662_eeepc_sue_init_verbs }, |
| 17921 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17922 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17923 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17924 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17925 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17926 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 17927 | .init_hook = alc662_eeepc_inithook, |
| 17928 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17929 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17930 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17931 | alc662_chmode_mixer }, |
| 17932 | .init_verbs = { alc662_init_verbs, |
| 17933 | alc662_eeepc_ep20_sue_init_verbs }, |
| 17934 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17935 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17936 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17937 | .channel_mode = alc662_3ST_6ch_modes, |
| 17938 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 17939 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17940 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 17941 | .init_hook = alc662_eeepc_ep20_inithook, |
| 17942 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17943 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17944 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17945 | .init_verbs = { alc662_init_verbs, |
| 17946 | alc662_ecs_init_verbs }, |
| 17947 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17948 | .dac_nids = alc662_dac_nids, |
| 17949 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17950 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17951 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17952 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17953 | .init_hook = alc662_eeepc_inithook, |
| 17954 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17955 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17956 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17957 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17958 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17959 | .dac_nids = alc662_dac_nids, |
| 17960 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17961 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17962 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17963 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17964 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17965 | .init_hook = alc663_m51va_inithook, |
| 17966 | }, |
| 17967 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17968 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17969 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 17970 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17971 | .dac_nids = alc662_dac_nids, |
| 17972 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17973 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17974 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17975 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17976 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17977 | .init_hook = alc663_g71v_inithook, |
| 17978 | }, |
| 17979 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17980 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17981 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 17982 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17983 | .dac_nids = alc662_dac_nids, |
| 17984 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17985 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17986 | .unsol_event = alc663_m51va_unsol_event, |
| 17987 | .init_hook = alc663_m51va_inithook, |
| 17988 | }, |
| 17989 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17990 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17991 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 17992 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17993 | .dac_nids = alc662_dac_nids, |
| 17994 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17995 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 17996 | .channel_mode = alc662_3ST_6ch_modes, |
| 17997 | .input_mux = &alc663_capture_source, |
| 17998 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17999 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18000 | .init_hook = alc663_g50v_inithook, |
| 18001 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18002 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18003 | .mixers = { alc663_m51va_mixer }, |
| 18004 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18005 | .init_verbs = { alc662_init_verbs, |
| 18006 | alc663_21jd_amic_init_verbs }, |
| 18007 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18008 | .hp_nid = 0x03, |
| 18009 | .dac_nids = alc662_dac_nids, |
| 18010 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18011 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18012 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18013 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18014 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18015 | .init_hook = alc663_mode1_inithook, |
| 18016 | }, |
| 18017 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18018 | .mixers = { alc662_1bjd_mixer }, |
| 18019 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18020 | .init_verbs = { alc662_init_verbs, |
| 18021 | alc662_1bjd_amic_init_verbs }, |
| 18022 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18023 | .dac_nids = alc662_dac_nids, |
| 18024 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18025 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18026 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18027 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18028 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18029 | .init_hook = alc662_mode2_inithook, |
| 18030 | }, |
| 18031 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18032 | .mixers = { alc663_two_hp_m1_mixer }, |
| 18033 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18034 | .init_verbs = { alc662_init_verbs, |
| 18035 | alc663_two_hp_amic_m1_init_verbs }, |
| 18036 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18037 | .hp_nid = 0x03, |
| 18038 | .dac_nids = alc662_dac_nids, |
| 18039 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18040 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18041 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18042 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18043 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18044 | .init_hook = alc663_mode3_inithook, |
| 18045 | }, |
| 18046 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18047 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 18048 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18049 | .init_verbs = { alc662_init_verbs, |
| 18050 | alc663_21jd_amic_init_verbs}, |
| 18051 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18052 | .hp_nid = 0x03, |
| 18053 | .dac_nids = alc662_dac_nids, |
| 18054 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18055 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18056 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18057 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18058 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18059 | .init_hook = alc663_mode4_inithook, |
| 18060 | }, |
| 18061 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18062 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 18063 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18064 | .init_verbs = { alc662_init_verbs, |
| 18065 | alc663_15jd_amic_init_verbs }, |
| 18066 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18067 | .hp_nid = 0x03, |
| 18068 | .dac_nids = alc662_dac_nids, |
| 18069 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18070 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18071 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18072 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18073 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18074 | .init_hook = alc663_mode5_inithook, |
| 18075 | }, |
| 18076 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18077 | .mixers = { alc663_two_hp_m2_mixer }, |
| 18078 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18079 | .init_verbs = { alc662_init_verbs, |
| 18080 | alc663_two_hp_amic_m2_init_verbs }, |
| 18081 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18082 | .hp_nid = 0x03, |
| 18083 | .dac_nids = alc662_dac_nids, |
| 18084 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18085 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18086 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18087 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18088 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 18089 | .init_hook = alc663_mode6_inithook, |
| 18090 | }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18091 | [ALC663_ASUS_MODE7] = { |
| 18092 | .mixers = { alc663_mode7_mixer }, |
| 18093 | .cap_mixer = alc662_auto_capture_mixer, |
| 18094 | .init_verbs = { alc662_init_verbs, |
| 18095 | alc663_mode7_init_verbs }, |
| 18096 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18097 | .hp_nid = 0x03, |
| 18098 | .dac_nids = alc662_dac_nids, |
| 18099 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18100 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18101 | .channel_mode = alc662_3ST_2ch_modes, |
| 18102 | .unsol_event = alc663_mode7_unsol_event, |
| 18103 | .setup = alc663_mode7_setup, |
| 18104 | .init_hook = alc663_mode7_inithook, |
| 18105 | }, |
| 18106 | [ALC663_ASUS_MODE8] = { |
| 18107 | .mixers = { alc663_mode8_mixer }, |
| 18108 | .cap_mixer = alc662_auto_capture_mixer, |
| 18109 | .init_verbs = { alc662_init_verbs, |
| 18110 | alc663_mode8_init_verbs }, |
| 18111 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 18112 | .hp_nid = 0x03, |
| 18113 | .dac_nids = alc662_dac_nids, |
| 18114 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 18115 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18116 | .channel_mode = alc662_3ST_2ch_modes, |
| 18117 | .unsol_event = alc663_mode8_unsol_event, |
| 18118 | .setup = alc663_mode8_setup, |
| 18119 | .init_hook = alc663_mode8_inithook, |
| 18120 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18121 | [ALC272_DELL] = { |
| 18122 | .mixers = { alc663_m51va_mixer }, |
| 18123 | .cap_mixer = alc272_auto_capture_mixer, |
| 18124 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 18125 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18126 | .dac_nids = alc662_dac_nids, |
| 18127 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18128 | .adc_nids = alc272_adc_nids, |
| 18129 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 18130 | .capsrc_nids = alc272_capsrc_nids, |
| 18131 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18132 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18133 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18134 | .init_hook = alc663_m51va_inithook, |
| 18135 | }, |
| 18136 | [ALC272_DELL_ZM1] = { |
| 18137 | .mixers = { alc663_m51va_mixer }, |
| 18138 | .cap_mixer = alc662_auto_capture_mixer, |
| 18139 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 18140 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18141 | .dac_nids = alc662_dac_nids, |
| 18142 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18143 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18144 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18145 | .capsrc_nids = alc662_capsrc_nids, |
| 18146 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18147 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18148 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 18149 | .init_hook = alc663_m51va_inithook, |
| 18150 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18151 | [ALC272_SAMSUNG_NC10] = { |
| 18152 | .mixers = { alc272_nc10_mixer }, |
| 18153 | .init_verbs = { alc662_init_verbs, |
| 18154 | alc663_21jd_amic_init_verbs }, |
| 18155 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 18156 | .dac_nids = alc272_dac_nids, |
| 18157 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 18158 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18159 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18160 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 18161 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 18162 | .init_hook = alc663_mode4_inithook, |
| 18163 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18164 | }; |
| 18165 | |
| 18166 | |
| 18167 | /* |
| 18168 | * BIOS auto configuration |
| 18169 | */ |
| 18170 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18171 | /* convert from MIX nid to DAC */ |
| 18172 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
| 18173 | { |
| 18174 | if (nid == 0x0f) |
| 18175 | return 0x02; |
| 18176 | else if (nid >= 0x0c && nid <= 0x0e) |
| 18177 | return nid - 0x0c + 0x02; |
| 18178 | else |
| 18179 | return 0; |
| 18180 | } |
| 18181 | |
| 18182 | /* get MIX nid connected to the given pin targeted to DAC */ |
| 18183 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
| 18184 | hda_nid_t dac) |
| 18185 | { |
| 18186 | hda_nid_t mix[4]; |
| 18187 | int i, num; |
| 18188 | |
| 18189 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
| 18190 | for (i = 0; i < num; i++) { |
| 18191 | if (alc662_mix_to_dac(mix[i]) == dac) |
| 18192 | return mix[i]; |
| 18193 | } |
| 18194 | return 0; |
| 18195 | } |
| 18196 | |
| 18197 | /* look for an empty DAC slot */ |
| 18198 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 18199 | { |
| 18200 | struct alc_spec *spec = codec->spec; |
| 18201 | hda_nid_t srcs[5]; |
| 18202 | int i, j, num; |
| 18203 | |
| 18204 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); |
| 18205 | if (num < 0) |
| 18206 | return 0; |
| 18207 | for (i = 0; i < num; i++) { |
| 18208 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); |
| 18209 | if (!nid) |
| 18210 | continue; |
| 18211 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 18212 | if (spec->multiout.dac_nids[j] == nid) |
| 18213 | break; |
| 18214 | if (j >= spec->multiout.num_dacs) |
| 18215 | return nid; |
| 18216 | } |
| 18217 | return 0; |
| 18218 | } |
| 18219 | |
| 18220 | /* fill in the dac_nids table from the parsed pin configuration */ |
| 18221 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, |
| 18222 | const struct auto_pin_cfg *cfg) |
| 18223 | { |
| 18224 | struct alc_spec *spec = codec->spec; |
| 18225 | int i; |
| 18226 | hda_nid_t dac; |
| 18227 | |
| 18228 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 18229 | for (i = 0; i < cfg->line_outs; i++) { |
| 18230 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); |
| 18231 | if (!dac) |
| 18232 | continue; |
| 18233 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 18234 | } |
| 18235 | return 0; |
| 18236 | } |
| 18237 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18238 | 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] | 18239 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18240 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18241 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18242 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 18243 | } |
| 18244 | |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18245 | 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] | 18246 | hda_nid_t nid, unsigned int chs) |
| 18247 | { |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18248 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18249 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); |
| 18250 | } |
| 18251 | |
| 18252 | #define alc662_add_stereo_vol(spec, pfx, nid) \ |
| 18253 | alc662_add_vol_ctl(spec, pfx, nid, 3) |
| 18254 | #define alc662_add_stereo_sw(spec, pfx, nid) \ |
| 18255 | alc662_add_sw_ctl(spec, pfx, nid, 3) |
| 18256 | |
| 18257 | /* add playback controls from the parsed DAC table */ |
| 18258 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 18259 | const struct auto_pin_cfg *cfg) |
| 18260 | { |
| 18261 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18262 | static const char *chname[4] = { |
| 18263 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 18264 | }; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18265 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18266 | int i, err; |
| 18267 | |
| 18268 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18269 | nid = spec->multiout.dac_nids[i]; |
| 18270 | if (!nid) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18271 | continue; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18272 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); |
| 18273 | if (!mix) |
| 18274 | continue; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18275 | if (i == 2) { |
| 18276 | /* Center/LFE */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18277 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18278 | if (err < 0) |
| 18279 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18280 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18281 | if (err < 0) |
| 18282 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18283 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18284 | if (err < 0) |
| 18285 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18286 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18287 | if (err < 0) |
| 18288 | return err; |
| 18289 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18290 | const char *pfx; |
| 18291 | if (cfg->line_outs == 1 && |
| 18292 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18293 | if (cfg->hp_outs) |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18294 | pfx = "Speaker"; |
| 18295 | else |
| 18296 | pfx = "PCM"; |
| 18297 | } else |
| 18298 | pfx = chname[i]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18299 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18300 | if (err < 0) |
| 18301 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 18302 | if (cfg->line_outs == 1 && |
| 18303 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 18304 | pfx = "Speaker"; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18305 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18306 | if (err < 0) |
| 18307 | return err; |
| 18308 | } |
| 18309 | } |
| 18310 | return 0; |
| 18311 | } |
| 18312 | |
| 18313 | /* add playback controls for speaker and HP outputs */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18314 | /* return DAC nid if any new DAC is assigned */ |
| 18315 | 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] | 18316 | const char *pfx) |
| 18317 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18318 | struct alc_spec *spec = codec->spec; |
| 18319 | hda_nid_t nid, mix; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18320 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18321 | |
| 18322 | if (!pin) |
| 18323 | return 0; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18324 | nid = alc662_look_for_dac(codec, pin); |
| 18325 | if (!nid) { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18326 | /* the corresponding DAC is already occupied */ |
| 18327 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) |
| 18328 | return 0; /* no way */ |
| 18329 | /* create a switch only */ |
Takashi Iwai | 0afe5f8 | 2009-10-02 09:20:00 +0200 | [diff] [blame] | 18330 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18331 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 18332 | } |
| 18333 | |
| 18334 | mix = alc662_dac_to_mix(codec, pin, nid); |
| 18335 | if (!mix) |
| 18336 | return 0; |
| 18337 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); |
| 18338 | if (err < 0) |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 18339 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18340 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); |
| 18341 | if (err < 0) |
| 18342 | return err; |
| 18343 | return nid; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18344 | } |
| 18345 | |
| 18346 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18347 | #define alc662_auto_create_input_ctls \ |
Takashi Iwai | 4b7348a | 2009-10-14 18:25:23 +0200 | [diff] [blame] | 18348 | alc882_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18349 | |
| 18350 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 18351 | hda_nid_t nid, int pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18352 | hda_nid_t dac) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18353 | { |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18354 | int i, num; |
| 18355 | hda_nid_t srcs[4]; |
| 18356 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18357 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18358 | /* need the manual connection? */ |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18359 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); |
| 18360 | if (num <= 1) |
| 18361 | return; |
| 18362 | for (i = 0; i < num; i++) { |
| 18363 | if (alc662_mix_to_dac(srcs[i]) != dac) |
| 18364 | continue; |
| 18365 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); |
| 18366 | return; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18367 | } |
| 18368 | } |
| 18369 | |
| 18370 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 18371 | { |
| 18372 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18373 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18374 | int i; |
| 18375 | |
| 18376 | for (i = 0; i <= HDA_SIDE; i++) { |
| 18377 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 18378 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 18379 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18380 | spec->multiout.dac_nids[i]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18381 | } |
| 18382 | } |
| 18383 | |
| 18384 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 18385 | { |
| 18386 | struct alc_spec *spec = codec->spec; |
| 18387 | hda_nid_t pin; |
| 18388 | |
| 18389 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18390 | if (pin) |
| 18391 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 18392 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18393 | pin = spec->autocfg.speaker_pins[0]; |
| 18394 | if (pin) |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18395 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 18396 | spec->multiout.extra_out_nid[0]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18397 | } |
| 18398 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18399 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 18400 | |
| 18401 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 18402 | { |
| 18403 | struct alc_spec *spec = codec->spec; |
| 18404 | int i; |
| 18405 | |
| 18406 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 18407 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18408 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 18409 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 18410 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 18411 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18412 | snd_hda_codec_write(codec, nid, 0, |
| 18413 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 18414 | AMP_OUT_MUTE); |
| 18415 | } |
| 18416 | } |
| 18417 | } |
| 18418 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18419 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 18420 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18421 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 18422 | { |
| 18423 | struct alc_spec *spec = codec->spec; |
| 18424 | int err; |
| 18425 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 18426 | |
| 18427 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 18428 | alc662_ignore); |
| 18429 | if (err < 0) |
| 18430 | return err; |
| 18431 | if (!spec->autocfg.line_outs) |
| 18432 | return 0; /* can't find valid BIOS pin config */ |
| 18433 | |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18434 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18435 | if (err < 0) |
| 18436 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18437 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18438 | if (err < 0) |
| 18439 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18440 | err = alc662_auto_create_extra_out(codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18441 | spec->autocfg.speaker_pins[0], |
| 18442 | "Speaker"); |
| 18443 | if (err < 0) |
| 18444 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18445 | if (err) |
| 18446 | spec->multiout.extra_out_nid[0] = err; |
| 18447 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18448 | "Headphone"); |
| 18449 | if (err < 0) |
| 18450 | return err; |
Takashi Iwai | 7085ec1 | 2009-10-02 09:03:58 +0200 | [diff] [blame] | 18451 | if (err) |
| 18452 | spec->multiout.hp_nid = err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 18453 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 18454 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18455 | return err; |
| 18456 | |
| 18457 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 18458 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 18459 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18460 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 18461 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 18462 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 18463 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18464 | |
| 18465 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 18466 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 18467 | |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18468 | add_verb(spec, alc662_init_verbs); |
| 18469 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18470 | codec->vendor_id == 0x10ec0665) |
| 18471 | add_verb(spec, alc663_init_verbs); |
| 18472 | |
| 18473 | if (codec->vendor_id == 0x10ec0272) |
| 18474 | add_verb(spec, alc272_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 18475 | |
| 18476 | err = alc_auto_add_mic_boost(codec); |
| 18477 | if (err < 0) |
| 18478 | return err; |
| 18479 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18480 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 18481 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
| 18482 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); |
| 18483 | else |
| 18484 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 18485 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18486 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18487 | } |
| 18488 | |
| 18489 | /* additional initialization for auto-configuration model */ |
| 18490 | static void alc662_auto_init(struct hda_codec *codec) |
| 18491 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18492 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18493 | alc662_auto_init_multi_out(codec); |
| 18494 | alc662_auto_init_hp_out(codec); |
| 18495 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 18496 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 18497 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 18498 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18499 | } |
| 18500 | |
| 18501 | static int patch_alc662(struct hda_codec *codec) |
| 18502 | { |
| 18503 | struct alc_spec *spec; |
| 18504 | int err, board_config; |
| 18505 | |
| 18506 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 18507 | if (!spec) |
| 18508 | return -ENOMEM; |
| 18509 | |
| 18510 | codec->spec = spec; |
| 18511 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18512 | alc_auto_parse_customize_define(codec); |
| 18513 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 18514 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 18515 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 18516 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
| 18517 | alc_codec_rename(codec, "ALC661"); |
| 18518 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
| 18519 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 18520 | spec->cdefine.platform_type == 1) |
| 18521 | alc_codec_rename(codec, "ALC272X"); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18522 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18523 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 18524 | alc662_models, |
| 18525 | alc662_cfg_tbl); |
| 18526 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 18527 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 18528 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18529 | board_config = ALC662_AUTO; |
| 18530 | } |
| 18531 | |
| 18532 | if (board_config == ALC662_AUTO) { |
| 18533 | /* automatic parse from the BIOS config */ |
| 18534 | err = alc662_parse_auto_config(codec); |
| 18535 | if (err < 0) { |
| 18536 | alc_free(codec); |
| 18537 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 18538 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18539 | printk(KERN_INFO |
| 18540 | "hda_codec: Cannot set up configuration " |
| 18541 | "from BIOS. Using base mode...\n"); |
| 18542 | board_config = ALC662_3ST_2ch_DIG; |
| 18543 | } |
| 18544 | } |
| 18545 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 18546 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 18547 | if (err < 0) { |
| 18548 | alc_free(codec); |
| 18549 | return err; |
| 18550 | } |
| 18551 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18552 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 18553 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18554 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18555 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 18556 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 18557 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18558 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 18559 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 18560 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 18561 | if (!spec->adc_nids) { |
| 18562 | spec->adc_nids = alc662_adc_nids; |
| 18563 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 18564 | } |
| 18565 | if (!spec->capsrc_nids) |
| 18566 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18567 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18568 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 18569 | set_capture_mixer(codec); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 18570 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 18571 | if (spec->cdefine.enable_pcbeep) { |
| 18572 | switch (codec->vendor_id) { |
| 18573 | case 0x10ec0662: |
| 18574 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 18575 | break; |
| 18576 | case 0x10ec0272: |
| 18577 | case 0x10ec0663: |
| 18578 | case 0x10ec0665: |
| 18579 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 18580 | break; |
| 18581 | case 0x10ec0273: |
| 18582 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 18583 | break; |
| 18584 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18585 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 18586 | spec->vmaster_nid = 0x02; |
| 18587 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18588 | codec->patch_ops = alc_patch_ops; |
| 18589 | if (board_config == ALC662_AUTO) |
| 18590 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 18591 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 18592 | if (!spec->loopback.amplist) |
| 18593 | spec->loopback.amplist = alc662_loopbacks; |
| 18594 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18595 | |
| 18596 | return 0; |
| 18597 | } |
| 18598 | |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18599 | static int patch_alc888(struct hda_codec *codec) |
| 18600 | { |
| 18601 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 18602 | kfree(codec->chip_name); |
| 18603 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18604 | if (!codec->chip_name) { |
| 18605 | alc_free(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18606 | return -ENOMEM; |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18607 | } |
| 18608 | return patch_alc662(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18609 | } |
Takashi Iwai | ac2c92e | 2009-12-03 10:14:10 +0100 | [diff] [blame] | 18610 | return patch_alc882(codec); |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18611 | } |
| 18612 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18613 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18614 | * patch entries |
| 18615 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18616 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18617 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18618 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18619 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 18620 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 18621 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18622 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 18623 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 18624 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18625 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18626 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18627 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 18628 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 18629 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18630 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18631 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 18632 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 18633 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 18634 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 18635 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 18636 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 18637 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18638 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18639 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 18640 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18641 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 18642 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18643 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 18644 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18645 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 18646 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18647 | .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18648 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 18649 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 18650 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18651 | {} /* terminator */ |
| 18652 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 18653 | |
| 18654 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 18655 | |
| 18656 | MODULE_LICENSE("GPL"); |
| 18657 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 18658 | |
| 18659 | static struct hda_codec_preset_list realtek_list = { |
| 18660 | .preset = snd_hda_preset_realtek, |
| 18661 | .owner = THIS_MODULE, |
| 18662 | }; |
| 18663 | |
| 18664 | static int __init patch_realtek_init(void) |
| 18665 | { |
| 18666 | return snd_hda_add_codec_preset(&realtek_list); |
| 18667 | } |
| 18668 | |
| 18669 | static void __exit patch_realtek_exit(void) |
| 18670 | { |
| 18671 | snd_hda_delete_codec_preset(&realtek_list); |
| 18672 | } |
| 18673 | |
| 18674 | module_init(patch_realtek_init) |
| 18675 | module_exit(patch_realtek_exit) |