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 | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 134 | ALC269_ASUS_EEEPC_P703, |
| 135 | ALC269_ASUS_EEEPC_P901, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 136 | ALC269_FUJITSU, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 137 | ALC269_LIFEBOOK, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 138 | ALC269_AUTO, |
| 139 | ALC269_MODEL_LAST /* last tag */ |
| 140 | }; |
| 141 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 142 | /* ALC861 models */ |
| 143 | enum { |
| 144 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 145 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 146 | ALC861_3ST_DIG, |
| 147 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 148 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 149 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 150 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 151 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 152 | ALC861_AUTO, |
| 153 | ALC861_MODEL_LAST, |
| 154 | }; |
| 155 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 156 | /* ALC861-VD models */ |
| 157 | enum { |
| 158 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 159 | ALC660VD_3ST_DIG, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 160 | ALC660VD_ASUS_V1S, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 161 | ALC861VD_3ST, |
| 162 | ALC861VD_3ST_DIG, |
| 163 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 164 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 165 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 166 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 167 | ALC861VD_AUTO, |
| 168 | ALC861VD_MODEL_LAST, |
| 169 | }; |
| 170 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 171 | /* ALC662 models */ |
| 172 | enum { |
| 173 | ALC662_3ST_2ch_DIG, |
| 174 | ALC662_3ST_6ch_DIG, |
| 175 | ALC662_3ST_6ch, |
| 176 | ALC662_5ST_DIG, |
| 177 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 178 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 179 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 180 | ALC663_ASUS_M51VA, |
| 181 | ALC663_ASUS_G71V, |
| 182 | ALC663_ASUS_H13, |
| 183 | ALC663_ASUS_G50V, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 184 | ALC662_ECS, |
| 185 | ALC663_ASUS_MODE1, |
| 186 | ALC662_ASUS_MODE2, |
| 187 | ALC663_ASUS_MODE3, |
| 188 | ALC663_ASUS_MODE4, |
| 189 | ALC663_ASUS_MODE5, |
| 190 | ALC663_ASUS_MODE6, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 191 | ALC272_DELL, |
| 192 | ALC272_DELL_ZM1, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 193 | ALC272_SAMSUNG_NC10, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC662_AUTO, |
| 195 | ALC662_MODEL_LAST, |
| 196 | }; |
| 197 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 198 | /* ALC882 models */ |
| 199 | enum { |
| 200 | ALC882_3ST_DIG, |
| 201 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 202 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 203 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC882_TARGA, |
| 205 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 206 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 207 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 208 | ALC885_MBP3, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 209 | ALC885_MB5, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 210 | ALC885_IMAC24, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 211 | ALC883_3ST_2ch_DIG, |
| 212 | ALC883_3ST_6ch_DIG, |
| 213 | ALC883_3ST_6ch, |
| 214 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 215 | ALC883_TARGA_DIG, |
| 216 | ALC883_TARGA_2ch_DIG, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 217 | ALC883_TARGA_8ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 218 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 219 | ALC883_ACER_ASPIRE, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 220 | ALC888_ACER_ASPIRE_4930G, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 221 | ALC888_ACER_ASPIRE_6530G, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 222 | ALC888_ACER_ASPIRE_8930G, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 223 | ALC888_ACER_ASPIRE_7730G, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 224 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 225 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 226 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 227 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 228 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 229 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 230 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 231 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 232 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 233 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 234 | ALC883_MITAC, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 235 | ALC883_CLEVO_M540R, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 236 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 237 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 238 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 239 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 240 | ALC889A_INTEL, |
| 241 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 242 | ALC888_ASUS_M90V, |
| 243 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 244 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 245 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 246 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 247 | ALC882_AUTO, |
| 248 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 249 | }; |
| 250 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 251 | /* for GPIO Poll */ |
| 252 | #define GPIO_MASK 0x03 |
| 253 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 254 | /* extra amp-initialization sequence types */ |
| 255 | enum { |
| 256 | ALC_INIT_NONE, |
| 257 | ALC_INIT_DEFAULT, |
| 258 | ALC_INIT_GPIO1, |
| 259 | ALC_INIT_GPIO2, |
| 260 | ALC_INIT_GPIO3, |
| 261 | }; |
| 262 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 263 | struct alc_mic_route { |
| 264 | hda_nid_t pin; |
| 265 | unsigned char mux_idx; |
| 266 | unsigned char amix_idx; |
| 267 | }; |
| 268 | |
| 269 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
| 270 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | struct alc_spec { |
| 272 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 273 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 275 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 276 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 278 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 279 | * don't forget NULL |
| 280 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 281 | */ |
| 282 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 284 | char stream_name_analog[32]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | struct hda_pcm_stream *stream_analog_playback; |
| 286 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 287 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 288 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | |
Takashi Iwai | aa563af | 2009-07-31 10:05:11 +0200 | [diff] [blame] | 290 | char stream_name_digital[32]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | struct hda_pcm_stream *stream_digital_playback; |
| 292 | struct hda_pcm_stream *stream_digital_capture; |
| 293 | |
| 294 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 295 | struct hda_multi_out multiout; /* playback set-up |
| 296 | * max_channels, dacs must be set |
| 297 | * dig_out_nid and hp_nid are optional |
| 298 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 299 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 300 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 301 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | |
| 303 | /* capture */ |
| 304 | unsigned int num_adc_nids; |
| 305 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 306 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 307 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 310 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | const struct hda_input_mux *input_mux; |
| 312 | unsigned int cur_mux[3]; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 313 | struct alc_mic_route ext_mic; |
| 314 | struct alc_mic_route int_mic; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
| 316 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 317 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 319 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 320 | int const_channel_count; |
| 321 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 324 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 326 | /* dynamic controls, init_verbs and input_mux */ |
| 327 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 328 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 329 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 330 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 331 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 332 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 333 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 334 | /* hooks */ |
| 335 | void (*init_hook)(struct hda_codec *codec); |
| 336 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 337 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 338 | /* for pin sensing */ |
| 339 | unsigned int sense_updated: 1; |
| 340 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 341 | unsigned int master_sw: 1; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 342 | unsigned int auto_mic:1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 343 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 344 | /* other flags */ |
| 345 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 346 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 347 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 348 | /* for virtual master */ |
| 349 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 350 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 351 | struct hda_loopback_check loopback; |
| 352 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 353 | |
| 354 | /* for PLL fix */ |
| 355 | hda_nid_t pll_nid; |
| 356 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 357 | }; |
| 358 | |
| 359 | /* |
| 360 | * configuration template - to be copied to the spec instance |
| 361 | */ |
| 362 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 363 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 364 | * with spec |
| 365 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 366 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 367 | const struct hda_verb *init_verbs[5]; |
| 368 | unsigned int num_dacs; |
| 369 | hda_nid_t *dac_nids; |
| 370 | hda_nid_t dig_out_nid; /* optional */ |
| 371 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 372 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 373 | unsigned int num_adc_nids; |
| 374 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 375 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 376 | hda_nid_t dig_in_nid; |
| 377 | unsigned int num_channel_mode; |
| 378 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 379 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 380 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 381 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 382 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 383 | void (*unsol_event)(struct hda_codec *, unsigned int); |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 384 | void (*setup)(struct hda_codec *); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 385 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 386 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 387 | struct hda_amp_list *loopbacks; |
| 388 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | |
| 392 | /* |
| 393 | * input MUX handling |
| 394 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 395 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 396 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | { |
| 398 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 399 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 400 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 401 | if (mux_idx >= spec->num_mux_defs) |
| 402 | mux_idx = 0; |
| 403 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | } |
| 405 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 406 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 407 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 408 | { |
| 409 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 410 | struct alc_spec *spec = codec->spec; |
| 411 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 412 | |
| 413 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 414 | return 0; |
| 415 | } |
| 416 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 417 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 418 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | { |
| 420 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 421 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 422 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 424 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 425 | hda_nid_t nid = spec->capsrc_nids ? |
| 426 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 427 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 428 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 429 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 430 | imux = &spec->input_mux[mux_idx]; |
| 431 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 432 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 433 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 434 | /* Matrix-mixer style (e.g. ALC882) */ |
| 435 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 436 | unsigned int i, idx; |
| 437 | |
| 438 | idx = ucontrol->value.enumerated.item[0]; |
| 439 | if (idx >= imux->num_items) |
| 440 | idx = imux->num_items - 1; |
| 441 | if (*cur_val == idx) |
| 442 | return 0; |
| 443 | for (i = 0; i < imux->num_items; i++) { |
| 444 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 445 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 446 | imux->items[i].index, |
| 447 | HDA_AMP_MUTE, v); |
| 448 | } |
| 449 | *cur_val = idx; |
| 450 | return 1; |
| 451 | } else { |
| 452 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 453 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 454 | &spec->cur_mux[adc_idx]); |
| 455 | } |
| 456 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | /* |
| 459 | * channel mode setting |
| 460 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 462 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | { |
| 464 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 465 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 466 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 467 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | } |
| 469 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 470 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 471 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | { |
| 473 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 474 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 475 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 476 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 477 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 481 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | { |
| 483 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 484 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 485 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 486 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 487 | &spec->ext_channel_count); |
| 488 | if (err >= 0 && !spec->const_channel_count) { |
| 489 | spec->multiout.max_channels = spec->ext_channel_count; |
| 490 | if (spec->need_dac_fix) |
| 491 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 492 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 493 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 497 | * 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] | 498 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 499 | * being part of a format specifier. Maximum allowed length of a value is |
| 500 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 501 | * |
| 502 | * Note: some retasking pin complexes seem to ignore requests for input |
| 503 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 504 | * are requested. Therefore order this list so that this behaviour will not |
| 505 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 506 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 507 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 508 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 509 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 510 | "Mic 50pc bias", "Mic 80pc bias", |
| 511 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | }; |
| 513 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 514 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 515 | }; |
| 516 | /* 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] | 517 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 518 | * addition, "input" pins may or may not process the mic bias option |
| 519 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 520 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 521 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 522 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 523 | #define ALC_PIN_DIR_IN 0x00 |
| 524 | #define ALC_PIN_DIR_OUT 0x01 |
| 525 | #define ALC_PIN_DIR_INOUT 0x02 |
| 526 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 527 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 529 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 530 | * For each direction the minimum and maximum values are given. |
| 531 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 532 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 534 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 535 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 536 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 537 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | }; |
| 539 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 540 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 541 | #define alc_pin_mode_n_items(_dir) \ |
| 542 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 543 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 544 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 545 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 546 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 547 | unsigned int item_num = uinfo->value.enumerated.item; |
| 548 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 549 | |
| 550 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 551 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 553 | |
| 554 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 555 | item_num = alc_pin_mode_min(dir); |
| 556 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | return 0; |
| 558 | } |
| 559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 562 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 563 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 564 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 565 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 566 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 567 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 568 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 569 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 570 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 571 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 572 | /* Find enumerated value for current pinctl setting */ |
| 573 | i = alc_pin_mode_min(dir); |
Roel Kluin | 4b35d2c | 2009-08-02 13:30:45 +0200 | [diff] [blame] | 574 | 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] | 575 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 576 | *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] | 577 | return 0; |
| 578 | } |
| 579 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 580 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 581 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 582 | { |
| 583 | signed int change; |
| 584 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 585 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 586 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 587 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 589 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 590 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 591 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 592 | 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] | 593 | val = alc_pin_mode_min(dir); |
| 594 | |
| 595 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 596 | if (change) { |
| 597 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 598 | snd_hda_codec_write_cache(codec, nid, 0, |
| 599 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 600 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 601 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 602 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | * for the requested pin mode. Enum values of 2 or less are |
| 604 | * input modes. |
| 605 | * |
| 606 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 607 | * reduces noise slightly (particularly on input) so we'll |
| 608 | * do it. However, having both input and output buffers |
| 609 | * enabled simultaneously doesn't seem to be problematic if |
| 610 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 611 | */ |
| 612 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 613 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 614 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 615 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 616 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 617 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 618 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 619 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 620 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 621 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 622 | } |
| 623 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 624 | return change; |
| 625 | } |
| 626 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 627 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 628 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 629 | .info = alc_pin_mode_info, \ |
| 630 | .get = alc_pin_mode_get, \ |
| 631 | .put = alc_pin_mode_put, \ |
| 632 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 633 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 634 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 635 | * together using a mask with more than one bit set. This control is |
| 636 | * currently used only by the ALC260 test model. At this stage they are not |
| 637 | * needed for any "production" models. |
| 638 | */ |
| 639 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 640 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 641 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 642 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 643 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 644 | { |
| 645 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 646 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 647 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 648 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 651 | |
| 652 | *valp = (val & mask) != 0; |
| 653 | return 0; |
| 654 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 655 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 656 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 657 | { |
| 658 | signed int change; |
| 659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 660 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 661 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 662 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 663 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 664 | AC_VERB_GET_GPIO_DATA, |
| 665 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 666 | |
| 667 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 668 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 669 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 670 | gpio_data &= ~mask; |
| 671 | else |
| 672 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 673 | snd_hda_codec_write_cache(codec, nid, 0, |
| 674 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 675 | |
| 676 | return change; |
| 677 | } |
| 678 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 679 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 680 | .info = alc_gpio_data_info, \ |
| 681 | .get = alc_gpio_data_get, \ |
| 682 | .put = alc_gpio_data_put, \ |
| 683 | .private_value = nid | (mask<<16) } |
| 684 | #endif /* CONFIG_SND_DEBUG */ |
| 685 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 686 | /* A switch control to allow the enabling of the digital IO pins on the |
| 687 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 688 | * to provide something in the test model allowing digital outputs to be |
| 689 | * identified if present. If models are found which can utilise these |
| 690 | * outputs a more complete mixer control can be devised for those models if |
| 691 | * necessary. |
| 692 | */ |
| 693 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 694 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 696 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 697 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 698 | { |
| 699 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 700 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 701 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 702 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 704 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 705 | |
| 706 | *valp = (val & mask) != 0; |
| 707 | return 0; |
| 708 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 709 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 710 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 711 | { |
| 712 | signed int change; |
| 713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 714 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 715 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 716 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 717 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 718 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 719 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 720 | |
| 721 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 722 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 723 | if (val==0) |
| 724 | ctrl_data &= ~mask; |
| 725 | else |
| 726 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 727 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 728 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 729 | |
| 730 | return change; |
| 731 | } |
| 732 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 733 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 734 | .info = alc_spdif_ctrl_info, \ |
| 735 | .get = alc_spdif_ctrl_get, \ |
| 736 | .put = alc_spdif_ctrl_put, \ |
| 737 | .private_value = nid | (mask<<16) } |
| 738 | #endif /* CONFIG_SND_DEBUG */ |
| 739 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 740 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 741 | * Again, this is only used in the ALC26x test models to help identify when |
| 742 | * the EAPD line must be asserted for features to work. |
| 743 | */ |
| 744 | #ifdef CONFIG_SND_DEBUG |
| 745 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 746 | |
| 747 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 748 | struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 751 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 752 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 753 | long *valp = ucontrol->value.integer.value; |
| 754 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 755 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 756 | |
| 757 | *valp = (val & mask) != 0; |
| 758 | return 0; |
| 759 | } |
| 760 | |
| 761 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 762 | struct snd_ctl_elem_value *ucontrol) |
| 763 | { |
| 764 | int change; |
| 765 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 766 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 767 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 768 | long val = *ucontrol->value.integer.value; |
| 769 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 770 | AC_VERB_GET_EAPD_BTLENABLE, |
| 771 | 0x00); |
| 772 | |
| 773 | /* Set/unset the masked control bit(s) as needed */ |
| 774 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 775 | if (!val) |
| 776 | ctrl_data &= ~mask; |
| 777 | else |
| 778 | ctrl_data |= mask; |
| 779 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 780 | ctrl_data); |
| 781 | |
| 782 | return change; |
| 783 | } |
| 784 | |
| 785 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 786 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 787 | .info = alc_eapd_ctrl_info, \ |
| 788 | .get = alc_eapd_ctrl_get, \ |
| 789 | .put = alc_eapd_ctrl_put, \ |
| 790 | .private_value = nid | (mask<<16) } |
| 791 | #endif /* CONFIG_SND_DEBUG */ |
| 792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 793 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 794 | * set up the input pin config (depending on the given auto-pin type) |
| 795 | */ |
| 796 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 797 | int auto_pin_type) |
| 798 | { |
| 799 | unsigned int val = PIN_IN; |
| 800 | |
| 801 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 802 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 803 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 804 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 805 | if (pincap & AC_PINCAP_VREF_80) |
| 806 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 807 | else if (pincap & AC_PINCAP_VREF_50) |
| 808 | val = PIN_VREF50; |
| 809 | else if (pincap & AC_PINCAP_VREF_100) |
| 810 | val = PIN_VREF100; |
| 811 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 812 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 813 | } |
| 814 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 815 | } |
| 816 | |
| 817 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 818 | */ |
| 819 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 820 | { |
| 821 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 822 | return; |
| 823 | spec->mixers[spec->num_mixers++] = mix; |
| 824 | } |
| 825 | |
| 826 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 827 | { |
| 828 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 829 | return; |
| 830 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 831 | } |
| 832 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 833 | #ifdef CONFIG_PROC_FS |
| 834 | /* |
| 835 | * hook for proc |
| 836 | */ |
| 837 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 838 | struct hda_codec *codec, hda_nid_t nid) |
| 839 | { |
| 840 | int coeff; |
| 841 | |
| 842 | if (nid != 0x20) |
| 843 | return; |
| 844 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 845 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 846 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 847 | AC_VERB_GET_COEF_INDEX, 0); |
| 848 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 849 | } |
| 850 | #else |
| 851 | #define print_realtek_coef NULL |
| 852 | #endif |
| 853 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 854 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | * set up from the preset table |
| 856 | */ |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 857 | static void setup_preset(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 858 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | { |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 860 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 861 | int i; |
| 862 | |
| 863 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 864 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 865 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 866 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 867 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 868 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | spec->channel_mode = preset->channel_mode; |
| 871 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 872 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 873 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 874 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 875 | if (preset->const_channel_count) |
| 876 | spec->multiout.max_channels = preset->const_channel_count; |
| 877 | else |
| 878 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 879 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 880 | |
| 881 | spec->multiout.num_dacs = preset->num_dacs; |
| 882 | spec->multiout.dac_nids = preset->dac_nids; |
| 883 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 884 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 885 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 886 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 887 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 888 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 889 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 890 | spec->input_mux = preset->input_mux; |
| 891 | |
| 892 | spec->num_adc_nids = preset->num_adc_nids; |
| 893 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 894 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 895 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 896 | |
| 897 | spec->unsol_event = preset->unsol_event; |
| 898 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 899 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 900 | spec->loopback.amplist = preset->loopbacks; |
| 901 | #endif |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 902 | |
| 903 | if (preset->setup) |
| 904 | preset->setup(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 907 | /* Enable GPIO mask and set output */ |
| 908 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 909 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 910 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 911 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 912 | { } |
| 913 | }; |
| 914 | |
| 915 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 916 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 917 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 918 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 919 | { } |
| 920 | }; |
| 921 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 922 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 923 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 924 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 925 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 926 | { } |
| 927 | }; |
| 928 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 929 | /* |
| 930 | * Fix hardware PLL issue |
| 931 | * On some codecs, the analog PLL gating control must be off while |
| 932 | * the default value is 1. |
| 933 | */ |
| 934 | static void alc_fix_pll(struct hda_codec *codec) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | unsigned int val; |
| 938 | |
| 939 | if (!spec->pll_nid) |
| 940 | return; |
| 941 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 942 | spec->pll_coef_idx); |
| 943 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 944 | AC_VERB_GET_PROC_COEF, 0); |
| 945 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 946 | spec->pll_coef_idx); |
| 947 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 948 | val & ~(1 << spec->pll_coef_bit)); |
| 949 | } |
| 950 | |
| 951 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 952 | unsigned int coef_idx, unsigned int coef_bit) |
| 953 | { |
| 954 | struct alc_spec *spec = codec->spec; |
| 955 | spec->pll_nid = nid; |
| 956 | spec->pll_coef_idx = coef_idx; |
| 957 | spec->pll_coef_bit = coef_bit; |
| 958 | alc_fix_pll(codec); |
| 959 | } |
| 960 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 961 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 962 | { |
| 963 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 964 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 965 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 966 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 967 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 968 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 969 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 970 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 971 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 972 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 973 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 974 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 975 | nid = spec->autocfg.speaker_pins[i]; |
| 976 | if (!nid) |
| 977 | break; |
| 978 | snd_hda_codec_write(codec, nid, 0, |
| 979 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 980 | spec->jack_present ? 0 : PIN_OUT); |
| 981 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 982 | } |
| 983 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 984 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 985 | hda_nid_t nid) |
| 986 | { |
| 987 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 988 | int i, nums; |
| 989 | |
| 990 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 991 | for (i = 0; i < nums; i++) |
| 992 | if (conn[i] == nid) |
| 993 | return i; |
| 994 | return -1; |
| 995 | } |
| 996 | |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 997 | static void alc_mic_automute(struct hda_codec *codec) |
| 998 | { |
| 999 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1000 | struct alc_mic_route *dead, *alive; |
| 1001 | unsigned int present, type; |
| 1002 | hda_nid_t cap_nid; |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1003 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 1004 | if (!spec->auto_mic) |
| 1005 | return; |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1006 | if (!spec->int_mic.pin || !spec->ext_mic.pin) |
| 1007 | return; |
| 1008 | if (snd_BUG_ON(!spec->adc_nids)) |
| 1009 | return; |
| 1010 | |
| 1011 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; |
| 1012 | |
| 1013 | present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0, |
| 1014 | AC_VERB_GET_PIN_SENSE, 0); |
| 1015 | present &= AC_PINSENSE_PRESENCE; |
| 1016 | if (present) { |
| 1017 | alive = &spec->ext_mic; |
| 1018 | dead = &spec->int_mic; |
| 1019 | } else { |
| 1020 | alive = &spec->int_mic; |
| 1021 | dead = &spec->ext_mic; |
| 1022 | } |
| 1023 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1024 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); |
| 1025 | if (type == AC_WID_AUD_MIX) { |
| 1026 | /* Matrix-mixer style (e.g. ALC882) */ |
| 1027 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1028 | alive->mux_idx, |
| 1029 | HDA_AMP_MUTE, 0); |
| 1030 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, |
| 1031 | dead->mux_idx, |
| 1032 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 1033 | } else { |
| 1034 | /* MUX style (e.g. ALC880) */ |
| 1035 | snd_hda_codec_write_cache(codec, cap_nid, 0, |
| 1036 | AC_VERB_SET_CONNECT_SEL, |
| 1037 | alive->mux_idx); |
| 1038 | } |
| 1039 | |
| 1040 | /* FIXME: analog mixer */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1041 | } |
| 1042 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1043 | /* unsolicited event for HP jack sensing */ |
| 1044 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 1045 | { |
| 1046 | if (codec->vendor_id == 0x10ec0880) |
| 1047 | res >>= 28; |
| 1048 | else |
| 1049 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1050 | switch (res) { |
| 1051 | case ALC880_HP_EVENT: |
| 1052 | alc_automute_pin(codec); |
| 1053 | break; |
| 1054 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1055 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1056 | break; |
| 1057 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | static void alc_inithook(struct hda_codec *codec) |
| 1061 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1062 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1063 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1064 | } |
| 1065 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1066 | /* additional initialization for ALC888 variants */ |
| 1067 | static void alc888_coef_init(struct hda_codec *codec) |
| 1068 | { |
| 1069 | unsigned int tmp; |
| 1070 | |
| 1071 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1072 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1073 | 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] | 1074 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1075 | /* alc888S-VC */ |
| 1076 | snd_hda_codec_read(codec, 0x20, 0, |
| 1077 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1078 | else |
| 1079 | /* alc888-VB */ |
| 1080 | snd_hda_codec_read(codec, 0x20, 0, |
| 1081 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1082 | } |
| 1083 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1084 | static void alc889_coef_init(struct hda_codec *codec) |
| 1085 | { |
| 1086 | unsigned int tmp; |
| 1087 | |
| 1088 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1089 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1090 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1091 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1092 | } |
| 1093 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1094 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1095 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1096 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1097 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1098 | switch (type) { |
| 1099 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1100 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1101 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1103 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1104 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1105 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1106 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1107 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1108 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1109 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1110 | case 0x10ec0260: |
| 1111 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1112 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1113 | snd_hda_codec_write(codec, 0x10, 0, |
| 1114 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1115 | break; |
| 1116 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1117 | case 0x10ec0267: |
| 1118 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1119 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1120 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1121 | case 0x10ec0660: |
| 1122 | case 0x10ec0662: |
| 1123 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1124 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1125 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1126 | snd_hda_codec_write(codec, 0x14, 0, |
| 1127 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1128 | snd_hda_codec_write(codec, 0x15, 0, |
| 1129 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1130 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1131 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1132 | switch (codec->vendor_id) { |
| 1133 | case 0x10ec0260: |
| 1134 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1135 | AC_VERB_SET_COEF_INDEX, 7); |
| 1136 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1137 | AC_VERB_GET_PROC_COEF, 0); |
| 1138 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1139 | AC_VERB_SET_COEF_INDEX, 7); |
| 1140 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1141 | AC_VERB_SET_PROC_COEF, |
| 1142 | tmp | 0x2010); |
| 1143 | break; |
| 1144 | case 0x10ec0262: |
| 1145 | case 0x10ec0880: |
| 1146 | case 0x10ec0882: |
| 1147 | case 0x10ec0883: |
| 1148 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1149 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1150 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1151 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1152 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1153 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1154 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1155 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1156 | case 0x10ec0267: |
| 1157 | case 0x10ec0268: |
| 1158 | snd_hda_codec_write(codec, 0x20, 0, |
| 1159 | AC_VERB_SET_COEF_INDEX, 7); |
| 1160 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1161 | AC_VERB_GET_PROC_COEF, 0); |
| 1162 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1163 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1164 | snd_hda_codec_write(codec, 0x20, 0, |
| 1165 | AC_VERB_SET_PROC_COEF, |
| 1166 | tmp | 0x3000); |
| 1167 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1168 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1169 | break; |
| 1170 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1171 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1172 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1173 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1174 | { |
| 1175 | struct alc_spec *spec = codec->spec; |
| 1176 | |
| 1177 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1178 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1179 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1180 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1181 | if (spec->autocfg.line_out_pins[0] && |
| 1182 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1183 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1184 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1185 | else |
| 1186 | return; |
| 1187 | } |
| 1188 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1189 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1190 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1191 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1192 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1193 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1194 | spec->unsol_event = alc_sku_unsol_event; |
| 1195 | } |
| 1196 | |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1197 | static void alc_init_auto_mic(struct hda_codec *codec) |
| 1198 | { |
| 1199 | struct alc_spec *spec = codec->spec; |
| 1200 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1201 | hda_nid_t fixed, ext; |
| 1202 | int i; |
| 1203 | |
| 1204 | /* there must be only two mic inputs exclusively */ |
| 1205 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) |
| 1206 | if (cfg->input_pins[i]) |
| 1207 | return; |
| 1208 | |
| 1209 | fixed = ext = 0; |
| 1210 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { |
| 1211 | hda_nid_t nid = cfg->input_pins[i]; |
| 1212 | unsigned int defcfg; |
| 1213 | if (!nid) |
| 1214 | return; |
| 1215 | defcfg = snd_hda_codec_get_pincfg(codec, nid); |
| 1216 | switch (get_defcfg_connect(defcfg)) { |
| 1217 | case AC_JACK_PORT_FIXED: |
| 1218 | if (fixed) |
| 1219 | return; /* already occupied */ |
| 1220 | fixed = nid; |
| 1221 | break; |
| 1222 | case AC_JACK_PORT_COMPLEX: |
| 1223 | if (ext) |
| 1224 | return; /* already occupied */ |
| 1225 | ext = nid; |
| 1226 | break; |
| 1227 | default: |
| 1228 | return; /* invalid entry */ |
| 1229 | } |
| 1230 | } |
| 1231 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 1232 | return; /* no unsol support */ |
| 1233 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", |
| 1234 | ext, fixed); |
| 1235 | spec->ext_mic.pin = ext; |
| 1236 | spec->int_mic.pin = fixed; |
| 1237 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1238 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ |
| 1239 | spec->auto_mic = 1; |
| 1240 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, |
| 1241 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1242 | AC_USRSP_EN | ALC880_MIC_EVENT); |
| 1243 | spec->unsol_event = alc_sku_unsol_event; |
| 1244 | } |
| 1245 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1246 | /* check subsystem ID and set up device-specific initialization; |
| 1247 | * return 1 if initialized, 0 if invalid SSID |
| 1248 | */ |
| 1249 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1250 | * 31 ~ 16 : Manufacture ID |
| 1251 | * 15 ~ 8 : SKU ID |
| 1252 | * 7 ~ 0 : Assembly ID |
| 1253 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1254 | */ |
| 1255 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1256 | hda_nid_t porta, hda_nid_t porte, |
| 1257 | hda_nid_t portd) |
| 1258 | { |
| 1259 | unsigned int ass, tmp, i; |
| 1260 | unsigned nid; |
| 1261 | struct alc_spec *spec = codec->spec; |
| 1262 | |
| 1263 | ass = codec->subsystem_id & 0xffff; |
| 1264 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1265 | goto do_sku; |
| 1266 | |
| 1267 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1268 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1269 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1270 | * 29~21 : reserve |
| 1271 | * 20 : PCBEEP input |
| 1272 | * 19~16 : Check sum (15:1) |
| 1273 | * 15~1 : Custom |
| 1274 | * 0 : override |
| 1275 | */ |
| 1276 | nid = 0x1d; |
| 1277 | if (codec->vendor_id == 0x10ec0260) |
| 1278 | nid = 0x17; |
| 1279 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1280 | snd_printd("realtek: No valid SSID, " |
| 1281 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1282 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1283 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1284 | return 0; |
| 1285 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1286 | return 0; |
| 1287 | |
| 1288 | /* check sum */ |
| 1289 | tmp = 0; |
| 1290 | for (i = 1; i < 16; i++) { |
| 1291 | if ((ass >> i) & 1) |
| 1292 | tmp++; |
| 1293 | } |
| 1294 | if (((ass >> 16) & 0xf) != tmp) |
| 1295 | return 0; |
| 1296 | do_sku: |
| 1297 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1298 | ass & 0xffff, codec->vendor_id); |
| 1299 | /* |
| 1300 | * 0 : override |
| 1301 | * 1 : Swap Jack |
| 1302 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1303 | * 3~5 : External Amplifier control |
| 1304 | * 7~6 : Reserved |
| 1305 | */ |
| 1306 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1307 | switch (tmp) { |
| 1308 | case 1: |
| 1309 | spec->init_amp = ALC_INIT_GPIO1; |
| 1310 | break; |
| 1311 | case 3: |
| 1312 | spec->init_amp = ALC_INIT_GPIO2; |
| 1313 | break; |
| 1314 | case 7: |
| 1315 | spec->init_amp = ALC_INIT_GPIO3; |
| 1316 | break; |
| 1317 | case 5: |
| 1318 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1319 | break; |
| 1320 | } |
| 1321 | |
| 1322 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1323 | * when the external headphone out jack is plugged" |
| 1324 | */ |
| 1325 | if (!(ass & 0x8000)) |
| 1326 | return 1; |
| 1327 | /* |
| 1328 | * 10~8 : Jack location |
| 1329 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1330 | * 14~13: Resvered |
| 1331 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1332 | * when the external headphone out jack is plugged" |
| 1333 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1334 | if (!spec->autocfg.hp_pins[0]) { |
| 1335 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1336 | if (tmp == 0) |
| 1337 | spec->autocfg.hp_pins[0] = porta; |
| 1338 | else if (tmp == 1) |
| 1339 | spec->autocfg.hp_pins[0] = porte; |
| 1340 | else if (tmp == 2) |
| 1341 | spec->autocfg.hp_pins[0] = portd; |
| 1342 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1343 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1344 | } |
| 1345 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1346 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1347 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1348 | return 1; |
| 1349 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1350 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1351 | static void alc_ssid_check(struct hda_codec *codec, |
| 1352 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1353 | { |
| 1354 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1355 | struct alc_spec *spec = codec->spec; |
| 1356 | snd_printd("realtek: " |
| 1357 | "Enable default setup for auto mode as fallback\n"); |
| 1358 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1359 | alc_init_auto_hp(codec); |
Takashi Iwai | 6c81949 | 2009-08-10 18:47:44 +0200 | [diff] [blame] | 1360 | alc_init_auto_mic(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1361 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1362 | } |
| 1363 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1364 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1365 | * Fix-up pin default configurations |
| 1366 | */ |
| 1367 | |
| 1368 | struct alc_pincfg { |
| 1369 | hda_nid_t nid; |
| 1370 | u32 val; |
| 1371 | }; |
| 1372 | |
| 1373 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1374 | const struct snd_pci_quirk *quirk, |
| 1375 | const struct alc_pincfg **pinfix) |
| 1376 | { |
| 1377 | const struct alc_pincfg *cfg; |
| 1378 | |
| 1379 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1380 | if (!quirk) |
| 1381 | return; |
| 1382 | |
| 1383 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1384 | for (; cfg->nid; cfg++) |
| 1385 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1386 | } |
| 1387 | |
| 1388 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1389 | * ALC888 |
| 1390 | */ |
| 1391 | |
| 1392 | /* |
| 1393 | * 2ch mode |
| 1394 | */ |
| 1395 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1396 | /* Mic-in jack as mic in */ |
| 1397 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1398 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1399 | /* Line-in jack as Line in */ |
| 1400 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1401 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1402 | /* Line-Out as Front */ |
| 1403 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1404 | { } /* end */ |
| 1405 | }; |
| 1406 | |
| 1407 | /* |
| 1408 | * 4ch mode |
| 1409 | */ |
| 1410 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1411 | /* Mic-in jack as mic in */ |
| 1412 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1413 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1414 | /* Line-in jack as Surround */ |
| 1415 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1416 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1417 | /* Line-Out as Front */ |
| 1418 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1419 | { } /* end */ |
| 1420 | }; |
| 1421 | |
| 1422 | /* |
| 1423 | * 6ch mode |
| 1424 | */ |
| 1425 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1426 | /* Mic-in jack as CLFE */ |
| 1427 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1428 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1429 | /* Line-in jack as Surround */ |
| 1430 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1431 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1432 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1433 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1434 | { } /* end */ |
| 1435 | }; |
| 1436 | |
| 1437 | /* |
| 1438 | * 8ch mode |
| 1439 | */ |
| 1440 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1441 | /* Mic-in jack as CLFE */ |
| 1442 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1443 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1444 | /* Line-in jack as Surround */ |
| 1445 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1446 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1447 | /* Line-Out as Side */ |
| 1448 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1449 | { } /* end */ |
| 1450 | }; |
| 1451 | |
| 1452 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1453 | { 2, alc888_4ST_ch2_intel_init }, |
| 1454 | { 4, alc888_4ST_ch4_intel_init }, |
| 1455 | { 6, alc888_4ST_ch6_intel_init }, |
| 1456 | { 8, alc888_4ST_ch8_intel_init }, |
| 1457 | }; |
| 1458 | |
| 1459 | /* |
| 1460 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1461 | */ |
| 1462 | |
| 1463 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1464 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1465 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1466 | /* Connect Internal HP to Front */ |
| 1467 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1468 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1469 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1470 | /* Connect Bass HP to Front */ |
| 1471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1472 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1473 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1474 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1475 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1477 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1478 | /* Connect Mic jack to CLFE */ |
| 1479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1481 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1482 | /* Connect Line-in jack to Surround */ |
| 1483 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1484 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1485 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1486 | /* Connect HP out jack to Front */ |
| 1487 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1488 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1489 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1490 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1491 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1492 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1493 | {} |
| 1494 | }; |
| 1495 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1496 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1497 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1498 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1499 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1500 | hda_nid_t nid; |
| 1501 | int i; |
| 1502 | |
| 1503 | spec->jack_present = 0; |
| 1504 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1505 | nid = spec->autocfg.hp_pins[i]; |
| 1506 | if (!nid) |
| 1507 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1508 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1509 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1510 | snd_hda_codec_read(codec, nid, 0, |
| 1511 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1512 | val = snd_hda_codec_read(codec, nid, 0, |
| 1513 | AC_VERB_GET_PIN_SENSE, 0); |
| 1514 | if (val & AC_PINSENSE_PRESENCE) { |
| 1515 | spec->jack_present = 1; |
| 1516 | break; |
| 1517 | } |
| 1518 | } |
| 1519 | |
| 1520 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1521 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1522 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1523 | nid = spec->autocfg.speaker_pins[i]; |
| 1524 | if (!nid) |
| 1525 | break; |
| 1526 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1527 | HDA_AMP_MUTE, mute); |
| 1528 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1529 | } |
| 1530 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1531 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1532 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1533 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1534 | if (codec->vendor_id == 0x10ec0880) |
| 1535 | res >>= 28; |
| 1536 | else |
| 1537 | res >>= 26; |
| 1538 | if (res == ALC880_HP_EVENT) |
| 1539 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1540 | } |
| 1541 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1542 | static void alc889_automute_setup(struct hda_codec *codec) |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1543 | { |
| 1544 | struct alc_spec *spec = codec->spec; |
| 1545 | |
| 1546 | spec->autocfg.hp_pins[0] = 0x15; |
| 1547 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1548 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1549 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1550 | spec->autocfg.speaker_pins[3] = 0x19; |
| 1551 | spec->autocfg.speaker_pins[4] = 0x1a; |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1552 | } |
| 1553 | |
| 1554 | static void alc889_intel_init_hook(struct hda_codec *codec) |
| 1555 | { |
| 1556 | alc889_coef_init(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1557 | alc_automute_amp(codec); |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 1558 | } |
| 1559 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1560 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1561 | { |
| 1562 | struct alc_spec *spec = codec->spec; |
| 1563 | |
| 1564 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1565 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1566 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1567 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1568 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1569 | |
| 1570 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1571 | * ALC888 Acer Aspire 4930G model |
| 1572 | */ |
| 1573 | |
| 1574 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1575 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1576 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1577 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1578 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1579 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1580 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1581 | /* Connect Internal HP to front */ |
| 1582 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1583 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1584 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1585 | /* Connect HP out to front */ |
| 1586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1587 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1588 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1589 | { } |
| 1590 | }; |
| 1591 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1592 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1593 | * ALC888 Acer Aspire 6530G model |
| 1594 | */ |
| 1595 | |
| 1596 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1597 | /* Bias voltage on for external mic port */ |
| 1598 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1599 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1600 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1601 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1602 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1603 | /* Enable unsolicited event for HP jack */ |
| 1604 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1605 | /* Enable speaker output */ |
| 1606 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1607 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1608 | /* Enable headphone output */ |
| 1609 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1610 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1611 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1612 | { } |
| 1613 | }; |
| 1614 | |
| 1615 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1616 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1617 | */ |
| 1618 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1619 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1620 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1621 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1622 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1624 | /* Enable unsolicited event for HP jack */ |
| 1625 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1626 | /* Connect Internal Front to Front */ |
| 1627 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1628 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1629 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1630 | /* Connect Internal Rear to Rear */ |
| 1631 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1632 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1633 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1634 | /* Connect Internal CLFE to CLFE */ |
| 1635 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1636 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1637 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1638 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1639 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1640 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1642 | /* Enable all DACs */ |
| 1643 | /* DAC DISABLE/MUTE 1? */ |
| 1644 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1645 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1646 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1647 | /* DAC DISABLE/MUTE 2? */ |
| 1648 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1649 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1650 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1651 | /* Enable amplifiers */ |
| 1652 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1653 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1654 | /* DMIC fix |
| 1655 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1656 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1657 | * makes the signal become a difference/sum signal instead of standard |
| 1658 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1659 | * codec replicate the sum signal to both channels, turning it into a |
| 1660 | * normal mono mic. |
| 1661 | */ |
| 1662 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1663 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1664 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1665 | { } |
| 1666 | }; |
| 1667 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1668 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1669 | /* Front mic only available on one ADC */ |
| 1670 | { |
| 1671 | .num_items = 4, |
| 1672 | .items = { |
| 1673 | { "Mic", 0x0 }, |
| 1674 | { "Line", 0x2 }, |
| 1675 | { "CD", 0x4 }, |
| 1676 | { "Front Mic", 0xb }, |
| 1677 | }, |
| 1678 | }, |
| 1679 | { |
| 1680 | .num_items = 3, |
| 1681 | .items = { |
| 1682 | { "Mic", 0x0 }, |
| 1683 | { "Line", 0x2 }, |
| 1684 | { "CD", 0x4 }, |
| 1685 | }, |
| 1686 | } |
| 1687 | }; |
| 1688 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1689 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1690 | /* Interal mic only available on one ADC */ |
| 1691 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1692 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1693 | .items = { |
| 1694 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1695 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1696 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1697 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1698 | { "Int Mic", 0xb }, |
| 1699 | }, |
| 1700 | }, |
| 1701 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1702 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1703 | .items = { |
| 1704 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1705 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1706 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1707 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1708 | }, |
| 1709 | } |
| 1710 | }; |
| 1711 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1712 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1713 | /* Digital mic only available on first "ADC" */ |
| 1714 | { |
| 1715 | .num_items = 5, |
| 1716 | .items = { |
| 1717 | { "Mic", 0x0 }, |
| 1718 | { "Line", 0x2 }, |
| 1719 | { "CD", 0x4 }, |
| 1720 | { "Front Mic", 0xb }, |
| 1721 | { "Input Mix", 0xa }, |
| 1722 | }, |
| 1723 | }, |
| 1724 | { |
| 1725 | .num_items = 4, |
| 1726 | .items = { |
| 1727 | { "Mic", 0x0 }, |
| 1728 | { "Line", 0x2 }, |
| 1729 | { "CD", 0x4 }, |
| 1730 | { "Input Mix", 0xa }, |
| 1731 | }, |
| 1732 | }, |
| 1733 | { |
| 1734 | .num_items = 4, |
| 1735 | .items = { |
| 1736 | { "Mic", 0x0 }, |
| 1737 | { "Line", 0x2 }, |
| 1738 | { "CD", 0x4 }, |
| 1739 | { "Input Mix", 0xa }, |
| 1740 | }, |
| 1741 | } |
| 1742 | }; |
| 1743 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1744 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1745 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1746 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1747 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1748 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1749 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1750 | HDA_OUTPUT), |
| 1751 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1752 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1753 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1754 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1755 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1758 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1759 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1760 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1761 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1763 | { } /* end */ |
| 1764 | }; |
| 1765 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1766 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1767 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1768 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1769 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1770 | spec->autocfg.hp_pins[0] = 0x15; |
| 1771 | spec->autocfg.speaker_pins[0] = 0x14; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1772 | } |
| 1773 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1774 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1775 | { |
| 1776 | struct alc_spec *spec = codec->spec; |
| 1777 | |
| 1778 | spec->autocfg.hp_pins[0] = 0x15; |
| 1779 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1780 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1781 | spec->autocfg.speaker_pins[2] = 0x17; |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1782 | } |
| 1783 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 1784 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1785 | { |
| 1786 | struct alc_spec *spec = codec->spec; |
| 1787 | |
| 1788 | spec->autocfg.hp_pins[0] = 0x15; |
| 1789 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1790 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1791 | spec->autocfg.speaker_pins[2] = 0x1b; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1792 | } |
| 1793 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1794 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1795 | * ALC880 3-stack model |
| 1796 | * |
| 1797 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1798 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1799 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1800 | */ |
| 1801 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1802 | static hda_nid_t alc880_dac_nids[4] = { |
| 1803 | /* front, rear, clfe, rear_surr */ |
| 1804 | 0x02, 0x05, 0x04, 0x03 |
| 1805 | }; |
| 1806 | |
| 1807 | static hda_nid_t alc880_adc_nids[3] = { |
| 1808 | /* ADC0-2 */ |
| 1809 | 0x07, 0x08, 0x09, |
| 1810 | }; |
| 1811 | |
| 1812 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1813 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1814 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1815 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1816 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1817 | /* ADC1-2 */ |
| 1818 | 0x08, 0x09, |
| 1819 | }; |
| 1820 | |
| 1821 | #define ALC880_DIGOUT_NID 0x06 |
| 1822 | #define ALC880_DIGIN_NID 0x0a |
| 1823 | |
| 1824 | static struct hda_input_mux alc880_capture_source = { |
| 1825 | .num_items = 4, |
| 1826 | .items = { |
| 1827 | { "Mic", 0x0 }, |
| 1828 | { "Front Mic", 0x3 }, |
| 1829 | { "Line", 0x2 }, |
| 1830 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1831 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1832 | }; |
| 1833 | |
| 1834 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1835 | /* 2ch mode */ |
| 1836 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1837 | /* set line-in to input, mute it */ |
| 1838 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1839 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1840 | /* set mic-in to input vref 80%, mute it */ |
| 1841 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1842 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1843 | { } /* end */ |
| 1844 | }; |
| 1845 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1846 | /* 6ch mode */ |
| 1847 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1848 | /* set line-in to output, unmute it */ |
| 1849 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1850 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1851 | /* set mic-in to output, unmute it */ |
| 1852 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1853 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1854 | { } /* end */ |
| 1855 | }; |
| 1856 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1857 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1858 | { 2, alc880_threestack_ch2_init }, |
| 1859 | { 6, alc880_threestack_ch6_init }, |
| 1860 | }; |
| 1861 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1862 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1864 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1865 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1866 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1867 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1868 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1869 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1870 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1871 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1872 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1873 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1874 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1875 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1876 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1877 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1878 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1880 | { |
| 1881 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1882 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1883 | .info = alc_ch_mode_info, |
| 1884 | .get = alc_ch_mode_get, |
| 1885 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1886 | }, |
| 1887 | { } /* end */ |
| 1888 | }; |
| 1889 | |
| 1890 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1891 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1892 | struct snd_ctl_elem_info *uinfo) |
| 1893 | { |
| 1894 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1895 | struct alc_spec *spec = codec->spec; |
| 1896 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1897 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1898 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1899 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1900 | HDA_INPUT); |
| 1901 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1902 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1903 | return err; |
| 1904 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1905 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1906 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1907 | unsigned int size, unsigned int __user *tlv) |
| 1908 | { |
| 1909 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1910 | struct alc_spec *spec = codec->spec; |
| 1911 | int err; |
| 1912 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1913 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1914 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1915 | HDA_INPUT); |
| 1916 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1917 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1918 | return err; |
| 1919 | } |
| 1920 | |
| 1921 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1922 | struct snd_ctl_elem_value *ucontrol); |
| 1923 | |
| 1924 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1925 | struct snd_ctl_elem_value *ucontrol, |
| 1926 | getput_call_t func) |
| 1927 | { |
| 1928 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1929 | struct alc_spec *spec = codec->spec; |
| 1930 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1931 | int err; |
| 1932 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1933 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1934 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1935 | 3, 0, HDA_INPUT); |
| 1936 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1937 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1938 | return err; |
| 1939 | } |
| 1940 | |
| 1941 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1942 | struct snd_ctl_elem_value *ucontrol) |
| 1943 | { |
| 1944 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1945 | snd_hda_mixer_amp_volume_get); |
| 1946 | } |
| 1947 | |
| 1948 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1949 | struct snd_ctl_elem_value *ucontrol) |
| 1950 | { |
| 1951 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1952 | snd_hda_mixer_amp_volume_put); |
| 1953 | } |
| 1954 | |
| 1955 | /* capture mixer elements */ |
| 1956 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1957 | |
| 1958 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1959 | struct snd_ctl_elem_value *ucontrol) |
| 1960 | { |
| 1961 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1962 | snd_hda_mixer_amp_switch_get); |
| 1963 | } |
| 1964 | |
| 1965 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1966 | struct snd_ctl_elem_value *ucontrol) |
| 1967 | { |
| 1968 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1969 | snd_hda_mixer_amp_switch_put); |
| 1970 | } |
| 1971 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1972 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1973 | { \ |
| 1974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1975 | .name = "Capture Switch", \ |
| 1976 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1977 | .count = num, \ |
| 1978 | .info = alc_cap_sw_info, \ |
| 1979 | .get = alc_cap_sw_get, \ |
| 1980 | .put = alc_cap_sw_put, \ |
| 1981 | }, \ |
| 1982 | { \ |
| 1983 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1984 | .name = "Capture Volume", \ |
| 1985 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1986 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1987 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1988 | .count = num, \ |
| 1989 | .info = alc_cap_vol_info, \ |
| 1990 | .get = alc_cap_vol_get, \ |
| 1991 | .put = alc_cap_vol_put, \ |
| 1992 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1993 | } |
| 1994 | |
| 1995 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1996 | { \ |
| 1997 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1998 | /* .name = "Capture Source", */ \ |
| 1999 | .name = "Input Source", \ |
| 2000 | .count = num, \ |
| 2001 | .info = alc_mux_enum_info, \ |
| 2002 | .get = alc_mux_enum_get, \ |
| 2003 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2004 | } |
| 2005 | |
| 2006 | #define DEFINE_CAPMIX(num) \ |
| 2007 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 2008 | _DEFINE_CAPMIX(num), \ |
| 2009 | _DEFINE_CAPSRC(num), \ |
| 2010 | { } /* end */ \ |
| 2011 | } |
| 2012 | |
| 2013 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 2014 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 2015 | _DEFINE_CAPMIX(num), \ |
| 2016 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2017 | } |
| 2018 | |
| 2019 | /* up to three ADCs */ |
| 2020 | DEFINE_CAPMIX(1); |
| 2021 | DEFINE_CAPMIX(2); |
| 2022 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 2023 | DEFINE_CAPMIX_NOSRC(1); |
| 2024 | DEFINE_CAPMIX_NOSRC(2); |
| 2025 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2026 | |
| 2027 | /* |
| 2028 | * ALC880 5-stack model |
| 2029 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2030 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 2031 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2032 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 2033 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 2034 | */ |
| 2035 | |
| 2036 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2037 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2038 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2039 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2040 | { } /* end */ |
| 2041 | }; |
| 2042 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2043 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 2044 | /* 6ch mode */ |
| 2045 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 2046 | /* set line-in to input, mute it */ |
| 2047 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2048 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2049 | { } /* end */ |
| 2050 | }; |
| 2051 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2052 | /* 8ch mode */ |
| 2053 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 2054 | /* set line-in to output, unmute it */ |
| 2055 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 2056 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 2057 | { } /* end */ |
| 2058 | }; |
| 2059 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2060 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2061 | { 6, alc880_fivestack_ch6_init }, |
| 2062 | { 8, alc880_fivestack_ch8_init }, |
| 2063 | }; |
| 2064 | |
| 2065 | |
| 2066 | /* |
| 2067 | * ALC880 6-stack model |
| 2068 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2069 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 2070 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2071 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 2072 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 2073 | */ |
| 2074 | |
| 2075 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 2076 | /* front, rear, clfe, rear_surr */ |
| 2077 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2078 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2079 | |
| 2080 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 2081 | .num_items = 4, |
| 2082 | .items = { |
| 2083 | { "Mic", 0x0 }, |
| 2084 | { "Front Mic", 0x1 }, |
| 2085 | { "Line", 0x2 }, |
| 2086 | { "CD", 0x4 }, |
| 2087 | }, |
| 2088 | }; |
| 2089 | |
| 2090 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2091 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2092 | { 8, NULL }, |
| 2093 | }; |
| 2094 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2095 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2097 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2098 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2099 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2100 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2101 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2102 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2103 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2105 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2107 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2108 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2111 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2112 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2113 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2114 | { |
| 2115 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2116 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2117 | .info = alc_ch_mode_info, |
| 2118 | .get = alc_ch_mode_get, |
| 2119 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2120 | }, |
| 2121 | { } /* end */ |
| 2122 | }; |
| 2123 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2124 | |
| 2125 | /* |
| 2126 | * ALC880 W810 model |
| 2127 | * |
| 2128 | * W810 has rear IO for: |
| 2129 | * Front (DAC 02) |
| 2130 | * Surround (DAC 03) |
| 2131 | * Center/LFE (DAC 04) |
| 2132 | * Digital out (06) |
| 2133 | * |
| 2134 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2135 | * 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] | 2136 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2137 | * There is a variable resistor to control the speaker or headphone |
| 2138 | * volume. This is a hardware-only device without a software API. |
| 2139 | * |
| 2140 | * Plugging headphones in will disable the internal speakers. This is |
| 2141 | * implemented in hardware, not via the driver using jack sense. In |
| 2142 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2143 | * disable both the speakers and headphones. |
| 2144 | * |
| 2145 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2146 | * These may not do anything useful with this driver yet, because I |
| 2147 | * haven't setup any initialization verbs for these yet... |
| 2148 | */ |
| 2149 | |
| 2150 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2151 | /* front, rear/surround, clfe */ |
| 2152 | 0x02, 0x03, 0x04 |
| 2153 | }; |
| 2154 | |
| 2155 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2156 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2157 | { 6, NULL } |
| 2158 | }; |
| 2159 | |
| 2160 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2161 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2162 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2163 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2164 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2165 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2166 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2167 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2168 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2169 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2170 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2171 | { } /* end */ |
| 2172 | }; |
| 2173 | |
| 2174 | |
| 2175 | /* |
| 2176 | * Z710V model |
| 2177 | * |
| 2178 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2179 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2180 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2181 | */ |
| 2182 | |
| 2183 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2184 | 0x02 |
| 2185 | }; |
| 2186 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2187 | |
| 2188 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2189 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2190 | { 2, NULL } |
| 2191 | }; |
| 2192 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2193 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2194 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2195 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2196 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2197 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2198 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2200 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2202 | { } /* end */ |
| 2203 | }; |
| 2204 | |
| 2205 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2206 | /* |
| 2207 | * ALC880 F1734 model |
| 2208 | * |
| 2209 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2210 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2211 | */ |
| 2212 | |
| 2213 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2214 | 0x03 |
| 2215 | }; |
| 2216 | #define ALC880_F1734_HP_DAC 0x02 |
| 2217 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2218 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2219 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2220 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2221 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2222 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2223 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2224 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2225 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2226 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2227 | { } /* end */ |
| 2228 | }; |
| 2229 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2230 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2231 | .num_items = 2, |
| 2232 | .items = { |
| 2233 | { "Mic", 0x1 }, |
| 2234 | { "CD", 0x4 }, |
| 2235 | }, |
| 2236 | }; |
| 2237 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2238 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2239 | /* |
| 2240 | * ALC880 ASUS model |
| 2241 | * |
| 2242 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2243 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2244 | * Mic = 0x18, Line = 0x1a |
| 2245 | */ |
| 2246 | |
| 2247 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2248 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2249 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2250 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2251 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2252 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2253 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2254 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2255 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2256 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2257 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2258 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2259 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2260 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2261 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2262 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2263 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2265 | { |
| 2266 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2267 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2268 | .info = alc_ch_mode_info, |
| 2269 | .get = alc_ch_mode_get, |
| 2270 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2271 | }, |
| 2272 | { } /* end */ |
| 2273 | }; |
| 2274 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2275 | /* |
| 2276 | * ALC880 ASUS W1V model |
| 2277 | * |
| 2278 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2279 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2280 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2281 | */ |
| 2282 | |
| 2283 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2284 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2285 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2287 | { } /* end */ |
| 2288 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2289 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2290 | /* TCL S700 */ |
| 2291 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2292 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2293 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2294 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2295 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2296 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2297 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2298 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2299 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2300 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2301 | { } /* end */ |
| 2302 | }; |
| 2303 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2304 | /* Uniwill */ |
| 2305 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2306 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2307 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2308 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2309 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2310 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2311 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2312 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2313 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2314 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2315 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2316 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2317 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2318 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2319 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2320 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2321 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2322 | { |
| 2323 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2324 | .name = "Channel Mode", |
| 2325 | .info = alc_ch_mode_info, |
| 2326 | .get = alc_ch_mode_get, |
| 2327 | .put = alc_ch_mode_put, |
| 2328 | }, |
| 2329 | { } /* end */ |
| 2330 | }; |
| 2331 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2332 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2333 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2334 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2335 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2336 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2337 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2338 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2339 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2340 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2341 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2342 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2343 | { } /* end */ |
| 2344 | }; |
| 2345 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2346 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2347 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2348 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2349 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2350 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2353 | { } /* end */ |
| 2354 | }; |
| 2355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2357 | * virtual master controls |
| 2358 | */ |
| 2359 | |
| 2360 | /* |
| 2361 | * slave controls for virtual master |
| 2362 | */ |
| 2363 | static const char *alc_slave_vols[] = { |
| 2364 | "Front Playback Volume", |
| 2365 | "Surround Playback Volume", |
| 2366 | "Center Playback Volume", |
| 2367 | "LFE Playback Volume", |
| 2368 | "Side Playback Volume", |
| 2369 | "Headphone Playback Volume", |
| 2370 | "Speaker Playback Volume", |
| 2371 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2372 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2373 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2374 | NULL, |
| 2375 | }; |
| 2376 | |
| 2377 | static const char *alc_slave_sws[] = { |
| 2378 | "Front Playback Switch", |
| 2379 | "Surround Playback Switch", |
| 2380 | "Center Playback Switch", |
| 2381 | "LFE Playback Switch", |
| 2382 | "Side Playback Switch", |
| 2383 | "Headphone Playback Switch", |
| 2384 | "Speaker Playback Switch", |
| 2385 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2386 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2387 | NULL, |
| 2388 | }; |
| 2389 | |
| 2390 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2391 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2392 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2393 | |
| 2394 | static void alc_free_kctls(struct hda_codec *codec); |
| 2395 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2396 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2397 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2398 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2399 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2400 | { } /* end */ |
| 2401 | }; |
| 2402 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2403 | static int alc_build_controls(struct hda_codec *codec) |
| 2404 | { |
| 2405 | struct alc_spec *spec = codec->spec; |
| 2406 | int err; |
| 2407 | int i; |
| 2408 | |
| 2409 | for (i = 0; i < spec->num_mixers; i++) { |
| 2410 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2411 | if (err < 0) |
| 2412 | return err; |
| 2413 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2414 | if (spec->cap_mixer) { |
| 2415 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2416 | if (err < 0) |
| 2417 | return err; |
| 2418 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2419 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2420 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2421 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | if (err < 0) |
| 2423 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2424 | if (!spec->no_analog) { |
| 2425 | err = snd_hda_create_spdif_share_sw(codec, |
| 2426 | &spec->multiout); |
| 2427 | if (err < 0) |
| 2428 | return err; |
| 2429 | spec->multiout.share_spdif = 1; |
| 2430 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2431 | } |
| 2432 | if (spec->dig_in_nid) { |
| 2433 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2434 | if (err < 0) |
| 2435 | return err; |
| 2436 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2437 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2438 | /* create beep controls if needed */ |
| 2439 | if (spec->beep_amp) { |
| 2440 | struct snd_kcontrol_new *knew; |
| 2441 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2442 | struct snd_kcontrol *kctl; |
| 2443 | kctl = snd_ctl_new1(knew, codec); |
| 2444 | if (!kctl) |
| 2445 | return -ENOMEM; |
| 2446 | kctl->private_value = spec->beep_amp; |
| 2447 | err = snd_hda_ctl_add(codec, kctl); |
| 2448 | if (err < 0) |
| 2449 | return err; |
| 2450 | } |
| 2451 | } |
| 2452 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2453 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2454 | if (!spec->no_analog && |
| 2455 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2456 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2457 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2458 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2459 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2460 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2461 | if (err < 0) |
| 2462 | return err; |
| 2463 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2464 | if (!spec->no_analog && |
| 2465 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2466 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2467 | NULL, alc_slave_sws); |
| 2468 | if (err < 0) |
| 2469 | return err; |
| 2470 | } |
| 2471 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2472 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2473 | return 0; |
| 2474 | } |
| 2475 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2476 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2477 | /* |
| 2478 | * initialize the codec volumes, etc |
| 2479 | */ |
| 2480 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2481 | /* |
| 2482 | * generic initialization of ADC, input mixers and output mixers |
| 2483 | */ |
| 2484 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2485 | /* |
| 2486 | * Unmute ADC0-2 and set the default input to mic-in |
| 2487 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2488 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2489 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2490 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2491 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2492 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2493 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2494 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2495 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2496 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2497 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2498 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2499 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2500 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2505 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2506 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2507 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2508 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2509 | /* |
| 2510 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2511 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2512 | /* set vol=0 to output mixers */ |
| 2513 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2514 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2515 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2516 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2517 | /* set up input amps for analog loopback */ |
| 2518 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2519 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2520 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2521 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2522 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2523 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2524 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2525 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2526 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | |
| 2528 | { } |
| 2529 | }; |
| 2530 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2531 | /* |
| 2532 | * 3-stack pin configuration: |
| 2533 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2534 | */ |
| 2535 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2536 | /* |
| 2537 | * preset connection lists of input pins |
| 2538 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2539 | */ |
| 2540 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2541 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2542 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2543 | |
| 2544 | /* |
| 2545 | * Set pin mode and muting |
| 2546 | */ |
| 2547 | /* set front pin widgets 0x14 for output */ |
| 2548 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2549 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2550 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2551 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2552 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2553 | /* Mic2 (as headphone out) for HP output */ |
| 2554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2556 | /* Line In pin widget for input */ |
| 2557 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2558 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2559 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2560 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2561 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2562 | /* CD pin widget for input */ |
| 2563 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2564 | |
| 2565 | { } |
| 2566 | }; |
| 2567 | |
| 2568 | /* |
| 2569 | * 5-stack pin configuration: |
| 2570 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2571 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2572 | */ |
| 2573 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2574 | /* |
| 2575 | * preset connection lists of input pins |
| 2576 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2577 | */ |
| 2578 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2579 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2580 | |
| 2581 | /* |
| 2582 | * Set pin mode and muting |
| 2583 | */ |
| 2584 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2587 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2588 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2589 | /* unmute pins for output (no gain on this amp) */ |
| 2590 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2591 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2592 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2593 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2594 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2595 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2596 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2597 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2598 | /* Mic2 (as headphone out) for HP output */ |
| 2599 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2600 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2601 | /* Line In pin widget for input */ |
| 2602 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2603 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2604 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2605 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2606 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2607 | /* CD pin widget for input */ |
| 2608 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2609 | |
| 2610 | { } |
| 2611 | }; |
| 2612 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2613 | /* |
| 2614 | * W810 pin configuration: |
| 2615 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2616 | */ |
| 2617 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2618 | /* hphone/speaker input selector: front DAC */ |
| 2619 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2620 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2622 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2623 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2625 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2626 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2627 | |
| 2628 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2629 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2630 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2631 | { } |
| 2632 | }; |
| 2633 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2634 | /* |
| 2635 | * Z71V pin configuration: |
| 2636 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2637 | */ |
| 2638 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2640 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2641 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2642 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2643 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2644 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2646 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2647 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2648 | |
| 2649 | { } |
| 2650 | }; |
| 2651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2652 | /* |
| 2653 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2654 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2655 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2656 | */ |
| 2657 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2658 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2659 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2660 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2661 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2662 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2663 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2664 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2665 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2666 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2667 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2668 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2669 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2670 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2671 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2672 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2673 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2674 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2675 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2676 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2677 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2678 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2679 | { } |
| 2680 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2681 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2682 | /* |
| 2683 | * Uniwill pin configuration: |
| 2684 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2685 | * line = 0x1a |
| 2686 | */ |
| 2687 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2688 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2689 | |
| 2690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2692 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2693 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2694 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2695 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2696 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2697 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2698 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2699 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2700 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2701 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2703 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2704 | |
| 2705 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2706 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2707 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2708 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2709 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2710 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2711 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2712 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2713 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2714 | |
| 2715 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2716 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2717 | |
| 2718 | { } |
| 2719 | }; |
| 2720 | |
| 2721 | /* |
| 2722 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2723 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2724 | */ |
| 2725 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2726 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2727 | |
| 2728 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2729 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2732 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2733 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2735 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2739 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2740 | |
| 2741 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2742 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2743 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2744 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2745 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2746 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2747 | |
| 2748 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2749 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2750 | |
| 2751 | { } |
| 2752 | }; |
| 2753 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2754 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2755 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2756 | { } |
| 2757 | }; |
| 2758 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2759 | /* auto-toggle front mic */ |
| 2760 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2761 | { |
| 2762 | unsigned int present; |
| 2763 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2764 | |
| 2765 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2766 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2767 | bits = present ? HDA_AMP_MUTE : 0; |
| 2768 | 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] | 2769 | } |
| 2770 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2771 | static void alc880_uniwill_setup(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2772 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2773 | struct alc_spec *spec = codec->spec; |
| 2774 | |
| 2775 | spec->autocfg.hp_pins[0] = 0x14; |
| 2776 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2777 | spec->autocfg.speaker_pins[0] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2778 | } |
| 2779 | |
| 2780 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
| 2781 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2782 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2783 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2784 | } |
| 2785 | |
| 2786 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2787 | unsigned int res) |
| 2788 | { |
| 2789 | /* Looks like the unsol event is incompatible with the standard |
| 2790 | * definition. 4bit tag is placed at 28 bit! |
| 2791 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2792 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2793 | case ALC880_MIC_EVENT: |
| 2794 | alc880_uniwill_mic_automute(codec); |
| 2795 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2796 | default: |
| 2797 | alc_automute_amp_unsol_event(codec, res); |
| 2798 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2799 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2800 | } |
| 2801 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 2802 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2803 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2804 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2805 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2806 | spec->autocfg.hp_pins[0] = 0x14; |
| 2807 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2808 | } |
| 2809 | |
| 2810 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2811 | { |
| 2812 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2813 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2814 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2815 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2816 | present &= HDA_AMP_VOLMASK; |
| 2817 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2818 | HDA_AMP_VOLMASK, present); |
| 2819 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2820 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2821 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2822 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2823 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2824 | unsigned int res) |
| 2825 | { |
| 2826 | /* Looks like the unsol event is incompatible with the standard |
| 2827 | * definition. 4bit tag is placed at 28 bit! |
| 2828 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2829 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2830 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2831 | else |
| 2832 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2833 | } |
| 2834 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2835 | /* |
| 2836 | * F1734 pin configuration: |
| 2837 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2838 | */ |
| 2839 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2840 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2841 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2842 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2843 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2844 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2845 | |
| 2846 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2847 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2848 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2850 | |
| 2851 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2852 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2853 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2854 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2855 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2856 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2857 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2858 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2859 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2860 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2861 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2862 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2863 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2864 | { } |
| 2865 | }; |
| 2866 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2867 | /* |
| 2868 | * ASUS pin configuration: |
| 2869 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2870 | */ |
| 2871 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2872 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2873 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2874 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2875 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2876 | |
| 2877 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2878 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2879 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2880 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2881 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2882 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2883 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2885 | |
| 2886 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2887 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2888 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2889 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2890 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2891 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2892 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2894 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2895 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2896 | { } |
| 2897 | }; |
| 2898 | |
| 2899 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2900 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2901 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2902 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2903 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2904 | /* Clevo m520g init */ |
| 2905 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2906 | /* headphone output */ |
| 2907 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2908 | /* line-out */ |
| 2909 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2910 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2911 | /* Line-in */ |
| 2912 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2913 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2914 | /* CD */ |
| 2915 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2916 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2917 | /* Mic1 (rear panel) */ |
| 2918 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2919 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2920 | /* Mic2 (front panel) */ |
| 2921 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2922 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2923 | /* headphone */ |
| 2924 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2925 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2926 | /* change to EAPD mode */ |
| 2927 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2928 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2929 | |
| 2930 | { } |
| 2931 | }; |
| 2932 | |
| 2933 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2934 | /* change to EAPD mode */ |
| 2935 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2936 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2937 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2938 | /* Headphone output */ |
| 2939 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2940 | /* Front output*/ |
| 2941 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2943 | |
| 2944 | /* Line In pin widget for input */ |
| 2945 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2946 | /* CD pin widget for input */ |
| 2947 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2948 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2950 | |
| 2951 | /* change to EAPD mode */ |
| 2952 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2953 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2954 | |
| 2955 | { } |
| 2956 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2957 | |
| 2958 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2959 | * LG m1 express dual |
| 2960 | * |
| 2961 | * Pin assignment: |
| 2962 | * Rear Line-In/Out (blue): 0x14 |
| 2963 | * Build-in Mic-In: 0x15 |
| 2964 | * Speaker-out: 0x17 |
| 2965 | * HP-Out (green): 0x1b |
| 2966 | * Mic-In/Out (red): 0x19 |
| 2967 | * SPDIF-Out: 0x1e |
| 2968 | */ |
| 2969 | |
| 2970 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2971 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2972 | 0x05, 0x02, 0x03 |
| 2973 | }; |
| 2974 | |
| 2975 | /* seems analog CD is not working */ |
| 2976 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2977 | .num_items = 3, |
| 2978 | .items = { |
| 2979 | { "Mic", 0x1 }, |
| 2980 | { "Line", 0x5 }, |
| 2981 | { "Internal Mic", 0x6 }, |
| 2982 | }, |
| 2983 | }; |
| 2984 | |
| 2985 | /* 2,4,6 channel modes */ |
| 2986 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2987 | /* set line-in and mic-in to input */ |
| 2988 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2989 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2990 | { } |
| 2991 | }; |
| 2992 | |
| 2993 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2994 | /* set line-in to out and mic-in to input */ |
| 2995 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2996 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2997 | { } |
| 2998 | }; |
| 2999 | |
| 3000 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 3001 | /* set line-in and mic-in to output */ |
| 3002 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3003 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 3004 | { } |
| 3005 | }; |
| 3006 | |
| 3007 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 3008 | { 2, alc880_lg_ch2_init }, |
| 3009 | { 4, alc880_lg_ch4_init }, |
| 3010 | { 6, alc880_lg_ch6_init }, |
| 3011 | }; |
| 3012 | |
| 3013 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3014 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3015 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3016 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3017 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3018 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 3019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 3020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 3021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 3022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3024 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 3025 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 3026 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 3027 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 3028 | { |
| 3029 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3030 | .name = "Channel Mode", |
| 3031 | .info = alc_ch_mode_info, |
| 3032 | .get = alc_ch_mode_get, |
| 3033 | .put = alc_ch_mode_put, |
| 3034 | }, |
| 3035 | { } /* end */ |
| 3036 | }; |
| 3037 | |
| 3038 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 3039 | /* set capture source to mic-in */ |
| 3040 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3041 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3042 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3043 | /* mute all amp mixer inputs */ |
| 3044 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3045 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 3046 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3047 | /* line-in to input */ |
| 3048 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3050 | /* built-in mic */ |
| 3051 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3052 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3053 | /* speaker-out */ |
| 3054 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3055 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3056 | /* mic-in to input */ |
| 3057 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 3058 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3059 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3060 | /* HP-out */ |
| 3061 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 3062 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3063 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3064 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3065 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3066 | { } |
| 3067 | }; |
| 3068 | |
| 3069 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3070 | static void alc880_lg_setup(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3071 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3072 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3073 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3074 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3075 | spec->autocfg.speaker_pins[0] = 0x17; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3076 | } |
| 3077 | |
| 3078 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3079 | * LG LW20 |
| 3080 | * |
| 3081 | * Pin assignment: |
| 3082 | * Speaker-out: 0x14 |
| 3083 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3084 | * Built-in Mic-In: 0x19 |
| 3085 | * Line-In: 0x1b |
| 3086 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3087 | * SPDIF-Out: 0x1e |
| 3088 | */ |
| 3089 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3090 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3091 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3092 | .items = { |
| 3093 | { "Mic", 0x0 }, |
| 3094 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 3095 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3096 | }, |
| 3097 | }; |
| 3098 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3099 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 3100 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3101 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3102 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3103 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3104 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 3105 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 3106 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 3107 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 3108 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 3109 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 3110 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 3111 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3112 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3113 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3114 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 3115 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3116 | { |
| 3117 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3118 | .name = "Channel Mode", |
| 3119 | .info = alc_ch_mode_info, |
| 3120 | .get = alc_ch_mode_get, |
| 3121 | .put = alc_ch_mode_put, |
| 3122 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3123 | { } /* end */ |
| 3124 | }; |
| 3125 | |
| 3126 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3127 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3128 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3129 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3130 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3131 | /* set capture source to mic-in */ |
| 3132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3133 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3134 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3136 | /* speaker-out */ |
| 3137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3139 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3140 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3141 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3142 | /* mic-in to input */ |
| 3143 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3144 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3145 | /* built-in mic */ |
| 3146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3148 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3149 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3150 | { } |
| 3151 | }; |
| 3152 | |
| 3153 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3154 | static void alc880_lg_lw_setup(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3155 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3156 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3157 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3158 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3159 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3160 | } |
| 3161 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3162 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3163 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3164 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3165 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3166 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3167 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3168 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3169 | { } /* end */ |
| 3170 | }; |
| 3171 | |
| 3172 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3173 | .num_items = 2, |
| 3174 | .items = { |
| 3175 | { "Mic", 0x0 }, |
| 3176 | { "Internal Mic", 0x1 }, |
| 3177 | }, |
| 3178 | }; |
| 3179 | |
| 3180 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3181 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3182 | |
| 3183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3184 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3185 | |
| 3186 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3187 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3188 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3189 | /* Mic2 (as headphone out) for HP output */ |
| 3190 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3191 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3192 | /* Internal Speaker */ |
| 3193 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3194 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3195 | |
| 3196 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3197 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3198 | |
| 3199 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3200 | { } |
| 3201 | }; |
| 3202 | |
| 3203 | /* toggle speaker-output according to the hp-jack state */ |
| 3204 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3205 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3206 | struct alc_spec *spec = codec->spec; |
| 3207 | alc_automute_amp(codec); |
| 3208 | /* toggle EAPD */ |
| 3209 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3210 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3211 | else |
| 3212 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3213 | } |
| 3214 | |
| 3215 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3216 | unsigned int res) |
| 3217 | { |
| 3218 | /* Looks like the unsol event is incompatible with the standard |
| 3219 | * definition. 4bit tag is placed at 28 bit! |
| 3220 | */ |
| 3221 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3222 | alc880_medion_rim_automute(codec); |
| 3223 | } |
| 3224 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 3225 | static void alc880_medion_rim_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3226 | { |
| 3227 | struct alc_spec *spec = codec->spec; |
| 3228 | |
| 3229 | spec->autocfg.hp_pins[0] = 0x14; |
| 3230 | spec->autocfg.speaker_pins[0] = 0x1b; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3231 | } |
| 3232 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3233 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3234 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3235 | { 0x0b, HDA_INPUT, 0 }, |
| 3236 | { 0x0b, HDA_INPUT, 1 }, |
| 3237 | { 0x0b, HDA_INPUT, 2 }, |
| 3238 | { 0x0b, HDA_INPUT, 3 }, |
| 3239 | { 0x0b, HDA_INPUT, 4 }, |
| 3240 | { } /* end */ |
| 3241 | }; |
| 3242 | |
| 3243 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3244 | { 0x0b, HDA_INPUT, 1 }, |
| 3245 | { 0x0b, HDA_INPUT, 6 }, |
| 3246 | { 0x0b, HDA_INPUT, 7 }, |
| 3247 | { } /* end */ |
| 3248 | }; |
| 3249 | #endif |
| 3250 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3251 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3252 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3253 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3254 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3255 | static int alc_init(struct hda_codec *codec) |
| 3256 | { |
| 3257 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3258 | unsigned int i; |
| 3259 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3260 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3261 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3262 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3263 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3264 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3265 | |
| 3266 | if (spec->init_hook) |
| 3267 | spec->init_hook(codec); |
| 3268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3269 | return 0; |
| 3270 | } |
| 3271 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3272 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3273 | { |
| 3274 | struct alc_spec *spec = codec->spec; |
| 3275 | |
| 3276 | if (spec->unsol_event) |
| 3277 | spec->unsol_event(codec, res); |
| 3278 | } |
| 3279 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3280 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3281 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3282 | { |
| 3283 | struct alc_spec *spec = codec->spec; |
| 3284 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3285 | } |
| 3286 | #endif |
| 3287 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3288 | /* |
| 3289 | * Analog playback callbacks |
| 3290 | */ |
| 3291 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3292 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3293 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3294 | { |
| 3295 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3296 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3297 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3298 | } |
| 3299 | |
| 3300 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3301 | struct hda_codec *codec, |
| 3302 | unsigned int stream_tag, |
| 3303 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3304 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3305 | { |
| 3306 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3307 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3308 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3309 | } |
| 3310 | |
| 3311 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3312 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3313 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3314 | { |
| 3315 | struct alc_spec *spec = codec->spec; |
| 3316 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3317 | } |
| 3318 | |
| 3319 | /* |
| 3320 | * Digital out |
| 3321 | */ |
| 3322 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3323 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3324 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3325 | { |
| 3326 | struct alc_spec *spec = codec->spec; |
| 3327 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3328 | } |
| 3329 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3330 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3331 | struct hda_codec *codec, |
| 3332 | unsigned int stream_tag, |
| 3333 | unsigned int format, |
| 3334 | struct snd_pcm_substream *substream) |
| 3335 | { |
| 3336 | struct alc_spec *spec = codec->spec; |
| 3337 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3338 | stream_tag, format, substream); |
| 3339 | } |
| 3340 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3341 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3342 | struct hda_codec *codec, |
| 3343 | struct snd_pcm_substream *substream) |
| 3344 | { |
| 3345 | struct alc_spec *spec = codec->spec; |
| 3346 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3347 | } |
| 3348 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3349 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3350 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3351 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3352 | { |
| 3353 | struct alc_spec *spec = codec->spec; |
| 3354 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3355 | } |
| 3356 | |
| 3357 | /* |
| 3358 | * Analog capture |
| 3359 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3360 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3361 | struct hda_codec *codec, |
| 3362 | unsigned int stream_tag, |
| 3363 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3364 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3365 | { |
| 3366 | struct alc_spec *spec = codec->spec; |
| 3367 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3368 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3369 | stream_tag, 0, format); |
| 3370 | return 0; |
| 3371 | } |
| 3372 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3373 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3375 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3376 | { |
| 3377 | struct alc_spec *spec = codec->spec; |
| 3378 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3379 | snd_hda_codec_cleanup_stream(codec, |
| 3380 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | return 0; |
| 3382 | } |
| 3383 | |
| 3384 | |
| 3385 | /* |
| 3386 | */ |
| 3387 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3388 | .substreams = 1, |
| 3389 | .channels_min = 2, |
| 3390 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3391 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3392 | .ops = { |
| 3393 | .open = alc880_playback_pcm_open, |
| 3394 | .prepare = alc880_playback_pcm_prepare, |
| 3395 | .cleanup = alc880_playback_pcm_cleanup |
| 3396 | }, |
| 3397 | }; |
| 3398 | |
| 3399 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3400 | .substreams = 1, |
| 3401 | .channels_min = 2, |
| 3402 | .channels_max = 2, |
| 3403 | /* NID is set in alc_build_pcms */ |
| 3404 | }; |
| 3405 | |
| 3406 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3407 | .substreams = 1, |
| 3408 | .channels_min = 2, |
| 3409 | .channels_max = 2, |
| 3410 | /* NID is set in alc_build_pcms */ |
| 3411 | }; |
| 3412 | |
| 3413 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3414 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3415 | .channels_min = 2, |
| 3416 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3417 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3418 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3419 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3420 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3421 | }, |
| 3422 | }; |
| 3423 | |
| 3424 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3425 | .substreams = 1, |
| 3426 | .channels_min = 2, |
| 3427 | .channels_max = 2, |
| 3428 | /* NID is set in alc_build_pcms */ |
| 3429 | .ops = { |
| 3430 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3431 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3432 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3433 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3434 | }, |
| 3435 | }; |
| 3436 | |
| 3437 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3438 | .substreams = 1, |
| 3439 | .channels_min = 2, |
| 3440 | .channels_max = 2, |
| 3441 | /* NID is set in alc_build_pcms */ |
| 3442 | }; |
| 3443 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3444 | /* 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] | 3445 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3446 | .substreams = 0, |
| 3447 | .channels_min = 0, |
| 3448 | .channels_max = 0, |
| 3449 | }; |
| 3450 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3451 | static int alc_build_pcms(struct hda_codec *codec) |
| 3452 | { |
| 3453 | struct alc_spec *spec = codec->spec; |
| 3454 | struct hda_pcm *info = spec->pcm_rec; |
| 3455 | int i; |
| 3456 | |
| 3457 | codec->num_pcms = 1; |
| 3458 | codec->pcm_info = info; |
| 3459 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3460 | if (spec->no_analog) |
| 3461 | goto skip_analog; |
| 3462 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3463 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3464 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3465 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3466 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3467 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3468 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3469 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3470 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3471 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3472 | } |
| 3473 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3474 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3475 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3476 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3477 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3478 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3479 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3480 | if (spec->channel_mode) { |
| 3481 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3482 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3483 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3484 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3485 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3486 | } |
| 3487 | } |
| 3488 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3489 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3490 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3491 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3492 | snprintf(spec->stream_name_digital, |
| 3493 | sizeof(spec->stream_name_digital), |
| 3494 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3495 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3496 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3497 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3498 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3499 | if (spec->dig_out_type) |
| 3500 | info->pcm_type = spec->dig_out_type; |
| 3501 | else |
| 3502 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3503 | if (spec->multiout.dig_out_nid && |
| 3504 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3505 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3506 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3507 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3508 | if (spec->dig_in_nid && |
| 3509 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3510 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3511 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3512 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3513 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3514 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3515 | } |
| 3516 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3517 | if (spec->no_analog) |
| 3518 | return 0; |
| 3519 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3520 | /* If the use of more than one ADC is requested for the current |
| 3521 | * model, configure a second analog capture-only PCM. |
| 3522 | */ |
| 3523 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3524 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3525 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3526 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3527 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3528 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3529 | if (spec->alt_dac_nid) { |
| 3530 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3531 | *spec->stream_analog_alt_playback; |
| 3532 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3533 | spec->alt_dac_nid; |
| 3534 | } else { |
| 3535 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3536 | alc_pcm_null_stream; |
| 3537 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3538 | } |
| 3539 | if (spec->num_adc_nids > 1) { |
| 3540 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3541 | *spec->stream_analog_alt_capture; |
| 3542 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3543 | spec->adc_nids[1]; |
| 3544 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3545 | spec->num_adc_nids - 1; |
| 3546 | } else { |
| 3547 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3548 | alc_pcm_null_stream; |
| 3549 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3550 | } |
| 3551 | } |
| 3552 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3553 | return 0; |
| 3554 | } |
| 3555 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3556 | static void alc_free_kctls(struct hda_codec *codec) |
| 3557 | { |
| 3558 | struct alc_spec *spec = codec->spec; |
| 3559 | |
| 3560 | if (spec->kctls.list) { |
| 3561 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3562 | int i; |
| 3563 | for (i = 0; i < spec->kctls.used; i++) |
| 3564 | kfree(kctl[i].name); |
| 3565 | } |
| 3566 | snd_array_free(&spec->kctls); |
| 3567 | } |
| 3568 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3569 | static void alc_free(struct hda_codec *codec) |
| 3570 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3571 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3573 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3574 | return; |
| 3575 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3576 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3577 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3578 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3579 | } |
| 3580 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3581 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3582 | static int alc_resume(struct hda_codec *codec) |
| 3583 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3584 | codec->patch_ops.init(codec); |
| 3585 | snd_hda_codec_resume_amp(codec); |
| 3586 | snd_hda_codec_resume_cache(codec); |
| 3587 | return 0; |
| 3588 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3589 | #endif |
| 3590 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3591 | /* |
| 3592 | */ |
| 3593 | static struct hda_codec_ops alc_patch_ops = { |
| 3594 | .build_controls = alc_build_controls, |
| 3595 | .build_pcms = alc_build_pcms, |
| 3596 | .init = alc_init, |
| 3597 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3598 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3599 | #ifdef SND_HDA_NEEDS_RESUME |
| 3600 | .resume = alc_resume, |
| 3601 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3603 | .check_power_status = alc_check_power_status, |
| 3604 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3605 | }; |
| 3606 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3607 | |
| 3608 | /* |
| 3609 | * Test configuration for debugging |
| 3610 | * |
| 3611 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3612 | * enum controls. |
| 3613 | */ |
| 3614 | #ifdef CONFIG_SND_DEBUG |
| 3615 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3616 | 0x02, 0x03, 0x04, 0x05 |
| 3617 | }; |
| 3618 | |
| 3619 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3620 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3621 | .items = { |
| 3622 | { "In-1", 0x0 }, |
| 3623 | { "In-2", 0x1 }, |
| 3624 | { "In-3", 0x2 }, |
| 3625 | { "In-4", 0x3 }, |
| 3626 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3627 | { "Front", 0x5 }, |
| 3628 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3629 | }, |
| 3630 | }; |
| 3631 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3632 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3633 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3634 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3635 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3636 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3637 | }; |
| 3638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3639 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3640 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3641 | { |
| 3642 | static char *texts[] = { |
| 3643 | "N/A", "Line Out", "HP Out", |
| 3644 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3645 | }; |
| 3646 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3647 | uinfo->count = 1; |
| 3648 | uinfo->value.enumerated.items = 8; |
| 3649 | if (uinfo->value.enumerated.item >= 8) |
| 3650 | uinfo->value.enumerated.item = 7; |
| 3651 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3652 | return 0; |
| 3653 | } |
| 3654 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3655 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3656 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3657 | { |
| 3658 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3659 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3660 | unsigned int pin_ctl, item = 0; |
| 3661 | |
| 3662 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3663 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3664 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3665 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3666 | item = 2; |
| 3667 | else |
| 3668 | item = 1; |
| 3669 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3670 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3671 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3672 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3673 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3674 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3675 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3676 | } |
| 3677 | } |
| 3678 | ucontrol->value.enumerated.item[0] = item; |
| 3679 | return 0; |
| 3680 | } |
| 3681 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3682 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3683 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3684 | { |
| 3685 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3686 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3687 | static unsigned int ctls[] = { |
| 3688 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3689 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3690 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3691 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3692 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3693 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3694 | }; |
| 3695 | unsigned int old_ctl, new_ctl; |
| 3696 | |
| 3697 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3698 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3699 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3700 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3701 | int val; |
| 3702 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3703 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3704 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3705 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3706 | HDA_AMP_MUTE : 0; |
| 3707 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3708 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3709 | return 1; |
| 3710 | } |
| 3711 | return 0; |
| 3712 | } |
| 3713 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3714 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3715 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3716 | { |
| 3717 | static char *texts[] = { |
| 3718 | "Front", "Surround", "CLFE", "Side" |
| 3719 | }; |
| 3720 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3721 | uinfo->count = 1; |
| 3722 | uinfo->value.enumerated.items = 4; |
| 3723 | if (uinfo->value.enumerated.item >= 4) |
| 3724 | uinfo->value.enumerated.item = 3; |
| 3725 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3726 | return 0; |
| 3727 | } |
| 3728 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3729 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3730 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | { |
| 3732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3733 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3734 | unsigned int sel; |
| 3735 | |
| 3736 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3737 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3738 | return 0; |
| 3739 | } |
| 3740 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3741 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3742 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3743 | { |
| 3744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3745 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3746 | unsigned int sel; |
| 3747 | |
| 3748 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3749 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3750 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3751 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3752 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3753 | return 1; |
| 3754 | } |
| 3755 | return 0; |
| 3756 | } |
| 3757 | |
| 3758 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3759 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3760 | .name = xname, \ |
| 3761 | .info = alc_test_pin_ctl_info, \ |
| 3762 | .get = alc_test_pin_ctl_get, \ |
| 3763 | .put = alc_test_pin_ctl_put, \ |
| 3764 | .private_value = nid \ |
| 3765 | } |
| 3766 | |
| 3767 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3768 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3769 | .name = xname, \ |
| 3770 | .info = alc_test_pin_src_info, \ |
| 3771 | .get = alc_test_pin_src_get, \ |
| 3772 | .put = alc_test_pin_src_put, \ |
| 3773 | .private_value = nid \ |
| 3774 | } |
| 3775 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3776 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3777 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3778 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3779 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3780 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3781 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3782 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3783 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3784 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3785 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3786 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3787 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3788 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3789 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3790 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3791 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3792 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3793 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3794 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3795 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3796 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3797 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3798 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3799 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3800 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3801 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3802 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3803 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3804 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3805 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3806 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3807 | { |
| 3808 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3809 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3810 | .info = alc_ch_mode_info, |
| 3811 | .get = alc_ch_mode_get, |
| 3812 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3813 | }, |
| 3814 | { } /* end */ |
| 3815 | }; |
| 3816 | |
| 3817 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3818 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3825 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3826 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3827 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3828 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3829 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3830 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3831 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3832 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3833 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3835 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3836 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3837 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3838 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3840 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3841 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3842 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3843 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3844 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3845 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3846 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3847 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3848 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3849 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3850 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3851 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3852 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3853 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3854 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3855 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3856 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3857 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3858 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3859 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3860 | /* Analog input/passthru */ |
| 3861 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3863 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3864 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3865 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3866 | { } |
| 3867 | }; |
| 3868 | #endif |
| 3869 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3870 | /* |
| 3871 | */ |
| 3872 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3873 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3874 | [ALC880_3ST] = "3stack", |
| 3875 | [ALC880_TCL_S700] = "tcl", |
| 3876 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3877 | [ALC880_CLEVO] = "clevo", |
| 3878 | [ALC880_5ST] = "5stack", |
| 3879 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3880 | [ALC880_W810] = "w810", |
| 3881 | [ALC880_Z71V] = "z71v", |
| 3882 | [ALC880_6ST] = "6stack", |
| 3883 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3884 | [ALC880_ASUS] = "asus", |
| 3885 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3886 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3887 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3888 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3889 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3890 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3891 | [ALC880_F1734] = "F1734", |
| 3892 | [ALC880_LG] = "lg", |
| 3893 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3894 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3895 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3896 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3897 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3898 | [ALC880_AUTO] = "auto", |
| 3899 | }; |
| 3900 | |
| 3901 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3902 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3903 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3904 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3905 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3906 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3907 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3908 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3909 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3910 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3911 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3912 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3913 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3914 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3915 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3916 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3917 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3918 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3919 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3920 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3921 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3922 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3923 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3924 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3925 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3926 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3927 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3928 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3929 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3930 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3931 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3932 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3933 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3934 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3935 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3936 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3937 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3938 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3939 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3940 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3941 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3942 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3943 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3944 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3945 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3946 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3947 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3948 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3949 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3950 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3951 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3952 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3953 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3954 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3955 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3956 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3957 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3958 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3959 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3960 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3961 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3962 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3963 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3964 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3965 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3966 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3967 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3968 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3969 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3970 | /* default Intel */ |
| 3971 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3972 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3973 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3974 | {} |
| 3975 | }; |
| 3976 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3977 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3978 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3979 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3980 | static struct alc_config_preset alc880_presets[] = { |
| 3981 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3982 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3983 | .init_verbs = { alc880_volume_init_verbs, |
| 3984 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3985 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3986 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3987 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3988 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3989 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3990 | .input_mux = &alc880_capture_source, |
| 3991 | }, |
| 3992 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3993 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3994 | .init_verbs = { alc880_volume_init_verbs, |
| 3995 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3996 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3997 | .dac_nids = alc880_dac_nids, |
| 3998 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3999 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4000 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4001 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4002 | .input_mux = &alc880_capture_source, |
| 4003 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4004 | [ALC880_TCL_S700] = { |
| 4005 | .mixers = { alc880_tcl_s700_mixer }, |
| 4006 | .init_verbs = { alc880_volume_init_verbs, |
| 4007 | alc880_pin_tcl_S700_init_verbs, |
| 4008 | alc880_gpio2_init_verbs }, |
| 4009 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4010 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4011 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 4012 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4013 | .hp_nid = 0x03, |
| 4014 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4015 | .channel_mode = alc880_2_jack_modes, |
| 4016 | .input_mux = &alc880_capture_source, |
| 4017 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4018 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4019 | .mixers = { alc880_three_stack_mixer, |
| 4020 | alc880_five_stack_mixer}, |
| 4021 | .init_verbs = { alc880_volume_init_verbs, |
| 4022 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4023 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4024 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4025 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4026 | .channel_mode = alc880_fivestack_modes, |
| 4027 | .input_mux = &alc880_capture_source, |
| 4028 | }, |
| 4029 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4030 | .mixers = { alc880_three_stack_mixer, |
| 4031 | alc880_five_stack_mixer }, |
| 4032 | .init_verbs = { alc880_volume_init_verbs, |
| 4033 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4034 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4035 | .dac_nids = alc880_dac_nids, |
| 4036 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4037 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 4038 | .channel_mode = alc880_fivestack_modes, |
| 4039 | .input_mux = &alc880_capture_source, |
| 4040 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4041 | [ALC880_6ST] = { |
| 4042 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4043 | .init_verbs = { alc880_volume_init_verbs, |
| 4044 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 4045 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4046 | .dac_nids = alc880_6st_dac_nids, |
| 4047 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4048 | .channel_mode = alc880_sixstack_modes, |
| 4049 | .input_mux = &alc880_6stack_capture_source, |
| 4050 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4051 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4052 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4053 | .init_verbs = { alc880_volume_init_verbs, |
| 4054 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4055 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 4056 | .dac_nids = alc880_6st_dac_nids, |
| 4057 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4058 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 4059 | .channel_mode = alc880_sixstack_modes, |
| 4060 | .input_mux = &alc880_6stack_capture_source, |
| 4061 | }, |
| 4062 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4063 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4064 | .init_verbs = { alc880_volume_init_verbs, |
| 4065 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4066 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4067 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 4068 | .dac_nids = alc880_w810_dac_nids, |
| 4069 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4070 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 4071 | .channel_mode = alc880_w810_modes, |
| 4072 | .input_mux = &alc880_capture_source, |
| 4073 | }, |
| 4074 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4075 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4076 | .init_verbs = { alc880_volume_init_verbs, |
| 4077 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4078 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 4079 | .dac_nids = alc880_z71v_dac_nids, |
| 4080 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4081 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4082 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4083 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4084 | .input_mux = &alc880_capture_source, |
| 4085 | }, |
| 4086 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4087 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4088 | .init_verbs = { alc880_volume_init_verbs, |
| 4089 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4090 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 4091 | .dac_nids = alc880_f1734_dac_nids, |
| 4092 | .hp_nid = 0x02, |
| 4093 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4094 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 4095 | .input_mux = &alc880_f1734_capture_source, |
| 4096 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4097 | .setup = alc880_uniwill_p53_setup, |
| 4098 | .init_hook = alc_automute_amp, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4099 | }, |
| 4100 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4101 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4102 | .init_verbs = { alc880_volume_init_verbs, |
| 4103 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4104 | alc880_gpio1_init_verbs }, |
| 4105 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4106 | .dac_nids = alc880_asus_dac_nids, |
| 4107 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4108 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4109 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4110 | .input_mux = &alc880_capture_source, |
| 4111 | }, |
| 4112 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4113 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4114 | .init_verbs = { alc880_volume_init_verbs, |
| 4115 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4116 | alc880_gpio1_init_verbs }, |
| 4117 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4118 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4119 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4120 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4121 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4122 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4123 | .input_mux = &alc880_capture_source, |
| 4124 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4125 | [ALC880_ASUS_DIG2] = { |
| 4126 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4127 | .init_verbs = { alc880_volume_init_verbs, |
| 4128 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4129 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4130 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4131 | .dac_nids = alc880_asus_dac_nids, |
| 4132 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4133 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4134 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4135 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4136 | .input_mux = &alc880_capture_source, |
| 4137 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4138 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4139 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4140 | .init_verbs = { alc880_volume_init_verbs, |
| 4141 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4142 | alc880_gpio1_init_verbs }, |
| 4143 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4144 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4145 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4146 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4147 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4148 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4149 | .input_mux = &alc880_capture_source, |
| 4150 | }, |
| 4151 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4152 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4153 | .init_verbs = { alc880_volume_init_verbs, |
| 4154 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4156 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4157 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4158 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4159 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4160 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4161 | .input_mux = &alc880_capture_source, |
| 4162 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4163 | [ALC880_UNIWILL] = { |
| 4164 | .mixers = { alc880_uniwill_mixer }, |
| 4165 | .init_verbs = { alc880_volume_init_verbs, |
| 4166 | alc880_uniwill_init_verbs }, |
| 4167 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4168 | .dac_nids = alc880_asus_dac_nids, |
| 4169 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4170 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4171 | .channel_mode = alc880_threestack_modes, |
| 4172 | .need_dac_fix = 1, |
| 4173 | .input_mux = &alc880_capture_source, |
| 4174 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4175 | .setup = alc880_uniwill_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4176 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4177 | }, |
| 4178 | [ALC880_UNIWILL_P53] = { |
| 4179 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4180 | .init_verbs = { alc880_volume_init_verbs, |
| 4181 | alc880_uniwill_p53_init_verbs }, |
| 4182 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4183 | .dac_nids = alc880_asus_dac_nids, |
| 4184 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4185 | .channel_mode = alc880_threestack_modes, |
| 4186 | .input_mux = &alc880_capture_source, |
| 4187 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4188 | .setup = alc880_uniwill_p53_setup, |
| 4189 | .init_hook = alc_automute_amp, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4190 | }, |
| 4191 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4192 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4193 | .init_verbs = { alc880_volume_init_verbs, |
| 4194 | alc880_uniwill_p53_init_verbs, |
| 4195 | alc880_beep_init_verbs }, |
| 4196 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4197 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4198 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4199 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4200 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4201 | .input_mux = &alc880_capture_source, |
| 4202 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4203 | .setup = alc880_uniwill_p53_setup, |
| 4204 | .init_hook = alc_automute_amp, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4205 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4206 | [ALC880_CLEVO] = { |
| 4207 | .mixers = { alc880_three_stack_mixer }, |
| 4208 | .init_verbs = { alc880_volume_init_verbs, |
| 4209 | alc880_pin_clevo_init_verbs }, |
| 4210 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4211 | .dac_nids = alc880_dac_nids, |
| 4212 | .hp_nid = 0x03, |
| 4213 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4214 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4215 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4216 | .input_mux = &alc880_capture_source, |
| 4217 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4218 | [ALC880_LG] = { |
| 4219 | .mixers = { alc880_lg_mixer }, |
| 4220 | .init_verbs = { alc880_volume_init_verbs, |
| 4221 | alc880_lg_init_verbs }, |
| 4222 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4223 | .dac_nids = alc880_lg_dac_nids, |
| 4224 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4225 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4226 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4227 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4228 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4229 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4230 | .setup = alc880_lg_setup, |
| 4231 | .init_hook = alc_automute_amp, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4232 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4233 | .loopbacks = alc880_lg_loopbacks, |
| 4234 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4235 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4236 | [ALC880_LG_LW] = { |
| 4237 | .mixers = { alc880_lg_lw_mixer }, |
| 4238 | .init_verbs = { alc880_volume_init_verbs, |
| 4239 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4240 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4241 | .dac_nids = alc880_dac_nids, |
| 4242 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4243 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4244 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4245 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4246 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4247 | .setup = alc880_lg_lw_setup, |
| 4248 | .init_hook = alc_automute_amp, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4249 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4250 | [ALC880_MEDION_RIM] = { |
| 4251 | .mixers = { alc880_medion_rim_mixer }, |
| 4252 | .init_verbs = { alc880_volume_init_verbs, |
| 4253 | alc880_medion_rim_init_verbs, |
| 4254 | alc_gpio2_init_verbs }, |
| 4255 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4256 | .dac_nids = alc880_dac_nids, |
| 4257 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4258 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4259 | .channel_mode = alc880_2_jack_modes, |
| 4260 | .input_mux = &alc880_medion_rim_capture_source, |
| 4261 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 4262 | .setup = alc880_medion_rim_setup, |
| 4263 | .init_hook = alc880_medion_rim_automute, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4264 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4265 | #ifdef CONFIG_SND_DEBUG |
| 4266 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4267 | .mixers = { alc880_test_mixer }, |
| 4268 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4269 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4270 | .dac_nids = alc880_test_dac_nids, |
| 4271 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4272 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4273 | .channel_mode = alc880_test_modes, |
| 4274 | .input_mux = &alc880_test_capture_source, |
| 4275 | }, |
| 4276 | #endif |
| 4277 | }; |
| 4278 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | /* |
| 4280 | * Automatic parse of I/O pins from the BIOS configuration |
| 4281 | */ |
| 4282 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4283 | enum { |
| 4284 | ALC_CTL_WIDGET_VOL, |
| 4285 | ALC_CTL_WIDGET_MUTE, |
| 4286 | ALC_CTL_BIND_MUTE, |
| 4287 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4288 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4289 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4290 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4291 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | }; |
| 4293 | |
| 4294 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4295 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4296 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4297 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4298 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4299 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4300 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4301 | knew = snd_array_new(&spec->kctls); |
| 4302 | if (!knew) |
| 4303 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4304 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4305 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | return -ENOMEM; |
| 4308 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4309 | return 0; |
| 4310 | } |
| 4311 | |
| 4312 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4313 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4314 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4315 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4316 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4317 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4318 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4319 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4320 | #define ALC880_PIN_CD_NID 0x1c |
| 4321 | |
| 4322 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4323 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4324 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4325 | { |
| 4326 | hda_nid_t nid; |
| 4327 | int assigned[4]; |
| 4328 | int i, j; |
| 4329 | |
| 4330 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4331 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4332 | |
| 4333 | /* check the pins hardwired to audio widget */ |
| 4334 | for (i = 0; i < cfg->line_outs; i++) { |
| 4335 | nid = cfg->line_out_pins[i]; |
| 4336 | if (alc880_is_fixed_pin(nid)) { |
| 4337 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4338 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4339 | assigned[idx] = 1; |
| 4340 | } |
| 4341 | } |
| 4342 | /* left pins can be connect to any audio widget */ |
| 4343 | for (i = 0; i < cfg->line_outs; i++) { |
| 4344 | nid = cfg->line_out_pins[i]; |
| 4345 | if (alc880_is_fixed_pin(nid)) |
| 4346 | continue; |
| 4347 | /* search for an empty channel */ |
| 4348 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | if (!assigned[j]) { |
| 4350 | spec->multiout.dac_nids[i] = |
| 4351 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | assigned[j] = 1; |
| 4353 | break; |
| 4354 | } |
| 4355 | } |
| 4356 | } |
| 4357 | spec->multiout.num_dacs = cfg->line_outs; |
| 4358 | return 0; |
| 4359 | } |
| 4360 | |
| 4361 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4363 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4364 | { |
| 4365 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4366 | static const char *chname[4] = { |
| 4367 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4368 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4369 | hda_nid_t nid; |
| 4370 | int i, err; |
| 4371 | |
| 4372 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4373 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | continue; |
| 4375 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4376 | if (i == 2) { |
| 4377 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4378 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4379 | "Center Playback Volume", |
| 4380 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4381 | HDA_OUTPUT)); |
| 4382 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4383 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4384 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4385 | "LFE Playback Volume", |
| 4386 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4387 | HDA_OUTPUT)); |
| 4388 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4389 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4390 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4391 | "Center Playback Switch", |
| 4392 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4393 | HDA_INPUT)); |
| 4394 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4395 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4396 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4397 | "LFE Playback Switch", |
| 4398 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4399 | HDA_INPUT)); |
| 4400 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | return err; |
| 4402 | } else { |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4403 | const char *pfx; |
| 4404 | if (cfg->line_outs == 1 && |
| 4405 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 4406 | pfx = "Speaker"; |
| 4407 | else |
| 4408 | pfx = chname[i]; |
| 4409 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4410 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4411 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4412 | HDA_OUTPUT)); |
| 4413 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4414 | return err; |
Takashi Iwai | cb162b6 | 2009-08-25 16:05:03 +0200 | [diff] [blame] | 4415 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4416 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4417 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4418 | HDA_INPUT)); |
| 4419 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4420 | return err; |
| 4421 | } |
| 4422 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4423 | return 0; |
| 4424 | } |
| 4425 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4426 | /* add playback controls for speaker and HP outputs */ |
| 4427 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4428 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4429 | { |
| 4430 | hda_nid_t nid; |
| 4431 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4432 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4433 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4434 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4435 | return 0; |
| 4436 | |
| 4437 | if (alc880_is_fixed_pin(pin)) { |
| 4438 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4439 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4440 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4441 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4442 | else |
| 4443 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4444 | /* control HP volume/switch on the output mixer amp */ |
| 4445 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4446 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4447 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4448 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4449 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4450 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4451 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4452 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4453 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4454 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4455 | return err; |
| 4456 | } else if (alc880_is_multi_pin(pin)) { |
| 4457 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4458 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4459 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4460 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4461 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4462 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4463 | return err; |
| 4464 | } |
| 4465 | return 0; |
| 4466 | } |
| 4467 | |
| 4468 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4469 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4470 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4471 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4472 | { |
| 4473 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4474 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4475 | |
| 4476 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4477 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4478 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4479 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4480 | return err; |
| 4481 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4482 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4483 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4484 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4485 | return err; |
| 4486 | return 0; |
| 4487 | } |
| 4488 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4489 | 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] | 4490 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4491 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
| 4492 | return (pincap & AC_PINCAP_IN) != 0; |
| 4493 | } |
| 4494 | |
| 4495 | /* create playback/capture controls for input pins */ |
| 4496 | static int alc_auto_create_input_ctls(struct hda_codec *codec, |
| 4497 | const struct auto_pin_cfg *cfg, |
| 4498 | hda_nid_t mixer, |
| 4499 | hda_nid_t cap1, hda_nid_t cap2) |
| 4500 | { |
| 4501 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4502 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4503 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4504 | |
| 4505 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4506 | hda_nid_t pin; |
| 4507 | |
| 4508 | pin = cfg->input_pins[i]; |
| 4509 | if (!alc_is_input_pin(codec, pin)) |
| 4510 | continue; |
| 4511 | |
| 4512 | if (mixer) { |
| 4513 | idx = get_connection_index(codec, mixer, pin); |
| 4514 | if (idx >= 0) { |
| 4515 | err = new_analog_input(spec, pin, |
| 4516 | auto_pin_cfg_labels[i], |
| 4517 | idx, mixer); |
| 4518 | if (err < 0) |
| 4519 | return err; |
| 4520 | } |
| 4521 | } |
| 4522 | |
| 4523 | if (!cap1) |
| 4524 | continue; |
| 4525 | idx = get_connection_index(codec, cap1, pin); |
| 4526 | if (idx < 0 && cap2) |
| 4527 | idx = get_connection_index(codec, cap2, pin); |
| 4528 | if (idx >= 0) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4529 | imux->items[imux->num_items].label = |
| 4530 | auto_pin_cfg_labels[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4531 | imux->items[imux->num_items].index = idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4532 | imux->num_items++; |
| 4533 | } |
| 4534 | } |
| 4535 | return 0; |
| 4536 | } |
| 4537 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4538 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, |
| 4539 | const struct auto_pin_cfg *cfg) |
| 4540 | { |
| 4541 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); |
| 4542 | } |
| 4543 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4544 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4545 | unsigned int pin_type) |
| 4546 | { |
| 4547 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4548 | pin_type); |
| 4549 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4550 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4551 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4552 | } |
| 4553 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4554 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4555 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4556 | int dac_idx) |
| 4557 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4558 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4559 | /* need the manual connection? */ |
| 4560 | if (alc880_is_multi_pin(nid)) { |
| 4561 | struct alc_spec *spec = codec->spec; |
| 4562 | int idx = alc880_multi_pin_idx(nid); |
| 4563 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4564 | AC_VERB_SET_CONNECT_SEL, |
| 4565 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4566 | } |
| 4567 | } |
| 4568 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4569 | static int get_pin_type(int line_out_type) |
| 4570 | { |
| 4571 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4572 | return PIN_HP; |
| 4573 | else |
| 4574 | return PIN_OUT; |
| 4575 | } |
| 4576 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4577 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4578 | { |
| 4579 | struct alc_spec *spec = codec->spec; |
| 4580 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4581 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4582 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4583 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4584 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4585 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4586 | } |
| 4587 | } |
| 4588 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4589 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4590 | { |
| 4591 | struct alc_spec *spec = codec->spec; |
| 4592 | hda_nid_t pin; |
| 4593 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4594 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4595 | if (pin) /* connect to front */ |
| 4596 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4597 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4598 | if (pin) /* connect to front */ |
| 4599 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4600 | } |
| 4601 | |
| 4602 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4603 | { |
| 4604 | struct alc_spec *spec = codec->spec; |
| 4605 | int i; |
| 4606 | |
| 4607 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4608 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4609 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4610 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4611 | if (nid != ALC880_PIN_CD_NID && |
| 4612 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4613 | snd_hda_codec_write(codec, nid, 0, |
| 4614 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4615 | AMP_OUT_MUTE); |
| 4616 | } |
| 4617 | } |
| 4618 | } |
| 4619 | |
| 4620 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4621 | /* return 1 if successful, 0 if the proper config is not found, |
| 4622 | * or a negative error code |
| 4623 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4624 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4625 | { |
| 4626 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4627 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4628 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4629 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4630 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4631 | alc880_ignore); |
| 4632 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4633 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4634 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4635 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4636 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4637 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4638 | if (err < 0) |
| 4639 | return err; |
| 4640 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4641 | if (err < 0) |
| 4642 | return err; |
| 4643 | err = alc880_auto_create_extra_out(spec, |
| 4644 | spec->autocfg.speaker_pins[0], |
| 4645 | "Speaker"); |
| 4646 | if (err < 0) |
| 4647 | return err; |
| 4648 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4649 | "Headphone"); |
| 4650 | if (err < 0) |
| 4651 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 4652 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4653 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4654 | return err; |
| 4655 | |
| 4656 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4657 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4658 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4659 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4660 | hda_nid_t dig_nid; |
| 4661 | err = snd_hda_get_connections(codec, |
| 4662 | spec->autocfg.dig_out_pins[i], |
| 4663 | &dig_nid, 1); |
| 4664 | if (err < 0) |
| 4665 | continue; |
| 4666 | if (!i) |
| 4667 | spec->multiout.dig_out_nid = dig_nid; |
| 4668 | else { |
| 4669 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4670 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4671 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4672 | break; |
| 4673 | } |
| 4674 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4675 | if (spec->autocfg.dig_in_pin) |
| 4676 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4677 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4678 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4679 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4680 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4681 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4682 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4683 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4684 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4685 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4686 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4687 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4688 | return 1; |
| 4689 | } |
| 4690 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4691 | /* additional initialization for auto-configuration model */ |
| 4692 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4693 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4694 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4695 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4696 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4697 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4698 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4699 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4700 | } |
| 4701 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4702 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only |
| 4703 | * one of two digital mic pins, e.g. on ALC272 |
| 4704 | */ |
| 4705 | static void fixup_automic_adc(struct hda_codec *codec) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4706 | { |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4707 | struct alc_spec *spec = codec->spec; |
| 4708 | int i; |
| 4709 | |
| 4710 | for (i = 0; i < spec->num_adc_nids; i++) { |
| 4711 | hda_nid_t cap = spec->capsrc_nids ? |
| 4712 | spec->capsrc_nids[i] : spec->adc_nids[i]; |
| 4713 | int iidx, eidx; |
| 4714 | |
| 4715 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); |
| 4716 | if (iidx < 0) |
| 4717 | continue; |
| 4718 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); |
| 4719 | if (eidx < 0) |
| 4720 | continue; |
| 4721 | spec->int_mic.mux_idx = iidx; |
| 4722 | spec->ext_mic.mux_idx = eidx; |
| 4723 | if (spec->capsrc_nids) |
| 4724 | spec->capsrc_nids += i; |
| 4725 | spec->adc_nids += i; |
| 4726 | spec->num_adc_nids = 1; |
| 4727 | return; |
| 4728 | } |
| 4729 | snd_printd(KERN_INFO "hda_codec: %s: " |
| 4730 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", |
| 4731 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); |
| 4732 | spec->auto_mic = 0; /* disable auto-mic to be sure */ |
| 4733 | } |
| 4734 | |
| 4735 | static void set_capture_mixer(struct hda_codec *codec) |
| 4736 | { |
| 4737 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4738 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4739 | { alc_capture_mixer_nosrc1, |
| 4740 | alc_capture_mixer_nosrc2, |
| 4741 | alc_capture_mixer_nosrc3 }, |
| 4742 | { alc_capture_mixer1, |
| 4743 | alc_capture_mixer2, |
| 4744 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4745 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4746 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4747 | int mux; |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4748 | if (spec->auto_mic) { |
| 4749 | mux = 0; |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4750 | fixup_automic_adc(codec); |
Takashi Iwai | 2a22d3f | 2009-08-10 18:54:38 +0200 | [diff] [blame] | 4751 | } else if (spec->input_mux && spec->input_mux->num_items > 1) |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4752 | mux = 1; |
| 4753 | else |
| 4754 | mux = 0; |
| 4755 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4756 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4757 | } |
| 4758 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4759 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4760 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4761 | |
| 4762 | /* |
| 4763 | * OK, here we have finally the patch for ALC880 |
| 4764 | */ |
| 4765 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4766 | static int patch_alc880(struct hda_codec *codec) |
| 4767 | { |
| 4768 | struct alc_spec *spec; |
| 4769 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4770 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4772 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4773 | if (spec == NULL) |
| 4774 | return -ENOMEM; |
| 4775 | |
| 4776 | codec->spec = spec; |
| 4777 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4778 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4779 | alc880_models, |
| 4780 | alc880_cfg_tbl); |
| 4781 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4782 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4783 | codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4784 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4785 | } |
| 4786 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4787 | if (board_config == ALC880_AUTO) { |
| 4788 | /* automatic parse from the BIOS config */ |
| 4789 | err = alc880_parse_auto_config(codec); |
| 4790 | if (err < 0) { |
| 4791 | alc_free(codec); |
| 4792 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4793 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4794 | printk(KERN_INFO |
| 4795 | "hda_codec: Cannot set up configuration " |
| 4796 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4797 | board_config = ALC880_3ST; |
| 4798 | } |
| 4799 | } |
| 4800 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4801 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4802 | if (err < 0) { |
| 4803 | alc_free(codec); |
| 4804 | return err; |
| 4805 | } |
| 4806 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4807 | if (board_config != ALC880_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 4808 | setup_preset(codec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4809 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4810 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4811 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4812 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4813 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4814 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4815 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4816 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4817 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4818 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4819 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4820 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4821 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4822 | if (wcap != AC_WID_AUD_IN) { |
| 4823 | spec->adc_nids = alc880_adc_nids_alt; |
| 4824 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4825 | } else { |
| 4826 | spec->adc_nids = alc880_adc_nids; |
| 4827 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4828 | } |
| 4829 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 4830 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4831 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4832 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4833 | spec->vmaster_nid = 0x0c; |
| 4834 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4835 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4836 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4837 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4838 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4839 | if (!spec->loopback.amplist) |
| 4840 | spec->loopback.amplist = alc880_loopbacks; |
| 4841 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4842 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4843 | |
| 4844 | return 0; |
| 4845 | } |
| 4846 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4847 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4848 | /* |
| 4849 | * ALC260 support |
| 4850 | */ |
| 4851 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4852 | static hda_nid_t alc260_dac_nids[1] = { |
| 4853 | /* front */ |
| 4854 | 0x02, |
| 4855 | }; |
| 4856 | |
| 4857 | static hda_nid_t alc260_adc_nids[1] = { |
| 4858 | /* ADC0 */ |
| 4859 | 0x04, |
| 4860 | }; |
| 4861 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4862 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4863 | /* ADC1 */ |
| 4864 | 0x05, |
| 4865 | }; |
| 4866 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4867 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4868 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4869 | */ |
| 4870 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4871 | /* ADC0, ADC1 */ |
| 4872 | 0x04, 0x05 |
| 4873 | }; |
| 4874 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4875 | #define ALC260_DIGOUT_NID 0x03 |
| 4876 | #define ALC260_DIGIN_NID 0x06 |
| 4877 | |
| 4878 | static struct hda_input_mux alc260_capture_source = { |
| 4879 | .num_items = 4, |
| 4880 | .items = { |
| 4881 | { "Mic", 0x0 }, |
| 4882 | { "Front Mic", 0x1 }, |
| 4883 | { "Line", 0x2 }, |
| 4884 | { "CD", 0x4 }, |
| 4885 | }, |
| 4886 | }; |
| 4887 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4888 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4889 | * headphone jack and the internal CD lines since these are the only pins at |
| 4890 | * which audio can appear. For flexibility, also allow the option of |
| 4891 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4892 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4893 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4894 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4895 | { |
| 4896 | .num_items = 3, |
| 4897 | .items = { |
| 4898 | { "Mic/Line", 0x0 }, |
| 4899 | { "CD", 0x4 }, |
| 4900 | { "Headphone", 0x2 }, |
| 4901 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4902 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4903 | { |
| 4904 | .num_items = 4, |
| 4905 | .items = { |
| 4906 | { "Mic/Line", 0x0 }, |
| 4907 | { "CD", 0x4 }, |
| 4908 | { "Headphone", 0x2 }, |
| 4909 | { "Mixer", 0x5 }, |
| 4910 | }, |
| 4911 | }, |
| 4912 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4913 | }; |
| 4914 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4915 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4916 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4917 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4918 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4919 | { |
| 4920 | .num_items = 4, |
| 4921 | .items = { |
| 4922 | { "Mic", 0x0 }, |
| 4923 | { "Line", 0x2 }, |
| 4924 | { "CD", 0x4 }, |
| 4925 | { "Headphone", 0x5 }, |
| 4926 | }, |
| 4927 | }, |
| 4928 | { |
| 4929 | .num_items = 5, |
| 4930 | .items = { |
| 4931 | { "Mic", 0x0 }, |
| 4932 | { "Line", 0x2 }, |
| 4933 | { "CD", 0x4 }, |
| 4934 | { "Headphone", 0x6 }, |
| 4935 | { "Mixer", 0x5 }, |
| 4936 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4937 | }, |
| 4938 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4939 | |
| 4940 | /* Maxdata Favorit 100XS */ |
| 4941 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4942 | { |
| 4943 | .num_items = 2, |
| 4944 | .items = { |
| 4945 | { "Line/Mic", 0x0 }, |
| 4946 | { "CD", 0x4 }, |
| 4947 | }, |
| 4948 | }, |
| 4949 | { |
| 4950 | .num_items = 3, |
| 4951 | .items = { |
| 4952 | { "Line/Mic", 0x0 }, |
| 4953 | { "CD", 0x4 }, |
| 4954 | { "Mixer", 0x5 }, |
| 4955 | }, |
| 4956 | }, |
| 4957 | }; |
| 4958 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4959 | /* |
| 4960 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4961 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4962 | * element which allows changing the channel mode, so the verb list is |
| 4963 | * never used. |
| 4964 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4965 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4966 | { 2, NULL }, |
| 4967 | }; |
| 4968 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4969 | |
| 4970 | /* Mixer combinations |
| 4971 | * |
| 4972 | * basic: base_output + input + pc_beep + capture |
| 4973 | * HP: base_output + input + capture_alt |
| 4974 | * HP_3013: hp_3013 + input + capture |
| 4975 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4976 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4977 | */ |
| 4978 | |
| 4979 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4981 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4982 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4983 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4984 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4985 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4986 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4987 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4988 | |
| 4989 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4990 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4991 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4992 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4993 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4995 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4996 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4997 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4998 | { } /* end */ |
| 4999 | }; |
| 5000 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5001 | /* update HP, line and mono out pins according to the master switch */ |
| 5002 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 5003 | hda_nid_t hp, hda_nid_t line, |
| 5004 | hda_nid_t mono) |
| 5005 | { |
| 5006 | struct alc_spec *spec = codec->spec; |
| 5007 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 5008 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5009 | 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] | 5010 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5011 | 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] | 5012 | val); |
| 5013 | /* mono (speaker) depending on the HP jack sense */ |
| 5014 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5015 | 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] | 5016 | val); |
| 5017 | } |
| 5018 | |
| 5019 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 5020 | struct snd_ctl_elem_value *ucontrol) |
| 5021 | { |
| 5022 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5023 | struct alc_spec *spec = codec->spec; |
| 5024 | *ucontrol->value.integer.value = spec->master_sw; |
| 5025 | return 0; |
| 5026 | } |
| 5027 | |
| 5028 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 5029 | struct snd_ctl_elem_value *ucontrol) |
| 5030 | { |
| 5031 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5032 | struct alc_spec *spec = codec->spec; |
| 5033 | int val = !!*ucontrol->value.integer.value; |
| 5034 | hda_nid_t hp, line, mono; |
| 5035 | |
| 5036 | if (val == spec->master_sw) |
| 5037 | return 0; |
| 5038 | spec->master_sw = val; |
| 5039 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 5040 | line = (kcontrol->private_value >> 8) & 0xff; |
| 5041 | mono = kcontrol->private_value & 0xff; |
| 5042 | alc260_hp_master_update(codec, hp, line, mono); |
| 5043 | return 1; |
| 5044 | } |
| 5045 | |
| 5046 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 5047 | { |
| 5048 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5049 | .name = "Master Playback Switch", |
| 5050 | .info = snd_ctl_boolean_mono_info, |
| 5051 | .get = alc260_hp_master_sw_get, |
| 5052 | .put = alc260_hp_master_sw_put, |
| 5053 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 5054 | }, |
| 5055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5056 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 5057 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5058 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 5059 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 5060 | HDA_OUTPUT), |
| 5061 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5062 | { } /* end */ |
| 5063 | }; |
| 5064 | |
| 5065 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 5066 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5067 | {}, |
| 5068 | }; |
| 5069 | |
| 5070 | static void alc260_hp_automute(struct hda_codec *codec) |
| 5071 | { |
| 5072 | struct alc_spec *spec = codec->spec; |
| 5073 | unsigned int present; |
| 5074 | |
| 5075 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5076 | AC_VERB_GET_PIN_SENSE, 0); |
| 5077 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 5078 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 5079 | } |
| 5080 | |
| 5081 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5082 | { |
| 5083 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5084 | alc260_hp_automute(codec); |
| 5085 | } |
| 5086 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5088 | { |
| 5089 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5090 | .name = "Master Playback Switch", |
| 5091 | .info = snd_ctl_boolean_mono_info, |
| 5092 | .get = alc260_hp_master_sw_get, |
| 5093 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5094 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5095 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5096 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5097 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5098 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5099 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5100 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 5102 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5103 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5104 | { } /* end */ |
| 5105 | }; |
| 5106 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5107 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 5108 | .ops = &snd_hda_bind_vol, |
| 5109 | .values = { |
| 5110 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 5111 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 5112 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 5113 | 0 |
| 5114 | }, |
| 5115 | }; |
| 5116 | |
| 5117 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 5118 | .ops = &snd_hda_bind_sw, |
| 5119 | .values = { |
| 5120 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 5121 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 5122 | 0 |
| 5123 | }, |
| 5124 | }; |
| 5125 | |
| 5126 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 5127 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 5128 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 5129 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 5130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 5131 | { } /* end */ |
| 5132 | }; |
| 5133 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5134 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 5135 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5136 | {}, |
| 5137 | }; |
| 5138 | |
| 5139 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 5140 | { |
| 5141 | struct alc_spec *spec = codec->spec; |
| 5142 | unsigned int present; |
| 5143 | |
| 5144 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5145 | AC_VERB_GET_PIN_SENSE, 0); |
| 5146 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 5147 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5148 | } |
| 5149 | |
| 5150 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 5151 | unsigned int res) |
| 5152 | { |
| 5153 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5154 | alc260_hp_3013_automute(codec); |
| 5155 | } |
| 5156 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5157 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 5158 | { |
| 5159 | unsigned int present, bits; |
| 5160 | |
| 5161 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 5162 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 5163 | |
| 5164 | bits = present ? 0 : PIN_OUT; |
| 5165 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5166 | bits); |
| 5167 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5168 | bits); |
| 5169 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5170 | bits); |
| 5171 | } |
| 5172 | |
| 5173 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 5174 | unsigned int res) |
| 5175 | { |
| 5176 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5177 | alc260_hp_3012_automute(codec); |
| 5178 | } |
| 5179 | |
| 5180 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5181 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 5182 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5183 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5184 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5185 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5186 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5187 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5188 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5189 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5190 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5191 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5192 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5193 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5194 | { } /* end */ |
| 5195 | }; |
| 5196 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5197 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5198 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5199 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5200 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5201 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5202 | * revisions available in early 2006. Therefore for now allow the |
| 5203 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5204 | * that the lack of mic bias for this NID is intentional we could change the |
| 5205 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5206 | * |
| 5207 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5208 | * don't appear to make the mic bias available from the "line" jack, even |
| 5209 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5210 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5211 | * and the output jack. If this turns out to be the case for all such |
| 5212 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5213 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5214 | * |
| 5215 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5216 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5217 | * controls for such models. On models without a "mono speaker" the control |
| 5218 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5219 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5220 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5221 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5222 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5223 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5224 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5225 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5226 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5227 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5228 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5229 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5231 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5232 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5233 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5234 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5235 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5236 | { } /* end */ |
| 5237 | }; |
| 5238 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5239 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5240 | */ |
| 5241 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5242 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5243 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5244 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5245 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5246 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5247 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5248 | { } /* end */ |
| 5249 | }; |
| 5250 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5251 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5252 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5253 | */ |
| 5254 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5255 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5256 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5257 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5258 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5259 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5261 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5262 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5263 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5264 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5265 | { } /* end */ |
| 5266 | }; |
| 5267 | |
| 5268 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5269 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5270 | */ |
| 5271 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5272 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5273 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5274 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5275 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5276 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5277 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5278 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5279 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5280 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5281 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5282 | { } /* end */ |
| 5283 | }; |
| 5284 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5285 | /* |
| 5286 | * initialization verbs |
| 5287 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5288 | static struct hda_verb alc260_init_verbs[] = { |
| 5289 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5290 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5291 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5292 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5293 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5294 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5295 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5296 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5297 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5298 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5299 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5300 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5301 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5302 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5303 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5304 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5305 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5306 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5307 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5308 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5309 | /* set connection select to line in (default select for this ADC) */ |
| 5310 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5311 | /* mute capture amp left and right */ |
| 5312 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5313 | /* set connection select to line in (default select for this ADC) */ |
| 5314 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5315 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5316 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5317 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5318 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5319 | /* set vol=0 HP mixer amp left and right */ |
| 5320 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5321 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5322 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5323 | /* set vol=0 Mono mixer amp left and right */ |
| 5324 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5325 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5326 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5327 | /* unmute LINE-2 out pin */ |
| 5328 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5329 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5330 | * Line In 2 = 0x03 |
| 5331 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5332 | /* mute analog inputs */ |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5337 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5338 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5339 | /* mute Front out path */ |
| 5340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5342 | /* mute Headphone out path */ |
| 5343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5344 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5345 | /* mute Mono out path */ |
| 5346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5347 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5348 | { } |
| 5349 | }; |
| 5350 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5351 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5352 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5353 | /* Headphone and output */ |
| 5354 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5355 | /* mono output */ |
| 5356 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5357 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5358 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5359 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5360 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5361 | /* Line In pin widget for input */ |
| 5362 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5363 | /* Line-2 pin widget for output */ |
| 5364 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5365 | /* CD pin widget for input */ |
| 5366 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5367 | /* unmute amp left and right */ |
| 5368 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5369 | /* set connection select to line in (default select for this ADC) */ |
| 5370 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5371 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5372 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5373 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5374 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5375 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5377 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5378 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5379 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5380 | * Line In 2 = 0x03 |
| 5381 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5382 | /* mute analog inputs */ |
| 5383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5387 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5388 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5389 | /* Unmute Front out path */ |
| 5390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5391 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5392 | /* Unmute Headphone out path */ |
| 5393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5394 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5395 | /* Unmute Mono out path */ |
| 5396 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5397 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5398 | { } |
| 5399 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5400 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5401 | |
| 5402 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5403 | /* Line out and output */ |
| 5404 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5405 | /* mono output */ |
| 5406 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5407 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5408 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5409 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5410 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5411 | /* Line In pin widget for input */ |
| 5412 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5413 | /* Headphone pin widget for output */ |
| 5414 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5415 | /* CD pin widget for input */ |
| 5416 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5417 | /* unmute amp left and right */ |
| 5418 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5419 | /* set connection select to line in (default select for this ADC) */ |
| 5420 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5421 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5422 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5423 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5424 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5425 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5426 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5427 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5428 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5429 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5430 | * Line In 2 = 0x03 |
| 5431 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5432 | /* mute analog inputs */ |
| 5433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5437 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5438 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5439 | /* Unmute Front out path */ |
| 5440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5441 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5442 | /* Unmute Headphone out path */ |
| 5443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5444 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5445 | /* Unmute Mono out path */ |
| 5446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5447 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5448 | { } |
| 5449 | }; |
| 5450 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5451 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5452 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5453 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5454 | */ |
| 5455 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5456 | /* Disable all GPIOs */ |
| 5457 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5458 | /* Internal speaker is connected to headphone pin */ |
| 5459 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5460 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5461 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5462 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5463 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5464 | /* Ensure all other unused pins are disabled and muted. */ |
| 5465 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5466 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5467 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5468 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5469 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5470 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5472 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5473 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5474 | /* Disable digital (SPDIF) pins */ |
| 5475 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5476 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5477 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5478 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5479 | * when acting as an output. |
| 5480 | */ |
| 5481 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5482 | |
| 5483 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5485 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5486 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5489 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5490 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5491 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5492 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5493 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5494 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5495 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5496 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5497 | * If the pin mode is changed by the user the pin mode control will |
| 5498 | * take care of enabling the pin's input/output buffers as needed. |
| 5499 | * Therefore there's no need to enable the input buffer at this |
| 5500 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5501 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5502 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5503 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5504 | * mixer ctrl) |
| 5505 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5506 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5507 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5508 | /* Mute capture amp left and right */ |
| 5509 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5510 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5511 | * in (on mic1 pin) |
| 5512 | */ |
| 5513 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5514 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5515 | /* Do the same for the second ADC: mute capture input amp and |
| 5516 | * set ADC connection to line in (on mic1 pin) |
| 5517 | */ |
| 5518 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5519 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5520 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5521 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5523 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5525 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5528 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5529 | {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] | 5530 | |
| 5531 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5532 | }; |
| 5533 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5534 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5535 | * similar laptops (adapted from Fujitsu init verbs). |
| 5536 | */ |
| 5537 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5538 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5539 | * the headphone jack. Turn this on and rely on the standard mute |
| 5540 | * methods whenever the user wants to turn these outputs off. |
| 5541 | */ |
| 5542 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5543 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5544 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5545 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5546 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5547 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5548 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5549 | /* Line In jack is connected to Line1 pin */ |
| 5550 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5551 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5552 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5553 | /* Ensure all other unused pins are disabled and muted. */ |
| 5554 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5555 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5556 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5557 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5558 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5560 | /* Disable digital (SPDIF) pins */ |
| 5561 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5562 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5563 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5564 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5565 | * bus when acting as outputs. |
| 5566 | */ |
| 5567 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5568 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5569 | |
| 5570 | /* Start with output sum widgets muted and their output gains at min */ |
| 5571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5573 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5576 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5577 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5578 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5579 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5580 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5581 | /* Unmute Line-out pin widget amp left and right |
| 5582 | * (no equiv mixer ctrl) |
| 5583 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5584 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5585 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5586 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5587 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5588 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5589 | * will take care of enabling the pin's input/output buffers as needed. |
| 5590 | * Therefore there's no need to enable the input buffer at this |
| 5591 | * stage. |
| 5592 | */ |
| 5593 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5595 | |
| 5596 | /* Mute capture amp left and right */ |
| 5597 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5598 | /* Set ADC connection select to match default mixer setting - mic |
| 5599 | * (on mic1 pin) |
| 5600 | */ |
| 5601 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5602 | |
| 5603 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5604 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5605 | */ |
| 5606 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5607 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5608 | |
| 5609 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5610 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5611 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5612 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5617 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5618 | |
| 5619 | { } |
| 5620 | }; |
| 5621 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5622 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5623 | * (adapted from Acer init verbs). |
| 5624 | */ |
| 5625 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5626 | /* GPIO 0 enables the output jack. |
| 5627 | * Turn this on and rely on the standard mute |
| 5628 | * methods whenever the user wants to turn these outputs off. |
| 5629 | */ |
| 5630 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5631 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5632 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5633 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5634 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5635 | /* Ensure all other unused pins are disabled and muted. */ |
| 5636 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5637 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5638 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5639 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5640 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5641 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5642 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5643 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5646 | /* Disable digital (SPDIF) pins */ |
| 5647 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5648 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5649 | |
| 5650 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5651 | * bus when acting as outputs. |
| 5652 | */ |
| 5653 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5654 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5655 | |
| 5656 | /* Start with output sum widgets muted and their output gains at min */ |
| 5657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5658 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5659 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5660 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5661 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5662 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5663 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5664 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5665 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5666 | |
| 5667 | /* Unmute Line-out pin widget amp left and right |
| 5668 | * (no equiv mixer ctrl) |
| 5669 | */ |
| 5670 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5671 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5672 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5673 | * will take care of enabling the pin's input/output buffers as needed. |
| 5674 | * Therefore there's no need to enable the input buffer at this |
| 5675 | * stage. |
| 5676 | */ |
| 5677 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5678 | |
| 5679 | /* Mute capture amp left and right */ |
| 5680 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5681 | /* Set ADC connection select to match default mixer setting - mic |
| 5682 | * (on mic1 pin) |
| 5683 | */ |
| 5684 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5685 | |
| 5686 | /* Do similar with the second ADC: mute capture input amp and |
| 5687 | * set ADC connection to mic to match ALSA's default state. |
| 5688 | */ |
| 5689 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5690 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5691 | |
| 5692 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5694 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5700 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5701 | |
| 5702 | { } |
| 5703 | }; |
| 5704 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5705 | static struct hda_verb alc260_will_verbs[] = { |
| 5706 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5707 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5708 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5709 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5710 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5711 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5712 | {} |
| 5713 | }; |
| 5714 | |
| 5715 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5716 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5717 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5718 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5719 | |
| 5720 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5721 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5722 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5723 | |
| 5724 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5725 | {} |
| 5726 | }; |
| 5727 | |
| 5728 | /* toggle speaker-output according to the hp-jack state */ |
| 5729 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5730 | { |
| 5731 | unsigned int present; |
| 5732 | |
| 5733 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5734 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5735 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5736 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5737 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5738 | AC_VERB_SET_GPIO_DATA, 1); |
| 5739 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5740 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5741 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5742 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5743 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5744 | AC_VERB_SET_GPIO_DATA, 0); |
| 5745 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5746 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5747 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5748 | } |
| 5749 | } |
| 5750 | |
| 5751 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5752 | unsigned int res) |
| 5753 | { |
| 5754 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5755 | alc260_replacer_672v_automute(codec); |
| 5756 | } |
| 5757 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5758 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5759 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5760 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5761 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5762 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5763 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5764 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5765 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5766 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5767 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5768 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5769 | {} |
| 5770 | }; |
| 5771 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5772 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5773 | * configuration. |
| 5774 | */ |
| 5775 | #ifdef CONFIG_SND_DEBUG |
| 5776 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5777 | 0x02, |
| 5778 | }; |
| 5779 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5780 | 0x04, 0x05, |
| 5781 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5782 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5783 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5784 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5785 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5786 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5787 | { |
| 5788 | .num_items = 7, |
| 5789 | .items = { |
| 5790 | { "MIC1 pin", 0x0 }, |
| 5791 | { "MIC2 pin", 0x1 }, |
| 5792 | { "LINE1 pin", 0x2 }, |
| 5793 | { "LINE2 pin", 0x3 }, |
| 5794 | { "CD pin", 0x4 }, |
| 5795 | { "LINE-OUT pin", 0x5 }, |
| 5796 | { "HP-OUT pin", 0x6 }, |
| 5797 | }, |
| 5798 | }, |
| 5799 | { |
| 5800 | .num_items = 8, |
| 5801 | .items = { |
| 5802 | { "MIC1 pin", 0x0 }, |
| 5803 | { "MIC2 pin", 0x1 }, |
| 5804 | { "LINE1 pin", 0x2 }, |
| 5805 | { "LINE2 pin", 0x3 }, |
| 5806 | { "CD pin", 0x4 }, |
| 5807 | { "Mixer", 0x5 }, |
| 5808 | { "LINE-OUT pin", 0x6 }, |
| 5809 | { "HP-OUT pin", 0x7 }, |
| 5810 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5811 | }, |
| 5812 | }; |
| 5813 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5814 | /* Output driver widgets */ |
| 5815 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5816 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5817 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5818 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5819 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5820 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5821 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5822 | /* Modes for retasking pin widgets |
| 5823 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5824 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5825 | * mention this restriction. At this stage it's not clear whether |
| 5826 | * this behaviour is intentional or is a hardware bug in chip |
| 5827 | * revisions available at least up until early 2006. Therefore for |
| 5828 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5829 | * choices, but if it turns out that the lack of mic bias for these |
| 5830 | * NIDs is intentional we could change their modes from |
| 5831 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5832 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5833 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5834 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5835 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5836 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5837 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5838 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5839 | |
| 5840 | /* Loopback mixer controls */ |
| 5841 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5842 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5843 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5844 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5845 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5846 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5847 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5848 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5849 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5850 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5851 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5852 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5853 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5854 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5855 | |
| 5856 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5857 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5858 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5859 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5860 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5861 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5862 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5863 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5864 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5865 | */ |
| 5866 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5867 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5868 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5869 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5870 | * this output to turn on an external amplifier. |
| 5871 | */ |
| 5872 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5873 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5874 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5875 | { } /* end */ |
| 5876 | }; |
| 5877 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5878 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5879 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5880 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5881 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5882 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5883 | /* Enable retasking pins as output, initially without power amp */ |
| 5884 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5885 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5886 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5887 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5888 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5889 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5890 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5891 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5892 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5893 | * payload also sets the generation to 0, output to be in "consumer" |
| 5894 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5895 | * control. |
| 5896 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5897 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5898 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5899 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5900 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5901 | * OUT1 sum bus when acting as an output. |
| 5902 | */ |
| 5903 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5904 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5905 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5906 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5907 | |
| 5908 | /* Start with output sum widgets muted and their output gains at min */ |
| 5909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5910 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5911 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5912 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5914 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5915 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5916 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5917 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5918 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5919 | /* Unmute retasking pin widget output buffers since the default |
| 5920 | * state appears to be output. As the pin mode is changed by the |
| 5921 | * user the pin mode control will take care of enabling the pin's |
| 5922 | * input/output buffers as needed. |
| 5923 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5924 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5926 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5927 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5928 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5929 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5930 | /* Also unmute the mono-out pin widget */ |
| 5931 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5932 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5933 | /* Mute capture amp left and right */ |
| 5934 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5935 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5936 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5937 | */ |
| 5938 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5939 | |
| 5940 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5941 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5942 | */ |
| 5943 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5944 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5945 | |
| 5946 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5947 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5948 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5949 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5950 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5951 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5952 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5953 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5954 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5955 | |
| 5956 | { } |
| 5957 | }; |
| 5958 | #endif |
| 5959 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5960 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5961 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5962 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5963 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5964 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5965 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5966 | /* |
| 5967 | * for BIOS auto-configuration |
| 5968 | */ |
| 5969 | |
| 5970 | 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] | 5971 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5972 | { |
| 5973 | hda_nid_t nid_vol; |
| 5974 | unsigned long vol_val, sw_val; |
| 5975 | char name[32]; |
| 5976 | int err; |
| 5977 | |
| 5978 | if (nid >= 0x0f && nid < 0x11) { |
| 5979 | nid_vol = nid - 0x7; |
| 5980 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5981 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5982 | } else if (nid == 0x11) { |
| 5983 | nid_vol = nid - 0x7; |
| 5984 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5985 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5986 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5987 | nid_vol = 0x08; |
| 5988 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5989 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5990 | } else |
| 5991 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5992 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5993 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5994 | /* first control for the volume widget */ |
| 5995 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5996 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5997 | if (err < 0) |
| 5998 | return err; |
| 5999 | *vol_bits |= (1 << nid_vol); |
| 6000 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6001 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6002 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 6003 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6004 | return err; |
| 6005 | return 1; |
| 6006 | } |
| 6007 | |
| 6008 | /* add playback controls from the parsed DAC table */ |
| 6009 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 6010 | const struct auto_pin_cfg *cfg) |
| 6011 | { |
| 6012 | hda_nid_t nid; |
| 6013 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6014 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6015 | |
| 6016 | spec->multiout.num_dacs = 1; |
| 6017 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 6018 | spec->multiout.dac_nids[0] = 0x02; |
| 6019 | |
| 6020 | nid = cfg->line_out_pins[0]; |
| 6021 | if (nid) { |
Takashi Iwai | 23112d6 | 2009-08-25 16:07:08 +0200 | [diff] [blame] | 6022 | const char *pfx; |
| 6023 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 6024 | pfx = "Master"; |
| 6025 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 6026 | pfx = "Speaker"; |
| 6027 | else |
| 6028 | pfx = "Front"; |
| 6029 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6030 | if (err < 0) |
| 6031 | return err; |
| 6032 | } |
| 6033 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6034 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6035 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6036 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6037 | if (err < 0) |
| 6038 | return err; |
| 6039 | } |
| 6040 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6041 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6042 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 6043 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 6044 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6045 | if (err < 0) |
| 6046 | return err; |
| 6047 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6048 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6049 | } |
| 6050 | |
| 6051 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6052 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6053 | const struct auto_pin_cfg *cfg) |
| 6054 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6055 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | } |
| 6057 | |
| 6058 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6059 | hda_nid_t nid, int pin_type, |
| 6060 | int sel_idx) |
| 6061 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6062 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | /* need the manual connection? */ |
| 6064 | if (nid >= 0x12) { |
| 6065 | int idx = nid - 0x12; |
| 6066 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 6067 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6068 | } |
| 6069 | } |
| 6070 | |
| 6071 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 6072 | { |
| 6073 | struct alc_spec *spec = codec->spec; |
| 6074 | hda_nid_t nid; |
| 6075 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6076 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6077 | if (nid) { |
| 6078 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 6079 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 6080 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6081 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 6082 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6083 | if (nid) |
| 6084 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 6085 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6086 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6087 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6088 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6089 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | |
| 6091 | #define ALC260_PIN_CD_NID 0x16 |
| 6092 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 6093 | { |
| 6094 | struct alc_spec *spec = codec->spec; |
| 6095 | int i; |
| 6096 | |
| 6097 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6098 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6099 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 6100 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 6101 | if (nid != ALC260_PIN_CD_NID && |
| 6102 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6103 | snd_hda_codec_write(codec, nid, 0, |
| 6104 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6105 | AMP_OUT_MUTE); |
| 6106 | } |
| 6107 | } |
| 6108 | } |
| 6109 | |
| 6110 | /* |
| 6111 | * generic initialization of ADC, input mixers and output mixers |
| 6112 | */ |
| 6113 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 6114 | /* |
| 6115 | * Unmute ADC0-1 and set the default input to mic-in |
| 6116 | */ |
| 6117 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6118 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6119 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6120 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6121 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 6123 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6124 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6125 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6126 | */ |
| 6127 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6128 | /* mute analog inputs */ |
| 6129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6134 | |
| 6135 | /* |
| 6136 | * Set up output mixers (0x08 - 0x0a) |
| 6137 | */ |
| 6138 | /* set vol=0 to output mixers */ |
| 6139 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6140 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6141 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6142 | /* set up input amps for analog loopback */ |
| 6143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6144 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6146 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6148 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6149 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 6150 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6151 | { } |
| 6152 | }; |
| 6153 | |
| 6154 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 6155 | { |
| 6156 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | int err; |
| 6158 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 6159 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6160 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 6161 | alc260_ignore); |
| 6162 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6163 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6164 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 6165 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6166 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6167 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6168 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 6169 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6170 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | return err; |
| 6172 | |
| 6173 | spec->multiout.max_channels = 2; |
| 6174 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6175 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6176 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6177 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6178 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6179 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6180 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6181 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6182 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6183 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6184 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6185 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6186 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6187 | return 1; |
| 6188 | } |
| 6189 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6190 | /* additional initialization for auto-configuration model */ |
| 6191 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6192 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6193 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6194 | alc260_auto_init_multi_out(codec); |
| 6195 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6196 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6197 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6198 | } |
| 6199 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6200 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6201 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6202 | { 0x07, HDA_INPUT, 0 }, |
| 6203 | { 0x07, HDA_INPUT, 1 }, |
| 6204 | { 0x07, HDA_INPUT, 2 }, |
| 6205 | { 0x07, HDA_INPUT, 3 }, |
| 6206 | { 0x07, HDA_INPUT, 4 }, |
| 6207 | { } /* end */ |
| 6208 | }; |
| 6209 | #endif |
| 6210 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6211 | /* |
| 6212 | * ALC260 configurations |
| 6213 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6214 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6215 | [ALC260_BASIC] = "basic", |
| 6216 | [ALC260_HP] = "hp", |
| 6217 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6218 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6219 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6220 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6221 | [ALC260_WILL] = "will", |
| 6222 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6223 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6224 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6225 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6226 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6227 | [ALC260_AUTO] = "auto", |
| 6228 | }; |
| 6229 | |
| 6230 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6231 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6232 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6233 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6234 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6235 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6236 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6237 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6238 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6239 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6240 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6241 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6242 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6243 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6244 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6245 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6246 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6247 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6248 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6249 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6250 | {} |
| 6251 | }; |
| 6252 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6253 | static struct alc_config_preset alc260_presets[] = { |
| 6254 | [ALC260_BASIC] = { |
| 6255 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6256 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | .init_verbs = { alc260_init_verbs }, |
| 6258 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6259 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6260 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6261 | .adc_nids = alc260_adc_nids, |
| 6262 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6263 | .channel_mode = alc260_modes, |
| 6264 | .input_mux = &alc260_capture_source, |
| 6265 | }, |
| 6266 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6267 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6268 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6269 | .init_verbs = { alc260_init_verbs, |
| 6270 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6271 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6272 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6273 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6274 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6275 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6276 | .channel_mode = alc260_modes, |
| 6277 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6278 | .unsol_event = alc260_hp_unsol_event, |
| 6279 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6280 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6281 | [ALC260_HP_DC7600] = { |
| 6282 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6283 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6284 | .init_verbs = { alc260_init_verbs, |
| 6285 | alc260_hp_dc7600_verbs }, |
| 6286 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6287 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6288 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6289 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6290 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6291 | .channel_mode = alc260_modes, |
| 6292 | .input_mux = &alc260_capture_source, |
| 6293 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6294 | .init_hook = alc260_hp_3012_automute, |
| 6295 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6296 | [ALC260_HP_3013] = { |
| 6297 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6298 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6299 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6300 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6301 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6302 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6303 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6304 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6305 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6306 | .channel_mode = alc260_modes, |
| 6307 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6308 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6309 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6310 | }, |
| 6311 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6312 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6313 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6314 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6315 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6316 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6317 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6318 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6319 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6320 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6321 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6322 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6323 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6324 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6325 | .init_verbs = { alc260_acer_init_verbs }, |
| 6326 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6327 | .dac_nids = alc260_dac_nids, |
| 6328 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6329 | .adc_nids = alc260_dual_adc_nids, |
| 6330 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6331 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6332 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6333 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6334 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6335 | [ALC260_FAVORIT100] = { |
| 6336 | .mixers = { alc260_favorit100_mixer }, |
| 6337 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6338 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6339 | .dac_nids = alc260_dac_nids, |
| 6340 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6341 | .adc_nids = alc260_dual_adc_nids, |
| 6342 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6343 | .channel_mode = alc260_modes, |
| 6344 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6345 | .input_mux = alc260_favorit100_capture_sources, |
| 6346 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6347 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6348 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6349 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6350 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6351 | .dac_nids = alc260_dac_nids, |
| 6352 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6353 | .adc_nids = alc260_adc_nids, |
| 6354 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6355 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6356 | .channel_mode = alc260_modes, |
| 6357 | .input_mux = &alc260_capture_source, |
| 6358 | }, |
| 6359 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6360 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6361 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6362 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6363 | .dac_nids = alc260_dac_nids, |
| 6364 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6365 | .adc_nids = alc260_adc_nids, |
| 6366 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6367 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6368 | .channel_mode = alc260_modes, |
| 6369 | .input_mux = &alc260_capture_source, |
| 6370 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6371 | .init_hook = alc260_replacer_672v_automute, |
| 6372 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6373 | #ifdef CONFIG_SND_DEBUG |
| 6374 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6375 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6376 | .init_verbs = { alc260_test_init_verbs }, |
| 6377 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6378 | .dac_nids = alc260_test_dac_nids, |
| 6379 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6380 | .adc_nids = alc260_test_adc_nids, |
| 6381 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6382 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6383 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6384 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6385 | }, |
| 6386 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6387 | }; |
| 6388 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6389 | static int patch_alc260(struct hda_codec *codec) |
| 6390 | { |
| 6391 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6392 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6393 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6394 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6395 | if (spec == NULL) |
| 6396 | return -ENOMEM; |
| 6397 | |
| 6398 | codec->spec = spec; |
| 6399 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6400 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6401 | alc260_models, |
| 6402 | alc260_cfg_tbl); |
| 6403 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6404 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6405 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6407 | } |
| 6408 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6409 | if (board_config == ALC260_AUTO) { |
| 6410 | /* automatic parse from the BIOS config */ |
| 6411 | err = alc260_parse_auto_config(codec); |
| 6412 | if (err < 0) { |
| 6413 | alc_free(codec); |
| 6414 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6415 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6416 | printk(KERN_INFO |
| 6417 | "hda_codec: Cannot set up configuration " |
| 6418 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6419 | board_config = ALC260_BASIC; |
| 6420 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6421 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6422 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6423 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6424 | if (err < 0) { |
| 6425 | alc_free(codec); |
| 6426 | return err; |
| 6427 | } |
| 6428 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6429 | if (board_config != ALC260_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 6430 | setup_preset(codec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6431 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6432 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6433 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6434 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6435 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6436 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6437 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6438 | if (!spec->adc_nids && spec->input_mux) { |
| 6439 | /* check whether NID 0x04 is valid */ |
| 6440 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 6441 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6442 | /* get type */ |
| 6443 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6444 | spec->adc_nids = alc260_adc_nids_alt; |
| 6445 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6446 | } else { |
| 6447 | spec->adc_nids = alc260_adc_nids; |
| 6448 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6449 | } |
| 6450 | } |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 6451 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6452 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6453 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6454 | spec->vmaster_nid = 0x08; |
| 6455 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6456 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6457 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6458 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6459 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6460 | if (!spec->loopback.amplist) |
| 6461 | spec->loopback.amplist = alc260_loopbacks; |
| 6462 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6463 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6464 | |
| 6465 | return 0; |
| 6466 | } |
| 6467 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6468 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6469 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6470 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6471 | * |
| 6472 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6473 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6474 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6475 | * 6-channel independent captures. |
| 6476 | * |
| 6477 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6478 | * driver yet). |
| 6479 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6480 | #define ALC882_DIGOUT_NID 0x06 |
| 6481 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6482 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6483 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6484 | #define ALC1200_DIGOUT_NID 0x10 |
| 6485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6486 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6487 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6488 | { 8, NULL } |
| 6489 | }; |
| 6490 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6491 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6492 | static hda_nid_t alc882_dac_nids[4] = { |
| 6493 | /* front, rear, clfe, rear_surr */ |
| 6494 | 0x02, 0x03, 0x04, 0x05 |
| 6495 | }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6496 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6497 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6498 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6499 | #define alc882_adc_nids alc880_adc_nids |
| 6500 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6501 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6502 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6503 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6504 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6505 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6506 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6507 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6508 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6509 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6510 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6511 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6512 | /* input MUX */ |
| 6513 | /* FIXME: should be a matrix-type input source selection */ |
| 6514 | |
| 6515 | static struct hda_input_mux alc882_capture_source = { |
| 6516 | .num_items = 4, |
| 6517 | .items = { |
| 6518 | { "Mic", 0x0 }, |
| 6519 | { "Front Mic", 0x1 }, |
| 6520 | { "Line", 0x2 }, |
| 6521 | { "CD", 0x4 }, |
| 6522 | }, |
| 6523 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6524 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6525 | #define alc883_capture_source alc882_capture_source |
| 6526 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6527 | static struct hda_input_mux alc889_capture_source = { |
| 6528 | .num_items = 3, |
| 6529 | .items = { |
| 6530 | { "Front Mic", 0x0 }, |
| 6531 | { "Mic", 0x3 }, |
| 6532 | { "Line", 0x2 }, |
| 6533 | }, |
| 6534 | }; |
| 6535 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6536 | static struct hda_input_mux mb5_capture_source = { |
| 6537 | .num_items = 3, |
| 6538 | .items = { |
| 6539 | { "Mic", 0x1 }, |
| 6540 | { "Line", 0x2 }, |
| 6541 | { "CD", 0x4 }, |
| 6542 | }, |
| 6543 | }; |
| 6544 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6545 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6546 | .num_items = 4, |
| 6547 | .items = { |
| 6548 | { "Mic", 0x1 }, |
| 6549 | { "Front Mic", 0x0 }, |
| 6550 | { "Line", 0x2 }, |
| 6551 | { "CD", 0x4 }, |
| 6552 | }, |
| 6553 | }; |
| 6554 | |
| 6555 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6556 | .num_items = 2, |
| 6557 | .items = { |
| 6558 | { "Mic", 0x1 }, |
| 6559 | { "Line", 0x2 }, |
| 6560 | }, |
| 6561 | }; |
| 6562 | |
| 6563 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6564 | .num_items = 4, |
| 6565 | .items = { |
| 6566 | { "Mic", 0x0 }, |
| 6567 | { "iMic", 0x1 }, |
| 6568 | { "Line", 0x2 }, |
| 6569 | { "CD", 0x4 }, |
| 6570 | }, |
| 6571 | }; |
| 6572 | |
| 6573 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6574 | .num_items = 2, |
| 6575 | .items = { |
| 6576 | { "Mic", 0x0 }, |
| 6577 | { "Int Mic", 0x1 }, |
| 6578 | }, |
| 6579 | }; |
| 6580 | |
| 6581 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6582 | .num_items = 3, |
| 6583 | .items = { |
| 6584 | { "Mic", 0x0 }, |
| 6585 | { "Front Mic", 0x1 }, |
| 6586 | { "Line", 0x4 }, |
| 6587 | }, |
| 6588 | }; |
| 6589 | |
| 6590 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6591 | .num_items = 2, |
| 6592 | .items = { |
| 6593 | { "Mic", 0x0 }, |
| 6594 | { "Line", 0x2 }, |
| 6595 | }, |
| 6596 | }; |
| 6597 | |
| 6598 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6599 | .num_items = 2, |
| 6600 | .items = { |
| 6601 | { "Mic", 0x0 }, |
| 6602 | /* Front Mic (0x01) unused */ |
| 6603 | { "Line", 0x2 }, |
| 6604 | /* Line 2 (0x03) unused */ |
| 6605 | /* CD (0x04) unsused? */ |
| 6606 | }, |
| 6607 | }; |
| 6608 | |
| 6609 | /* |
| 6610 | * 2ch mode |
| 6611 | */ |
| 6612 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6613 | { 2, NULL } |
| 6614 | }; |
| 6615 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6616 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6617 | * 2ch mode |
| 6618 | */ |
| 6619 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6620 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6621 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6622 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6623 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6624 | { } /* end */ |
| 6625 | }; |
| 6626 | |
| 6627 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6628 | * 4ch mode |
| 6629 | */ |
| 6630 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6631 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6632 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6633 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6634 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6635 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6636 | { } /* end */ |
| 6637 | }; |
| 6638 | |
| 6639 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6640 | * 6ch mode |
| 6641 | */ |
| 6642 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6643 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6644 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6645 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6646 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6647 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6649 | { } /* end */ |
| 6650 | }; |
| 6651 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6652 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6653 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6654 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6655 | { 6, alc882_3ST_ch6_init }, |
| 6656 | }; |
| 6657 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6658 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6659 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6660 | /* |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 6661 | * 2ch mode |
| 6662 | */ |
| 6663 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { |
| 6664 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 6665 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6666 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6667 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6668 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6669 | { } /* end */ |
| 6670 | }; |
| 6671 | |
| 6672 | /* |
| 6673 | * 4ch mode |
| 6674 | */ |
| 6675 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { |
| 6676 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6677 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6678 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6679 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6680 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6681 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6682 | { } /* end */ |
| 6683 | }; |
| 6684 | |
| 6685 | /* |
| 6686 | * 6ch mode |
| 6687 | */ |
| 6688 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { |
| 6689 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6690 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6691 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6692 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6693 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6694 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6695 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6696 | { } /* end */ |
| 6697 | }; |
| 6698 | |
| 6699 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { |
| 6700 | { 2, alc883_3ST_ch2_clevo_init }, |
| 6701 | { 4, alc883_3ST_ch4_clevo_init }, |
| 6702 | { 6, alc883_3ST_ch6_clevo_init }, |
| 6703 | }; |
| 6704 | |
| 6705 | |
| 6706 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6707 | * 6ch mode |
| 6708 | */ |
| 6709 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6710 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6711 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6712 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6713 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6714 | { } /* end */ |
| 6715 | }; |
| 6716 | |
| 6717 | /* |
| 6718 | * 8ch mode |
| 6719 | */ |
| 6720 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6721 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6722 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6723 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6724 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6725 | { } /* end */ |
| 6726 | }; |
| 6727 | |
| 6728 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6729 | { 6, alc882_sixstack_ch6_init }, |
| 6730 | { 8, alc882_sixstack_ch8_init }, |
| 6731 | }; |
| 6732 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6733 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6734 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6735 | */ |
| 6736 | |
| 6737 | /* |
| 6738 | * 2ch mode |
| 6739 | */ |
| 6740 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6741 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6742 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6743 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6744 | { } /* end */ |
| 6745 | }; |
| 6746 | |
| 6747 | /* |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6748 | * 4ch mode |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6749 | */ |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6750 | static struct hda_verb alc885_mbp_ch4_init[] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6751 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6752 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6753 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6754 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6755 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6756 | { } /* end */ |
| 6757 | }; |
| 6758 | |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6759 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6760 | { 2, alc885_mbp_ch2_init }, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 6761 | { 4, alc885_mbp_ch4_init }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6762 | }; |
| 6763 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6764 | /* |
| 6765 | * 2ch |
| 6766 | * Speakers/Woofer/HP = Front |
| 6767 | * LineIn = Input |
| 6768 | */ |
| 6769 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6772 | { } /* end */ |
| 6773 | }; |
| 6774 | |
| 6775 | /* |
| 6776 | * 6ch mode |
| 6777 | * Speakers/HP = Front |
| 6778 | * Woofer = LFE |
| 6779 | * LineIn = Surround |
| 6780 | */ |
| 6781 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6782 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6783 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6785 | { } /* end */ |
| 6786 | }; |
| 6787 | |
| 6788 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6789 | { 2, alc885_mb5_ch2_init }, |
| 6790 | { 6, alc885_mb5_ch6_init }, |
| 6791 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6792 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6793 | |
| 6794 | /* |
| 6795 | * 2ch mode |
| 6796 | */ |
| 6797 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6798 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6799 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6800 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6801 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6804 | { } /* end */ |
| 6805 | }; |
| 6806 | |
| 6807 | /* |
| 6808 | * 4ch mode |
| 6809 | */ |
| 6810 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6811 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6812 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6813 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6814 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6815 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6816 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6817 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6818 | { } /* end */ |
| 6819 | }; |
| 6820 | |
| 6821 | /* |
| 6822 | * 6ch mode |
| 6823 | */ |
| 6824 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6825 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6826 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6827 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6828 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6829 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6830 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6831 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6832 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6833 | { } /* end */ |
| 6834 | }; |
| 6835 | |
| 6836 | /* |
| 6837 | * 8ch mode |
| 6838 | */ |
| 6839 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6840 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6841 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6842 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6843 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6844 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6845 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6846 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6847 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6848 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6849 | { } /* end */ |
| 6850 | }; |
| 6851 | |
| 6852 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6853 | { 2, alc883_4ST_ch2_init }, |
| 6854 | { 4, alc883_4ST_ch4_init }, |
| 6855 | { 6, alc883_4ST_ch6_init }, |
| 6856 | { 8, alc883_4ST_ch8_init }, |
| 6857 | }; |
| 6858 | |
| 6859 | |
| 6860 | /* |
| 6861 | * 2ch mode |
| 6862 | */ |
| 6863 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6864 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6865 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6866 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6867 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6868 | { } /* end */ |
| 6869 | }; |
| 6870 | |
| 6871 | /* |
| 6872 | * 4ch mode |
| 6873 | */ |
| 6874 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6875 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6876 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6877 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6878 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6879 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6880 | { } /* end */ |
| 6881 | }; |
| 6882 | |
| 6883 | /* |
| 6884 | * 6ch mode |
| 6885 | */ |
| 6886 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6887 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6888 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6889 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6890 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6891 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6892 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6893 | { } /* end */ |
| 6894 | }; |
| 6895 | |
| 6896 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6897 | { 2, alc883_3ST_ch2_intel_init }, |
| 6898 | { 4, alc883_3ST_ch4_intel_init }, |
| 6899 | { 6, alc883_3ST_ch6_intel_init }, |
| 6900 | }; |
| 6901 | |
| 6902 | /* |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6903 | * 2ch mode |
| 6904 | */ |
| 6905 | static struct hda_verb alc889_ch2_intel_init[] = { |
| 6906 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6907 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6908 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6909 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6910 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6911 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6912 | { } /* end */ |
| 6913 | }; |
| 6914 | |
| 6915 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6916 | * 6ch mode |
| 6917 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6918 | static struct hda_verb alc889_ch6_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6919 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6920 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6921 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6922 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6923 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6924 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6925 | { } /* end */ |
| 6926 | }; |
| 6927 | |
| 6928 | /* |
| 6929 | * 8ch mode |
| 6930 | */ |
| 6931 | static struct hda_verb alc889_ch8_intel_init[] = { |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6932 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 6933 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6934 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6935 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6936 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6937 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6938 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6939 | { } /* end */ |
| 6940 | }; |
| 6941 | |
Wu Fengguang | dd7714c | 2009-07-30 14:36:35 +0800 | [diff] [blame] | 6942 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { |
| 6943 | { 2, alc889_ch2_intel_init }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6944 | { 6, alc889_ch6_intel_init }, |
| 6945 | { 8, alc889_ch8_intel_init }, |
| 6946 | }; |
| 6947 | |
| 6948 | /* |
| 6949 | * 6ch mode |
| 6950 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6951 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6952 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6953 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6954 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6955 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6956 | { } /* end */ |
| 6957 | }; |
| 6958 | |
| 6959 | /* |
| 6960 | * 8ch mode |
| 6961 | */ |
| 6962 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6963 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6964 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6965 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6966 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6967 | { } /* end */ |
| 6968 | }; |
| 6969 | |
| 6970 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6971 | { 6, alc883_sixstack_ch6_init }, |
| 6972 | { 8, alc883_sixstack_ch8_init }, |
| 6973 | }; |
| 6974 | |
| 6975 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6976 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6977 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6978 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6979 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6980 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6981 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6982 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6983 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6984 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6985 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6986 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6987 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6988 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6989 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6991 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6992 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6993 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6994 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6995 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6996 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6997 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6999 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7000 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7001 | { } /* end */ |
| 7002 | }; |
| 7003 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7004 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7005 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7006 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7007 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7008 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7009 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7010 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7011 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7013 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7014 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7015 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7016 | { } /* end */ |
| 7017 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7018 | |
| 7019 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7021 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7022 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7023 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7024 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 7025 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 7026 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 7027 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7028 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7029 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7030 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7031 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 7032 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 7033 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 7034 | { } /* end */ |
| 7035 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7036 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7037 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 7038 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7039 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7041 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7045 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 7047 | { } /* end */ |
| 7048 | }; |
| 7049 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7050 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 7051 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7052 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7060 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7061 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7063 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7064 | { } /* end */ |
| 7065 | }; |
| 7066 | |
| 7067 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 7068 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 7069 | */ |
| 7070 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 7071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7072 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7073 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7074 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 7075 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7076 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7077 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7078 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7079 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 7080 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 7081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7082 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 7083 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7084 | { } /* end */ |
| 7085 | }; |
| 7086 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7087 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 7088 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7089 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7091 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7092 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7093 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7094 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7095 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7096 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7097 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7098 | { } /* end */ |
| 7099 | }; |
| 7100 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7101 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 7102 | { |
| 7103 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7104 | .name = "Channel Mode", |
| 7105 | .info = alc_ch_mode_info, |
| 7106 | .get = alc_ch_mode_get, |
| 7107 | .put = alc_ch_mode_put, |
| 7108 | }, |
| 7109 | { } /* end */ |
| 7110 | }; |
| 7111 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7112 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7113 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7117 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7119 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7120 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7121 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7122 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7123 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7125 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7126 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7127 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7128 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7129 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 7130 | /* mute analog input loopbacks */ |
| 7131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7133 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7134 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7135 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7136 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7137 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7138 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7140 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7141 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7143 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7144 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7145 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7146 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7147 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7148 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7149 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7150 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7151 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7152 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7153 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7154 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7155 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7156 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 7157 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7158 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7159 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7160 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 7161 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7162 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7164 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7165 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7166 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7167 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7168 | |
| 7169 | /* FIXME: use matrix-type input source selection */ |
| 7170 | /* 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] | 7171 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7172 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7173 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7174 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7175 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7176 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7178 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7179 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7180 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7181 | /* ADC2: mute amp left and right */ |
| 7182 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7183 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 7184 | /* ADC3: mute amp left and right */ |
| 7185 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 7186 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7187 | |
| 7188 | { } |
| 7189 | }; |
| 7190 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7191 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 7192 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7197 | /* ADC1: mute amp left and right */ |
| 7198 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7199 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7200 | { } |
| 7201 | }; |
| 7202 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7203 | static struct hda_verb alc882_eapd_verbs[] = { |
| 7204 | /* change to EAPD mode */ |
| 7205 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7206 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7207 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7208 | }; |
| 7209 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7210 | static struct hda_verb alc889_eapd_verbs[] = { |
| 7211 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7212 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 7213 | { } |
| 7214 | }; |
| 7215 | |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7216 | static struct hda_verb alc_hp15_unsol_verbs[] = { |
| 7217 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 7218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7219 | {} |
| 7220 | }; |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7221 | |
| 7222 | static struct hda_verb alc885_init_verbs[] = { |
| 7223 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7227 | /* Rear mixer */ |
| 7228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7229 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7230 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7231 | /* CLFE mixer */ |
| 7232 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7235 | /* Side mixer */ |
| 7236 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7237 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7238 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7239 | |
| 7240 | /* mute analog input loopbacks */ |
| 7241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7244 | |
| 7245 | /* Front HP Pin: output 0 (0x0c) */ |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 7246 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7248 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7249 | /* Front Pin: output 0 (0x0c) */ |
| 7250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7251 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7252 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7253 | /* Rear Pin: output 1 (0x0d) */ |
| 7254 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7255 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7256 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7257 | /* CLFE Pin: output 2 (0x0e) */ |
| 7258 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7259 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7260 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7261 | /* Side Pin: output 3 (0x0f) */ |
| 7262 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7263 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7264 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7265 | /* Mic (rear) pin: input vref at 80% */ |
| 7266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7268 | /* Front Mic pin: input vref at 80% */ |
| 7269 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7270 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7271 | /* Line In pin: input */ |
| 7272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7274 | |
| 7275 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7276 | /* Input mixer1 */ |
| 7277 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7278 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7279 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7280 | /* Input mixer2 */ |
| 7281 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7282 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7283 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7284 | /* Input mixer3 */ |
| 7285 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7286 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7288 | /* ADC2: mute amp left and right */ |
| 7289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7290 | /* ADC3: mute amp left and right */ |
| 7291 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7292 | |
| 7293 | { } |
| 7294 | }; |
| 7295 | |
| 7296 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7297 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7298 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7299 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7300 | { } |
| 7301 | }; |
| 7302 | |
| 7303 | |
| 7304 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7305 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7306 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7307 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7308 | { } |
| 7309 | }; |
| 7310 | |
| 7311 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7312 | #define alc883_init_verbs alc882_base_init_verbs |
| 7313 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7314 | /* Mac Pro test */ |
| 7315 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7316 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7317 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7318 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7319 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7320 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7321 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7322 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7323 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7324 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7325 | { } /* end */ |
| 7326 | }; |
| 7327 | |
| 7328 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7329 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7330 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7331 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7332 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7333 | /* Front Pin: output 0 (0x0c) */ |
| 7334 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7335 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7336 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7337 | /* Front Mic pin: input vref at 80% */ |
| 7338 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7340 | /* Speaker: output */ |
| 7341 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7342 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7343 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7344 | /* Headphone output (output 0 - 0x0c) */ |
| 7345 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7346 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7347 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7348 | |
| 7349 | /* FIXME: use matrix-type input source selection */ |
| 7350 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7351 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7352 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7353 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7354 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7355 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7356 | /* Input mixer2 */ |
| 7357 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7358 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7359 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7360 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7361 | /* Input mixer3 */ |
| 7362 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7363 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7364 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7365 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7366 | /* ADC1: mute amp left and right */ |
| 7367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7368 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7369 | /* ADC2: mute amp left and right */ |
| 7370 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7371 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7372 | /* ADC3: mute amp left and right */ |
| 7373 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7374 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7375 | |
| 7376 | { } |
| 7377 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7378 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7379 | /* Macbook 5,1 */ |
| 7380 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7381 | /* DACs */ |
| 7382 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7383 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7384 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7385 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7386 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7387 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7389 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7390 | /* Surround mixer */ |
| 7391 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7392 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7393 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7394 | /* LFE mixer */ |
| 7395 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7397 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7398 | /* HP mixer */ |
| 7399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7400 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7401 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7402 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7403 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7404 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7405 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7406 | /* LFE Pin (0x0e) */ |
| 7407 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7408 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7409 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7410 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7412 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7413 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7414 | /* Front Mic pin: input vref at 80% */ |
| 7415 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7416 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7417 | /* Line In pin */ |
| 7418 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7419 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7420 | |
| 7421 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7422 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7423 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7424 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7425 | { } |
| 7426 | }; |
| 7427 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7428 | /* Macbook Pro rev3 */ |
| 7429 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7430 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7431 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7432 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7434 | /* Rear mixer */ |
| 7435 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7436 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7437 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7438 | /* HP mixer */ |
| 7439 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7440 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7441 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7442 | /* Front Pin: output 0 (0x0c) */ |
| 7443 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7444 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7445 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7446 | /* HP Pin: output 0 (0x0e) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7447 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
Takashi Iwai | a3f730a | 2009-08-31 08:15:26 +0200 | [diff] [blame] | 7448 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7449 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7450 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7451 | /* Mic (rear) pin: input vref at 80% */ |
| 7452 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7453 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7454 | /* Front Mic pin: input vref at 80% */ |
| 7455 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7456 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7457 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7458 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7459 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7460 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7461 | |
| 7462 | /* FIXME: use matrix-type input source selection */ |
| 7463 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7464 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7465 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7466 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7467 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7468 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7469 | /* Input mixer2 */ |
| 7470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7471 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7472 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7473 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7474 | /* Input mixer3 */ |
| 7475 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7476 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7477 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7478 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7479 | /* ADC1: mute amp left and right */ |
| 7480 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7481 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7482 | /* ADC2: mute amp left and right */ |
| 7483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7484 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7485 | /* ADC3: mute amp left and right */ |
| 7486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7487 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7488 | |
| 7489 | { } |
| 7490 | }; |
| 7491 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7492 | /* iMac 24 mixer. */ |
| 7493 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7494 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7495 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7496 | { } /* end */ |
| 7497 | }; |
| 7498 | |
| 7499 | /* iMac 24 init verbs. */ |
| 7500 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7501 | /* Internal speakers: output 0 (0x0c) */ |
| 7502 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7504 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7505 | /* Internal speakers: output 0 (0x0c) */ |
| 7506 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7507 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7508 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7509 | /* Headphone: output 0 (0x0c) */ |
| 7510 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7511 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7512 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7513 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7514 | /* Front Mic: input vref at 80% */ |
| 7515 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7516 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7517 | { } |
| 7518 | }; |
| 7519 | |
| 7520 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7521 | static void alc885_imac24_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7522 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7523 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7524 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7525 | spec->autocfg.hp_pins[0] = 0x14; |
| 7526 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7527 | spec->autocfg.speaker_pins[1] = 0x1a; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7528 | } |
| 7529 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7530 | static void alc885_mbp3_setup(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7531 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7532 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7533 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7534 | spec->autocfg.hp_pins[0] = 0x15; |
| 7535 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7536 | } |
| 7537 | |
| 7538 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7539 | static struct hda_verb alc882_targa_verbs[] = { |
| 7540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7542 | |
| 7543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7544 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7545 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7546 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7547 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7548 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7549 | |
| 7550 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7551 | { } /* end */ |
| 7552 | }; |
| 7553 | |
| 7554 | /* toggle speaker-output according to the hp-jack state */ |
| 7555 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7556 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7557 | struct alc_spec *spec = codec->spec; |
| 7558 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7559 | 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] | 7560 | spec->jack_present ? 1 : 3); |
| 7561 | } |
| 7562 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7563 | static void alc882_targa_setup(struct hda_codec *codec) |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7564 | { |
| 7565 | struct alc_spec *spec = codec->spec; |
| 7566 | |
| 7567 | spec->autocfg.hp_pins[0] = 0x14; |
| 7568 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7569 | } |
| 7570 | |
| 7571 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7572 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7573 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7574 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7575 | } |
| 7576 | |
| 7577 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7580 | |
| 7581 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7582 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7583 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7584 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7585 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7586 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7587 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7588 | |
| 7589 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7590 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7591 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7592 | { } /* end */ |
| 7593 | }; |
| 7594 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7595 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7596 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7598 | |
| 7599 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7600 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7601 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7602 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7603 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7604 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7605 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7606 | |
| 7607 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7608 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7609 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7610 | { } /* end */ |
| 7611 | }; |
| 7612 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7613 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7614 | { |
| 7615 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7616 | |
| 7617 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7618 | AC_VERB_GET_GPIO_DATA, 0); |
| 7619 | |
| 7620 | if (!muted) |
| 7621 | gpiostate |= (1 << pin); |
| 7622 | else |
| 7623 | gpiostate &= ~(1 << pin); |
| 7624 | |
| 7625 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7626 | AC_VERB_GET_GPIO_MASK, 0); |
| 7627 | gpiomask |= (1 << pin); |
| 7628 | |
| 7629 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7630 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7631 | gpiodir |= (1 << pin); |
| 7632 | |
| 7633 | |
| 7634 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7635 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7636 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7637 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7638 | |
| 7639 | msleep(1); |
| 7640 | |
| 7641 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7642 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7643 | } |
| 7644 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7645 | /* set up GPIO at initialization */ |
| 7646 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7647 | { |
| 7648 | alc882_gpio_mute(codec, 0, 0); |
| 7649 | alc882_gpio_mute(codec, 1, 0); |
| 7650 | } |
| 7651 | |
| 7652 | /* set up GPIO and update auto-muting at initialization */ |
| 7653 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7654 | { |
| 7655 | alc885_macpro_init_hook(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 7656 | alc_automute_amp(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7657 | } |
| 7658 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7659 | /* |
| 7660 | * generic initialization of ADC, input mixers and output mixers |
| 7661 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7662 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7663 | /* |
| 7664 | * Unmute ADC0-2 and set the default input to mic-in |
| 7665 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7666 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7667 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7668 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7669 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7670 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7671 | /* 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] | 7672 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7673 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7674 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7675 | */ |
| 7676 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7678 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7679 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7680 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7681 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7682 | |
| 7683 | /* |
| 7684 | * Set up output mixers (0x0c - 0x0f) |
| 7685 | */ |
| 7686 | /* set vol=0 to output mixers */ |
| 7687 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7688 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7689 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7690 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7691 | /* set up input amps for analog loopback */ |
| 7692 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7695 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7696 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7697 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7698 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7699 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7700 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7701 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7702 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7703 | |
| 7704 | /* FIXME: use matrix-type input source selection */ |
| 7705 | /* 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] | 7706 | /* Input mixer2 */ |
| 7707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7711 | /* Input mixer3 */ |
| 7712 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7714 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7716 | |
| 7717 | { } |
| 7718 | }; |
| 7719 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7720 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7721 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7722 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7723 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7724 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7725 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7726 | { } /* end */ |
| 7727 | }; |
| 7728 | |
| 7729 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7730 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7731 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7733 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7735 | { } /* end */ |
| 7736 | }; |
| 7737 | |
| 7738 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7739 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7740 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7741 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7742 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7743 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7744 | { } /* end */ |
| 7745 | }; |
| 7746 | |
| 7747 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7748 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7749 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7750 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7753 | { } /* end */ |
| 7754 | }; |
| 7755 | |
| 7756 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7757 | { 2, alc889A_mb31_ch2_init }, |
| 7758 | { 4, alc889A_mb31_ch4_init }, |
| 7759 | { 5, alc889A_mb31_ch5_init }, |
| 7760 | { 6, alc889A_mb31_ch6_init }, |
| 7761 | }; |
| 7762 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7763 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7764 | /* eanable EAPD on medion laptop */ |
| 7765 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7766 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7767 | { } |
| 7768 | }; |
| 7769 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7770 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7771 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7772 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7773 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7774 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7775 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7776 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7777 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7778 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7779 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7781 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7782 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7783 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7784 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7785 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7786 | { } /* end */ |
| 7787 | }; |
| 7788 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7789 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7790 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7791 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7792 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7793 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7794 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7795 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7796 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7797 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7798 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7799 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7800 | { } /* end */ |
| 7801 | }; |
| 7802 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7803 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7804 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7805 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7806 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7807 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7809 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7811 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7812 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7813 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7814 | { } /* end */ |
| 7815 | }; |
| 7816 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7817 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7818 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7819 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7820 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7823 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7824 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7825 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7826 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7827 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7829 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7830 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7831 | { } /* end */ |
| 7832 | }; |
| 7833 | |
| 7834 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7835 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7836 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7837 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7838 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7840 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7841 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7842 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7843 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7845 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7846 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7847 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7848 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7849 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7850 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7851 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7852 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7853 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7854 | { } /* end */ |
| 7855 | }; |
| 7856 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7857 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7858 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7859 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7860 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7861 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7862 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7863 | HDA_OUTPUT), |
| 7864 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7865 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7866 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7867 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7873 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7875 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7876 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7877 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7878 | { } /* end */ |
| 7879 | }; |
| 7880 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7881 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7882 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7883 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7884 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7885 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7886 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7887 | HDA_OUTPUT), |
| 7888 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7889 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7890 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7894 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7895 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7896 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7897 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7899 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7900 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7902 | { } /* end */ |
| 7903 | }; |
| 7904 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7905 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7906 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7907 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7908 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7909 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7910 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7911 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7912 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7913 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7914 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7915 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7916 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7917 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7918 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7920 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7921 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7922 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7923 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7924 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7925 | { } /* end */ |
| 7926 | }; |
| 7927 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7928 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7929 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7930 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7931 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7932 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7933 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7934 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7935 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7936 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7937 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7938 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7939 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7940 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7941 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7943 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7944 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7945 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7946 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7947 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7948 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7949 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7950 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7951 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7952 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7953 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7954 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7955 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7956 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7957 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7958 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7959 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7960 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7961 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7962 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7963 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7964 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7965 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7966 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7967 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7968 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7970 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7971 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7972 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7973 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7974 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7975 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7976 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7977 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7979 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7980 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7982 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7983 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7984 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7985 | { } /* end */ |
| 7986 | }; |
| 7987 | |
| 7988 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7989 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7990 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7991 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7993 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7994 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7995 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7996 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7997 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7998 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7999 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8000 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8001 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8002 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8003 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8004 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8005 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8006 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8007 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8008 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8009 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8010 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8011 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8012 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8013 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 8014 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8015 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8016 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8017 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 8018 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8019 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8020 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8021 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8023 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8025 | { } /* end */ |
| 8026 | }; |
| 8027 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8028 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 8029 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8030 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8031 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8032 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 8033 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 8034 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 8035 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 8036 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 8037 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 8038 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 8039 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8044 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8045 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8047 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8048 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 8049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8050 | { } /* end */ |
| 8051 | }; |
| 8052 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8053 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 8054 | /* Output mixers */ |
| 8055 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 8056 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 8057 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 8058 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 8059 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 8060 | HDA_OUTPUT), |
| 8061 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 8062 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 8063 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 8064 | /* Output switches */ |
| 8065 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 8066 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 8067 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 8068 | /* Boost mixers */ |
| 8069 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 8070 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 8071 | /* Input mixers */ |
| 8072 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 8073 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 8074 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8075 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8076 | { } /* end */ |
| 8077 | }; |
| 8078 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8079 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 8080 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8081 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8082 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8084 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8085 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8086 | { } /* end */ |
| 8087 | }; |
| 8088 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8089 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 8090 | .ops = &snd_hda_bind_vol, |
| 8091 | .values = { |
| 8092 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8093 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8094 | 0 |
| 8095 | }, |
| 8096 | }; |
| 8097 | |
| 8098 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 8099 | .ops = &snd_hda_bind_sw, |
| 8100 | .values = { |
| 8101 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 8102 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 8103 | 0 |
| 8104 | }, |
| 8105 | }; |
| 8106 | |
| 8107 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 8108 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8109 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 8110 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8111 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8112 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8113 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8114 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8116 | { } /* end */ |
| 8117 | }; |
| 8118 | |
| 8119 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8120 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 8121 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 8122 | { |
| 8123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8124 | /* .name = "Capture Source", */ |
| 8125 | .name = "Input Source", |
| 8126 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 8127 | .info = alc_mux_enum_info, |
| 8128 | .get = alc_mux_enum_get, |
| 8129 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8130 | }, |
| 8131 | { } /* end */ |
| 8132 | }; |
| 8133 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8134 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 8135 | { |
| 8136 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8137 | .name = "Channel Mode", |
| 8138 | .info = alc_ch_mode_info, |
| 8139 | .get = alc_ch_mode_get, |
| 8140 | .put = alc_ch_mode_put, |
| 8141 | }, |
| 8142 | { } /* end */ |
| 8143 | }; |
| 8144 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8145 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8146 | static void alc883_mitac_setup(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8147 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8148 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8149 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8150 | spec->autocfg.hp_pins[0] = 0x15; |
| 8151 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8152 | spec->autocfg.speaker_pins[1] = 0x17; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8153 | } |
| 8154 | |
| 8155 | /* auto-toggle front mic */ |
| 8156 | /* |
| 8157 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 8158 | { |
| 8159 | unsigned int present; |
| 8160 | unsigned char bits; |
| 8161 | |
| 8162 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8163 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8164 | bits = present ? HDA_AMP_MUTE : 0; |
| 8165 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 8166 | } |
| 8167 | */ |
| 8168 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8169 | static struct hda_verb alc883_mitac_verbs[] = { |
| 8170 | /* HP */ |
| 8171 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8172 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8173 | /* Subwoofer */ |
| 8174 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8175 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8176 | |
| 8177 | /* enable unsolicited event */ |
| 8178 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8179 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 8180 | |
| 8181 | { } /* end */ |
| 8182 | }; |
| 8183 | |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8184 | static struct hda_verb alc883_clevo_m540r_verbs[] = { |
| 8185 | /* HP */ |
| 8186 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8188 | /* Int speaker */ |
| 8189 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ |
| 8190 | |
| 8191 | /* enable unsolicited event */ |
| 8192 | /* |
| 8193 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8194 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8195 | */ |
| 8196 | |
| 8197 | { } /* end */ |
| 8198 | }; |
| 8199 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8200 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8201 | /* HP */ |
| 8202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8203 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8204 | /* Int speaker */ |
| 8205 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8207 | |
| 8208 | /* enable unsolicited event */ |
| 8209 | {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] | 8210 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8211 | |
| 8212 | { } /* end */ |
| 8213 | }; |
| 8214 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8215 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 8216 | /* HP */ |
| 8217 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8219 | /* Subwoofer */ |
| 8220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8222 | |
| 8223 | /* enable unsolicited event */ |
| 8224 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8225 | |
| 8226 | { } /* end */ |
| 8227 | }; |
| 8228 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8229 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8231 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8232 | |
| 8233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8234 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8235 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8236 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 8237 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8238 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8239 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 8240 | /* Connect Mic jack to CLFE */ |
| 8241 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8242 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8243 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8244 | /* Connect Line-in jack to Surround */ |
| 8245 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8246 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8247 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8248 | /* Connect HP out jack to Front */ |
| 8249 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8250 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8251 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8252 | |
| 8253 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8254 | |
| 8255 | { } /* end */ |
| 8256 | }; |
| 8257 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8258 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8259 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8260 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8261 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8262 | { } /* end */ |
| 8263 | }; |
| 8264 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8265 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8266 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8267 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8268 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8269 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8270 | { } /* end */ |
| 8271 | }; |
| 8272 | |
| 8273 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8274 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8275 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8276 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8277 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8278 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8279 | { } /* end */ |
| 8280 | }; |
| 8281 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8282 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8283 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8285 | |
| 8286 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8287 | |
| 8288 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8289 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8290 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8291 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8292 | { } /* end */ |
| 8293 | }; |
| 8294 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8295 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8298 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8299 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8300 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8301 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8302 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8303 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8304 | { } /* end */ |
| 8305 | }; |
| 8306 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8307 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8308 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8309 | { } |
| 8310 | }; |
| 8311 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8312 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8313 | /* HP */ |
| 8314 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8315 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8316 | |
| 8317 | /* enable unsolicited event */ |
| 8318 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8319 | |
| 8320 | { } /* end */ |
| 8321 | }; |
| 8322 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8323 | static void alc888_3st_hp_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8324 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8325 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8326 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8327 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8328 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8329 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8330 | spec->autocfg.speaker_pins[2] = 0x18; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8331 | } |
| 8332 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8333 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8334 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8335 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8336 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8337 | {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] | 8338 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8339 | }; |
| 8340 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8341 | /* |
| 8342 | * 2ch mode |
| 8343 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8344 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8345 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8346 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8347 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8348 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8349 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8350 | }; |
| 8351 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8352 | /* |
| 8353 | * 4ch mode |
| 8354 | */ |
| 8355 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8356 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8357 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8358 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8359 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8360 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8361 | { } /* end */ |
| 8362 | }; |
| 8363 | |
| 8364 | /* |
| 8365 | * 6ch mode |
| 8366 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8367 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8368 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8369 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8370 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8371 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8372 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8373 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8374 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8375 | }; |
| 8376 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8377 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8378 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8379 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8380 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8381 | }; |
| 8382 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8383 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8384 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8385 | { |
| 8386 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8387 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8388 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8389 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8390 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8391 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8392 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8393 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8394 | } |
| 8395 | |
| 8396 | /* toggle RCA according to the front-jack state */ |
| 8397 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8398 | { |
| 8399 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8400 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8401 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8402 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8403 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8404 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8405 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8406 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8407 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8408 | unsigned int res) |
| 8409 | { |
| 8410 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8411 | alc888_lenovo_ms7195_front_automute(codec); |
| 8412 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8413 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8414 | } |
| 8415 | |
| 8416 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8417 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8418 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8419 | |
| 8420 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8421 | |
| 8422 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8423 | { } /* end */ |
| 8424 | }; |
| 8425 | |
| 8426 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8427 | static void alc883_medion_md2_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8428 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8429 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8430 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8431 | spec->autocfg.hp_pins[0] = 0x14; |
| 8432 | spec->autocfg.speaker_pins[0] = 0x15; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8433 | } |
| 8434 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8435 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8436 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8437 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8438 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8439 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8440 | { |
| 8441 | unsigned int present; |
| 8442 | |
| 8443 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8444 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8445 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8446 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8447 | } |
| 8448 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8449 | static void alc883_clevo_m720_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8450 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8451 | struct alc_spec *spec = codec->spec; |
| 8452 | |
| 8453 | spec->autocfg.hp_pins[0] = 0x15; |
| 8454 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8455 | } |
| 8456 | |
| 8457 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
| 8458 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8459 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8460 | alc883_clevo_m720_mic_automute(codec); |
| 8461 | } |
| 8462 | |
| 8463 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8464 | unsigned int res) |
| 8465 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8466 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8467 | case ALC880_MIC_EVENT: |
| 8468 | alc883_clevo_m720_mic_automute(codec); |
| 8469 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8470 | default: |
| 8471 | alc_automute_amp_unsol_event(codec, res); |
| 8472 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8473 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8474 | } |
| 8475 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8476 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8477 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8478 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8479 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8480 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8481 | spec->autocfg.hp_pins[0] = 0x14; |
| 8482 | spec->autocfg.speaker_pins[0] = 0x15; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8483 | } |
| 8484 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8485 | static void alc883_haier_w66_setup(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8486 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8487 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8488 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8489 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8490 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8491 | } |
| 8492 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8493 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8494 | { |
| 8495 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8496 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8497 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8498 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8499 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8500 | bits = present ? HDA_AMP_MUTE : 0; |
| 8501 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8502 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8503 | } |
| 8504 | |
| 8505 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8506 | { |
| 8507 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8508 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8509 | |
| 8510 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8511 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8512 | bits = present ? HDA_AMP_MUTE : 0; |
| 8513 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8514 | HDA_AMP_MUTE, bits); |
| 8515 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8516 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8517 | } |
| 8518 | |
| 8519 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8520 | unsigned int res) |
| 8521 | { |
| 8522 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8523 | alc883_lenovo_101e_all_automute(codec); |
| 8524 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8525 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8526 | } |
| 8527 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8528 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8529 | static void alc883_acer_aspire_setup(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8530 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8531 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8532 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8533 | spec->autocfg.hp_pins[0] = 0x14; |
| 8534 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8535 | spec->autocfg.speaker_pins[1] = 0x16; |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8536 | } |
| 8537 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8538 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8539 | /* HP Pin: output 0 (0x0c) */ |
| 8540 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8541 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8542 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8543 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8544 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8545 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8546 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8547 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8548 | /* eanable EAPD on medion laptop */ |
| 8549 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8550 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8551 | /* enable unsolicited event */ |
| 8552 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8553 | { } |
| 8554 | }; |
| 8555 | |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8556 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { |
| 8557 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8558 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 8559 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8560 | { } /* end */ |
| 8561 | }; |
| 8562 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8563 | static void alc888_6st_dell_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8564 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8565 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8566 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8567 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8568 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8569 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8570 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8571 | spec->autocfg.speaker_pins[3] = 0x17; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8572 | } |
| 8573 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8574 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8575 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8576 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8577 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8578 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8579 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8580 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8581 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8582 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8583 | spec->autocfg.speaker_pins[4] = 0x1a; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8584 | } |
| 8585 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8586 | static void alc883_vaiott_setup(struct hda_codec *codec) |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8587 | { |
| 8588 | struct alc_spec *spec = codec->spec; |
| 8589 | |
| 8590 | spec->autocfg.hp_pins[0] = 0x15; |
| 8591 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8592 | spec->autocfg.speaker_pins[1] = 0x17; |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8593 | } |
| 8594 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8595 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8596 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8597 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8598 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8599 | /* enable unsolicited event */ |
| 8600 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8601 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8602 | { } /* end */ |
| 8603 | }; |
| 8604 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8605 | static void alc883_mode2_setup(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8606 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8607 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8608 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8609 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8610 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8611 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8612 | spec->autocfg.speaker_pins[2] = 0x16; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8613 | spec->ext_mic.pin = 0x18; |
| 8614 | spec->int_mic.pin = 0x19; |
| 8615 | spec->ext_mic.mux_idx = 0; |
| 8616 | spec->int_mic.mux_idx = 1; |
| 8617 | spec->auto_mic = 1; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8618 | } |
| 8619 | |
| 8620 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8621 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8622 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8623 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8624 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8625 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8626 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8627 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8628 | /* enable unsolicited event */ |
| 8629 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8630 | { } /* end */ |
| 8631 | }; |
| 8632 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8633 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8634 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8635 | struct alc_spec *spec = codec->spec; |
| 8636 | |
| 8637 | spec->autocfg.hp_pins[0] = 0x14; |
| 8638 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8639 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8640 | } |
| 8641 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8642 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8643 | /* Init rear pin (used as headphone output) */ |
| 8644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8645 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8646 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8647 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8648 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8649 | /* Init line 2 pin (used as headphone out by default) */ |
| 8650 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8651 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8652 | { } /* end */ |
| 8653 | }; |
| 8654 | |
| 8655 | /* Mute speakers according to the headphone jack state */ |
| 8656 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8657 | { |
| 8658 | unsigned int present; |
| 8659 | |
| 8660 | /* Mute only in 2ch or 4ch mode */ |
| 8661 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8662 | == 0x00) { |
| 8663 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8664 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8665 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8666 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8667 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8668 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8669 | } |
| 8670 | } |
| 8671 | |
| 8672 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8673 | { |
| 8674 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8675 | alc889A_mb31_automute(codec); |
| 8676 | } |
| 8677 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8678 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8679 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8680 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8681 | #endif |
| 8682 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8683 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8684 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8685 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8686 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8687 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8688 | |
| 8689 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8690 | ALC1200_DIGOUT_NID, 0, |
| 8691 | }; |
| 8692 | |
| 8693 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8694 | ALC883_DIGOUT_NID, 0, |
| 8695 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8696 | |
| 8697 | /* |
| 8698 | * configuration and preset |
| 8699 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8700 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8701 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8702 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8703 | [ALC882_ARIMA] = "arima", |
| 8704 | [ALC882_W2JC] = "w2jc", |
| 8705 | [ALC882_TARGA] = "targa", |
| 8706 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8707 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8708 | [ALC885_MACPRO] = "macpro", |
| 8709 | [ALC885_MB5] = "mb5", |
| 8710 | [ALC885_MBP3] = "mbp3", |
| 8711 | [ALC885_IMAC24] = "imac24", |
| 8712 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8713 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8714 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8715 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8716 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8717 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8718 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8719 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8720 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8721 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8722 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8723 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8724 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8725 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8726 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8727 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8728 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8729 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8730 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8731 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8732 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8733 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8734 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8735 | [ALC883_MITAC] = "mitac", |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 8736 | [ALC883_CLEVO_M540R] = "clevo-m540r", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8737 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8738 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8739 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8740 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8741 | [ALC889A_INTEL] = "intel-alc889a", |
| 8742 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8743 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8744 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8745 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8746 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8747 | }; |
| 8748 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8749 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8750 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8751 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8752 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8753 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8754 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8755 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8756 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8757 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8758 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8759 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8760 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8761 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8762 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8763 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8764 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8765 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8766 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8767 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8768 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8769 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8770 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8771 | ALC888_ACER_ASPIRE_6530G), |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 8772 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 8773 | ALC888_ACER_ASPIRE_7730G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8774 | /* default Acer -- disabled as it causes more problems. |
| 8775 | * model=auto should work fine now |
| 8776 | */ |
| 8777 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8778 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8779 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8780 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8781 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8782 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8783 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8784 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8785 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8786 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8787 | |
| 8788 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8789 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8790 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8791 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8792 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8793 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8794 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8795 | 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] | 8796 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8797 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8798 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8799 | |
| 8800 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8801 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8802 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8803 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8804 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8805 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8806 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8807 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8808 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8809 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8810 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8811 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8812 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8813 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8814 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8815 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8816 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8817 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8818 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8819 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8820 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8821 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8822 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8823 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8824 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8825 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8826 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8827 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8828 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8829 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8830 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8831 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8832 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8833 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8834 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8835 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8836 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8837 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8838 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8839 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8840 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8841 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8842 | 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] | 8843 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8844 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8845 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8846 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8847 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8848 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8849 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8850 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8851 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8852 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8853 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8854 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8855 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8856 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8857 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8858 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8859 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8860 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8861 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8862 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8863 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8864 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8865 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8866 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8867 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8868 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8869 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8870 | {} |
| 8871 | }; |
| 8872 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8873 | /* codec SSID table for Intel Mac */ |
| 8874 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8875 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8876 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8877 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8878 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8879 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8880 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8881 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8882 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8883 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8884 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8885 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8886 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8887 | * no perfect solution yet |
| 8888 | */ |
| 8889 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8890 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8891 | }; |
| 8892 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8893 | static struct alc_config_preset alc882_presets[] = { |
| 8894 | [ALC882_3ST_DIG] = { |
| 8895 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8896 | .init_verbs = { alc882_base_init_verbs, |
| 8897 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8898 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8899 | .dac_nids = alc882_dac_nids, |
| 8900 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8901 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8902 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8903 | .channel_mode = alc882_ch_modes, |
| 8904 | .need_dac_fix = 1, |
| 8905 | .input_mux = &alc882_capture_source, |
| 8906 | }, |
| 8907 | [ALC882_6ST_DIG] = { |
| 8908 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8909 | .init_verbs = { alc882_base_init_verbs, |
| 8910 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8911 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8912 | .dac_nids = alc882_dac_nids, |
| 8913 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8914 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8915 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8916 | .channel_mode = alc882_sixstack_modes, |
| 8917 | .input_mux = &alc882_capture_source, |
| 8918 | }, |
| 8919 | [ALC882_ARIMA] = { |
| 8920 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8921 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8922 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8923 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8924 | .dac_nids = alc882_dac_nids, |
| 8925 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8926 | .channel_mode = alc882_sixstack_modes, |
| 8927 | .input_mux = &alc882_capture_source, |
| 8928 | }, |
| 8929 | [ALC882_W2JC] = { |
| 8930 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8931 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8932 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8933 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8934 | .dac_nids = alc882_dac_nids, |
| 8935 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8936 | .channel_mode = alc880_threestack_modes, |
| 8937 | .need_dac_fix = 1, |
| 8938 | .input_mux = &alc882_capture_source, |
| 8939 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8940 | }, |
| 8941 | [ALC885_MBP3] = { |
| 8942 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8943 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8944 | alc880_gpio1_init_verbs }, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 8945 | .num_dacs = 2, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8946 | .dac_nids = alc882_dac_nids, |
Takashi Iwai | be0ae92 | 2009-08-31 08:27:10 +0200 | [diff] [blame] | 8947 | .hp_nid = 0x04, |
| 8948 | .channel_mode = alc885_mbp_4ch_modes, |
| 8949 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8950 | .input_mux = &alc882_capture_source, |
| 8951 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8952 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8953 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8954 | .setup = alc885_mbp3_setup, |
| 8955 | .init_hook = alc_automute_amp, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8956 | }, |
| 8957 | [ALC885_MB5] = { |
| 8958 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8959 | .init_verbs = { alc885_mb5_init_verbs, |
| 8960 | alc880_gpio1_init_verbs }, |
| 8961 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8962 | .dac_nids = alc882_dac_nids, |
| 8963 | .channel_mode = alc885_mb5_6ch_modes, |
| 8964 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8965 | .input_mux = &mb5_capture_source, |
| 8966 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8967 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8968 | }, |
| 8969 | [ALC885_MACPRO] = { |
| 8970 | .mixers = { alc882_macpro_mixer }, |
| 8971 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8972 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8973 | .dac_nids = alc882_dac_nids, |
| 8974 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8975 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8976 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8977 | .channel_mode = alc882_ch_modes, |
| 8978 | .input_mux = &alc882_capture_source, |
| 8979 | .init_hook = alc885_macpro_init_hook, |
| 8980 | }, |
| 8981 | [ALC885_IMAC24] = { |
| 8982 | .mixers = { alc885_imac24_mixer }, |
| 8983 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8984 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8985 | .dac_nids = alc882_dac_nids, |
| 8986 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8987 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8988 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8989 | .channel_mode = alc882_ch_modes, |
| 8990 | .input_mux = &alc882_capture_source, |
| 8991 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 8992 | .setup = alc885_imac24_setup, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8993 | .init_hook = alc885_imac24_init_hook, |
| 8994 | }, |
| 8995 | [ALC882_TARGA] = { |
| 8996 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8997 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8998 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8999 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9000 | .dac_nids = alc882_dac_nids, |
| 9001 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9002 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9003 | .adc_nids = alc882_adc_nids, |
| 9004 | .capsrc_nids = alc882_capsrc_nids, |
| 9005 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9006 | .channel_mode = alc882_3ST_6ch_modes, |
| 9007 | .need_dac_fix = 1, |
| 9008 | .input_mux = &alc882_capture_source, |
| 9009 | .unsol_event = alc882_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9010 | .setup = alc882_targa_setup, |
| 9011 | .init_hook = alc882_targa_automute, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9012 | }, |
| 9013 | [ALC882_ASUS_A7J] = { |
| 9014 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9015 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9016 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9017 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9018 | .dac_nids = alc882_dac_nids, |
| 9019 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9020 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 9021 | .adc_nids = alc882_adc_nids, |
| 9022 | .capsrc_nids = alc882_capsrc_nids, |
| 9023 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 9024 | .channel_mode = alc882_3ST_6ch_modes, |
| 9025 | .need_dac_fix = 1, |
| 9026 | .input_mux = &alc882_capture_source, |
| 9027 | }, |
| 9028 | [ALC882_ASUS_A7M] = { |
| 9029 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 9030 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 9031 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9032 | alc882_asus_a7m_verbs }, |
| 9033 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 9034 | .dac_nids = alc882_dac_nids, |
| 9035 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 9036 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 9037 | .channel_mode = alc880_threestack_modes, |
| 9038 | .need_dac_fix = 1, |
| 9039 | .input_mux = &alc882_capture_source, |
| 9040 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9041 | [ALC883_3ST_2ch_DIG] = { |
| 9042 | .mixers = { alc883_3ST_2ch_mixer }, |
| 9043 | .init_verbs = { alc883_init_verbs }, |
| 9044 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9045 | .dac_nids = alc883_dac_nids, |
| 9046 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9047 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9048 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9049 | .channel_mode = alc883_3ST_2ch_modes, |
| 9050 | .input_mux = &alc883_capture_source, |
| 9051 | }, |
| 9052 | [ALC883_3ST_6ch_DIG] = { |
| 9053 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9054 | .init_verbs = { alc883_init_verbs }, |
| 9055 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9056 | .dac_nids = alc883_dac_nids, |
| 9057 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9058 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9059 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9060 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9061 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9062 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9063 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9064 | [ALC883_3ST_6ch] = { |
| 9065 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9066 | .init_verbs = { alc883_init_verbs }, |
| 9067 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9068 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9069 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9070 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 9071 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9072 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9073 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9074 | [ALC883_3ST_6ch_INTEL] = { |
| 9075 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 9076 | .init_verbs = { alc883_init_verbs }, |
| 9077 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9078 | .dac_nids = alc883_dac_nids, |
| 9079 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9080 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 9081 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 9082 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 9083 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 9084 | .need_dac_fix = 1, |
| 9085 | .input_mux = &alc883_3stack_6ch_intel, |
| 9086 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9087 | [ALC889A_INTEL] = { |
| 9088 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9089 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, |
| 9090 | alc_hp15_unsol_verbs }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9091 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9092 | .dac_nids = alc883_dac_nids, |
| 9093 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9094 | .adc_nids = alc889_adc_nids, |
| 9095 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9096 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9097 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9098 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9099 | .channel_mode = alc889_8ch_intel_modes, |
| 9100 | .capsrc_nids = alc889_capsrc_nids, |
| 9101 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9102 | .setup = alc889_automute_setup, |
| 9103 | .init_hook = alc_automute_amp, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9104 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9105 | .need_dac_fix = 1, |
| 9106 | }, |
| 9107 | [ALC889_INTEL] = { |
| 9108 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 9109 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9110 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9111 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9112 | .dac_nids = alc883_dac_nids, |
| 9113 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9114 | .adc_nids = alc889_adc_nids, |
| 9115 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9116 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9117 | .slave_dig_outs = alc883_slave_dig_outs, |
| 9118 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 9119 | .channel_mode = alc889_8ch_intel_modes, |
| 9120 | .capsrc_nids = alc889_capsrc_nids, |
| 9121 | .input_mux = &alc889_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9122 | .setup = alc889_automute_setup, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 9123 | .init_hook = alc889_intel_init_hook, |
| 9124 | .unsol_event = alc_automute_amp_unsol_event, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 9125 | .need_dac_fix = 1, |
| 9126 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9127 | [ALC883_6ST_DIG] = { |
| 9128 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9129 | .init_verbs = { alc883_init_verbs }, |
| 9130 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9131 | .dac_nids = alc883_dac_nids, |
| 9132 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9133 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9134 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9135 | .channel_mode = alc883_sixstack_modes, |
| 9136 | .input_mux = &alc883_capture_source, |
| 9137 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9138 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9139 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9140 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9141 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9142 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9143 | .dac_nids = alc883_dac_nids, |
| 9144 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9145 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9146 | .channel_mode = alc883_3ST_6ch_modes, |
| 9147 | .need_dac_fix = 1, |
| 9148 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9149 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9150 | .setup = alc882_targa_setup, |
| 9151 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9152 | }, |
| 9153 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9154 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 9155 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 9156 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9157 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9158 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9159 | .adc_nids = alc883_adc_nids_alt, |
| 9160 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9161 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9162 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9163 | .channel_mode = alc883_3ST_2ch_modes, |
| 9164 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9165 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9166 | .setup = alc882_targa_setup, |
| 9167 | .init_hook = alc882_targa_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9168 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9169 | [ALC883_TARGA_8ch_DIG] = { |
| 9170 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9171 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9172 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9173 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9174 | .dac_nids = alc883_dac_nids, |
| 9175 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9176 | .adc_nids = alc883_adc_nids_rev, |
| 9177 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9178 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9179 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9180 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 9181 | .channel_mode = alc883_4ST_8ch_modes, |
| 9182 | .need_dac_fix = 1, |
| 9183 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9184 | .unsol_event = alc883_targa_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9185 | .setup = alc882_targa_setup, |
| 9186 | .init_hook = alc882_targa_automute, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 9187 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9188 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9189 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9190 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 9191 | * and the headphone jack. Turn this on and rely on the |
| 9192 | * standard mute methods whenever the user wants to turn |
| 9193 | * these outputs off. |
| 9194 | */ |
| 9195 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 9196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9197 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 9198 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9199 | .channel_mode = alc883_3ST_2ch_modes, |
| 9200 | .input_mux = &alc883_capture_source, |
| 9201 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9202 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9203 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9204 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9205 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9206 | .dac_nids = alc883_dac_nids, |
| 9207 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 9208 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9209 | .channel_mode = alc883_3ST_2ch_modes, |
| 9210 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9211 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9212 | .setup = alc883_acer_aspire_setup, |
| 9213 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9214 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9215 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9216 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9217 | alc883_chmode_mixer }, |
| 9218 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9219 | alc888_acer_aspire_4930g_verbs }, |
| 9220 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9221 | .dac_nids = alc883_dac_nids, |
| 9222 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9223 | .adc_nids = alc883_adc_nids_rev, |
| 9224 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9225 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9226 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9227 | .channel_mode = alc883_3ST_6ch_modes, |
| 9228 | .need_dac_fix = 1, |
| 9229 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9230 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9231 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9232 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9233 | .setup = alc888_acer_aspire_4930g_setup, |
| 9234 | .init_hook = alc_automute_amp, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 9235 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9236 | [ALC888_ACER_ASPIRE_6530G] = { |
| 9237 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 9238 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9239 | alc888_acer_aspire_6530g_verbs }, |
| 9240 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9241 | .dac_nids = alc883_dac_nids, |
| 9242 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9243 | .adc_nids = alc883_adc_nids_rev, |
| 9244 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9245 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9246 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9247 | .channel_mode = alc883_3ST_2ch_modes, |
| 9248 | .num_mux_defs = |
| 9249 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9250 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9251 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9252 | .setup = alc888_acer_aspire_6530g_setup, |
| 9253 | .init_hook = alc_automute_amp, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9254 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9255 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9256 | .mixers = { alc888_base_mixer, |
| 9257 | alc883_chmode_mixer }, |
| 9258 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9259 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9260 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9261 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9262 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9263 | .adc_nids = alc889_adc_nids, |
| 9264 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9265 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9266 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9267 | .channel_mode = alc883_3ST_6ch_modes, |
| 9268 | .need_dac_fix = 1, |
| 9269 | .const_channel_count = 6, |
| 9270 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9271 | ARRAY_SIZE(alc889_capture_sources), |
| 9272 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9273 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9274 | .setup = alc889_acer_aspire_8930g_setup, |
| 9275 | .init_hook = alc_automute_amp, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9276 | }, |
Denis Kuplyakov | fc86f95 | 2009-08-25 18:15:59 +0200 | [diff] [blame] | 9277 | [ALC888_ACER_ASPIRE_7730G] = { |
| 9278 | .mixers = { alc883_3ST_6ch_mixer, |
| 9279 | alc883_chmode_mixer }, |
| 9280 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 9281 | alc888_acer_aspire_7730G_verbs }, |
| 9282 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9283 | .dac_nids = alc883_dac_nids, |
| 9284 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9285 | .adc_nids = alc883_adc_nids_rev, |
| 9286 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9287 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9288 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9289 | .channel_mode = alc883_3ST_6ch_modes, |
| 9290 | .need_dac_fix = 1, |
| 9291 | .const_channel_count = 6, |
| 9292 | .input_mux = &alc883_capture_source, |
| 9293 | .unsol_event = alc_automute_amp_unsol_event, |
| 9294 | .setup = alc888_acer_aspire_6530g_setup, |
| 9295 | .init_hook = alc_automute_amp, |
| 9296 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9297 | [ALC883_MEDION] = { |
| 9298 | .mixers = { alc883_fivestack_mixer, |
| 9299 | alc883_chmode_mixer }, |
| 9300 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9301 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9302 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9303 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9304 | .adc_nids = alc883_adc_nids_alt, |
| 9305 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9306 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9307 | .channel_mode = alc883_sixstack_modes, |
| 9308 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9309 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9310 | [ALC883_MEDION_MD2] = { |
| 9311 | .mixers = { alc883_medion_md2_mixer}, |
| 9312 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9313 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9314 | .dac_nids = alc883_dac_nids, |
| 9315 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9316 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9317 | .channel_mode = alc883_3ST_2ch_modes, |
| 9318 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9319 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9320 | .setup = alc883_medion_md2_setup, |
| 9321 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9322 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9323 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9324 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9325 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9326 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9327 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9328 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9329 | .channel_mode = alc883_3ST_2ch_modes, |
| 9330 | .input_mux = &alc883_capture_source, |
| 9331 | }, |
ddiaz@cenditel.gob.ve | a65cc60 | 2009-09-05 16:28:06 -0430 | [diff] [blame] | 9332 | [ALC883_CLEVO_M540R] = { |
| 9333 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9334 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, |
| 9335 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9336 | .dac_nids = alc883_dac_nids, |
| 9337 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9338 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9339 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), |
| 9340 | .channel_mode = alc883_3ST_6ch_clevo_modes, |
| 9341 | .need_dac_fix = 1, |
| 9342 | .input_mux = &alc883_capture_source, |
| 9343 | /* This machine has the hardware HP auto-muting, thus |
| 9344 | * we need no software mute via unsol event |
| 9345 | */ |
| 9346 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9347 | [ALC883_CLEVO_M720] = { |
| 9348 | .mixers = { alc883_clevo_m720_mixer }, |
| 9349 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9350 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9351 | .dac_nids = alc883_dac_nids, |
| 9352 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9353 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9354 | .channel_mode = alc883_3ST_2ch_modes, |
| 9355 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9356 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9357 | .setup = alc883_clevo_m720_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9358 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9359 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9360 | [ALC883_LENOVO_101E_2ch] = { |
| 9361 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9362 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9363 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9364 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9365 | .adc_nids = alc883_adc_nids_alt, |
| 9366 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9367 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9368 | .channel_mode = alc883_3ST_2ch_modes, |
| 9369 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9370 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9371 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9372 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9373 | [ALC883_LENOVO_NB0763] = { |
| 9374 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9375 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9376 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9377 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9378 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9379 | .channel_mode = alc883_3ST_2ch_modes, |
| 9380 | .need_dac_fix = 1, |
| 9381 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9382 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9383 | .setup = alc883_medion_md2_setup, |
| 9384 | .init_hook = alc_automute_amp, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9385 | }, |
| 9386 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9387 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9388 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9389 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9390 | .dac_nids = alc883_dac_nids, |
| 9391 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9392 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9393 | .channel_mode = alc883_3ST_6ch_modes, |
| 9394 | .need_dac_fix = 1, |
| 9395 | .input_mux = &alc883_capture_source, |
| 9396 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9397 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9398 | }, |
| 9399 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9400 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9401 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9402 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9403 | .dac_nids = alc883_dac_nids, |
| 9404 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9405 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9406 | .channel_mode = alc883_3ST_2ch_modes, |
| 9407 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9408 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9409 | .setup = alc883_haier_w66_setup, |
| 9410 | .init_hook = alc_automute_amp, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9411 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9412 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9413 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9414 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9415 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9416 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9417 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9418 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9419 | .need_dac_fix = 1, |
| 9420 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9421 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9422 | .setup = alc888_3st_hp_setup, |
| 9423 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9424 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9425 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9426 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9427 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9428 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9429 | .dac_nids = alc883_dac_nids, |
| 9430 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9431 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9432 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9433 | .channel_mode = alc883_sixstack_modes, |
| 9434 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9435 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9436 | .setup = alc888_6st_dell_setup, |
| 9437 | .init_hook = alc_automute_amp, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9438 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9439 | [ALC883_MITAC] = { |
| 9440 | .mixers = { alc883_mitac_mixer }, |
| 9441 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9442 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9443 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9444 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9445 | .channel_mode = alc883_3ST_2ch_modes, |
| 9446 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9447 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9448 | .setup = alc883_mitac_setup, |
| 9449 | .init_hook = alc_automute_amp, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9450 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9451 | [ALC883_FUJITSU_PI2515] = { |
| 9452 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9453 | .init_verbs = { alc883_init_verbs, |
| 9454 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9455 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9456 | .dac_nids = alc883_dac_nids, |
| 9457 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9458 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9459 | .channel_mode = alc883_3ST_2ch_modes, |
| 9460 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9461 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9462 | .setup = alc883_2ch_fujitsu_pi2515_setup, |
| 9463 | .init_hook = alc_automute_amp, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9464 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9465 | [ALC888_FUJITSU_XA3530] = { |
| 9466 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9467 | .init_verbs = { alc883_init_verbs, |
| 9468 | alc888_fujitsu_xa3530_verbs }, |
| 9469 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9470 | .dac_nids = alc883_dac_nids, |
| 9471 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9472 | .adc_nids = alc883_adc_nids_rev, |
| 9473 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9474 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9475 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9476 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9477 | .num_mux_defs = |
| 9478 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9479 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9480 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9481 | .setup = alc888_fujitsu_xa3530_setup, |
| 9482 | .init_hook = alc_automute_amp, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9483 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9484 | [ALC888_LENOVO_SKY] = { |
| 9485 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9486 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9487 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9488 | .dac_nids = alc883_dac_nids, |
| 9489 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9490 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9491 | .channel_mode = alc883_sixstack_modes, |
| 9492 | .need_dac_fix = 1, |
| 9493 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9494 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9495 | .setup = alc888_lenovo_sky_setup, |
| 9496 | .init_hook = alc_automute_amp, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9497 | }, |
| 9498 | [ALC888_ASUS_M90V] = { |
| 9499 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9500 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9501 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9502 | .dac_nids = alc883_dac_nids, |
| 9503 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9504 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9505 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9506 | .channel_mode = alc883_3ST_6ch_modes, |
| 9507 | .need_dac_fix = 1, |
| 9508 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9509 | .unsol_event = alc_sku_unsol_event, |
| 9510 | .setup = alc883_mode2_setup, |
| 9511 | .init_hook = alc_inithook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9512 | }, |
| 9513 | [ALC888_ASUS_EEE1601] = { |
| 9514 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9515 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9516 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9517 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9518 | .dac_nids = alc883_dac_nids, |
| 9519 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9520 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9521 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9522 | .channel_mode = alc883_3ST_2ch_modes, |
| 9523 | .need_dac_fix = 1, |
| 9524 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9525 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9526 | .init_hook = alc883_eee1601_inithook, |
| 9527 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9528 | [ALC1200_ASUS_P5Q] = { |
| 9529 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9530 | .init_verbs = { alc883_init_verbs }, |
| 9531 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9532 | .dac_nids = alc883_dac_nids, |
| 9533 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9534 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9535 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9536 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9537 | .channel_mode = alc883_sixstack_modes, |
| 9538 | .input_mux = &alc883_capture_source, |
| 9539 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9540 | [ALC889A_MB31] = { |
| 9541 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9542 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9543 | alc880_gpio1_init_verbs }, |
| 9544 | .adc_nids = alc883_adc_nids, |
| 9545 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9546 | .dac_nids = alc883_dac_nids, |
| 9547 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9548 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9549 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9550 | .input_mux = &alc889A_mb31_capture_source, |
| 9551 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9552 | .unsol_event = alc889A_mb31_unsol_event, |
| 9553 | .init_hook = alc889A_mb31_automute, |
| 9554 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9555 | [ALC883_SONY_VAIO_TT] = { |
| 9556 | .mixers = { alc883_vaiott_mixer }, |
| 9557 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9558 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9559 | .dac_nids = alc883_dac_nids, |
| 9560 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9561 | .channel_mode = alc883_3ST_2ch_modes, |
| 9562 | .input_mux = &alc883_capture_source, |
| 9563 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 9564 | .setup = alc883_vaiott_setup, |
| 9565 | .init_hook = alc_automute_amp, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9566 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9567 | }; |
| 9568 | |
| 9569 | |
| 9570 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9571 | * Pin config fixes |
| 9572 | */ |
| 9573 | enum { |
| 9574 | PINFIX_ABIT_AW9D_MAX |
| 9575 | }; |
| 9576 | |
| 9577 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9578 | { 0x15, 0x01080104 }, /* side */ |
| 9579 | { 0x16, 0x01011012 }, /* rear */ |
| 9580 | { 0x17, 0x01016011 }, /* clfe */ |
| 9581 | { } |
| 9582 | }; |
| 9583 | |
| 9584 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9585 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9586 | }; |
| 9587 | |
| 9588 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9589 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9590 | {} |
| 9591 | }; |
| 9592 | |
| 9593 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9594 | * BIOS auto configuration |
| 9595 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9596 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, |
| 9597 | const struct auto_pin_cfg *cfg) |
| 9598 | { |
| 9599 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); |
| 9600 | } |
| 9601 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9602 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9603 | hda_nid_t nid, int pin_type, |
| 9604 | int dac_idx) |
| 9605 | { |
| 9606 | /* set as output */ |
| 9607 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9608 | int idx; |
| 9609 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9610 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9611 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9612 | idx = 4; |
| 9613 | else |
| 9614 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9615 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9616 | |
| 9617 | } |
| 9618 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9619 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9620 | { |
| 9621 | struct alc_spec *spec = codec->spec; |
| 9622 | int i; |
| 9623 | |
| 9624 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9625 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9626 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9627 | if (nid) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9628 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9629 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9630 | } |
| 9631 | } |
| 9632 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9633 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9634 | { |
| 9635 | struct alc_spec *spec = codec->spec; |
| 9636 | hda_nid_t pin; |
| 9637 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9638 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9639 | if (pin) /* connect to front */ |
| 9640 | /* use dac 0 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9641 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9642 | pin = spec->autocfg.speaker_pins[0]; |
| 9643 | if (pin) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9644 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9645 | } |
| 9646 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9647 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9648 | { |
| 9649 | struct alc_spec *spec = codec->spec; |
| 9650 | int i; |
| 9651 | |
| 9652 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9653 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9654 | if (!nid) |
| 9655 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9656 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9657 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9658 | snd_hda_codec_write(codec, nid, 0, |
| 9659 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9660 | AMP_OUT_MUTE); |
| 9661 | } |
| 9662 | } |
| 9663 | |
| 9664 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9665 | { |
| 9666 | struct alc_spec *spec = codec->spec; |
| 9667 | int c; |
| 9668 | |
| 9669 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9670 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9671 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9672 | unsigned int mux_idx; |
| 9673 | const struct hda_input_mux *imux; |
| 9674 | int conns, mute, idx, item; |
| 9675 | |
| 9676 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9677 | ARRAY_SIZE(conn_list)); |
| 9678 | if (conns < 0) |
| 9679 | continue; |
| 9680 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9681 | imux = &spec->input_mux[mux_idx]; |
| 9682 | for (idx = 0; idx < conns; idx++) { |
| 9683 | /* if the current connection is the selected one, |
| 9684 | * unmute it as default - otherwise mute it |
| 9685 | */ |
| 9686 | mute = AMP_IN_MUTE(idx); |
| 9687 | for (item = 0; item < imux->num_items; item++) { |
| 9688 | if (imux->items[item].index == idx) { |
| 9689 | if (spec->cur_mux[c] == item) |
| 9690 | mute = AMP_IN_UNMUTE(idx); |
| 9691 | break; |
| 9692 | } |
| 9693 | } |
| 9694 | /* check if we have a selector or mixer |
| 9695 | * we could check for the widget type instead, but |
| 9696 | * just check for Amp-In presence (in case of mixer |
| 9697 | * without amp-in there is something wrong, this |
| 9698 | * function shouldn't be used or capsrc nid is wrong) |
| 9699 | */ |
| 9700 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9701 | snd_hda_codec_write(codec, nid, 0, |
| 9702 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9703 | mute); |
| 9704 | else if (mute != AMP_IN_MUTE(idx)) |
| 9705 | snd_hda_codec_write(codec, nid, 0, |
| 9706 | AC_VERB_SET_CONNECT_SEL, |
| 9707 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9708 | } |
| 9709 | } |
| 9710 | } |
| 9711 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9712 | /* add mic boosts if needed */ |
| 9713 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9714 | { |
| 9715 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9716 | int err; |
| 9717 | hda_nid_t nid; |
| 9718 | |
| 9719 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9720 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9721 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9722 | "Mic Boost", |
| 9723 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9724 | if (err < 0) |
| 9725 | return err; |
| 9726 | } |
| 9727 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9728 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9729 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9730 | "Front Mic Boost", |
| 9731 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9732 | if (err < 0) |
| 9733 | return err; |
| 9734 | } |
| 9735 | return 0; |
| 9736 | } |
| 9737 | |
| 9738 | /* almost identical with ALC880 parser... */ |
| 9739 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9740 | { |
| 9741 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9742 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
| 9743 | int i, err; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9744 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9745 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9746 | alc882_ignore); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9747 | if (err < 0) |
| 9748 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 9749 | if (!spec->autocfg.line_outs) |
| 9750 | return 0; /* can't find valid BIOS pin config */ |
| 9751 | |
| 9752 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 9753 | if (err < 0) |
| 9754 | return err; |
| 9755 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9756 | if (err < 0) |
| 9757 | return err; |
| 9758 | err = alc880_auto_create_extra_out(spec, |
| 9759 | spec->autocfg.speaker_pins[0], |
| 9760 | "Speaker"); |
| 9761 | if (err < 0) |
| 9762 | return err; |
| 9763 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 9764 | "Headphone"); |
| 9765 | if (err < 0) |
| 9766 | return err; |
| 9767 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); |
| 9768 | if (err < 0) |
| 9769 | return err; |
| 9770 | |
| 9771 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9772 | |
| 9773 | /* check multiple SPDIF-out (for recent codecs) */ |
| 9774 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 9775 | hda_nid_t dig_nid; |
| 9776 | err = snd_hda_get_connections(codec, |
| 9777 | spec->autocfg.dig_out_pins[i], |
| 9778 | &dig_nid, 1); |
| 9779 | if (err < 0) |
| 9780 | continue; |
| 9781 | if (!i) |
| 9782 | spec->multiout.dig_out_nid = dig_nid; |
| 9783 | else { |
| 9784 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 9785 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 9786 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 9787 | break; |
| 9788 | } |
| 9789 | } |
| 9790 | if (spec->autocfg.dig_in_pin) |
| 9791 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 9792 | |
| 9793 | if (spec->kctls.list) |
| 9794 | add_mixer(spec, spec->kctls.list); |
| 9795 | |
| 9796 | add_verb(spec, alc883_auto_init_verbs); |
| 9797 | /* if ADC 0x07 is available, initialize it, too */ |
| 9798 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) |
| 9799 | add_verb(spec, alc882_adc1_init_verbs); |
| 9800 | |
| 9801 | spec->num_mux_defs = 1; |
| 9802 | spec->input_mux = &spec->private_imux[0]; |
| 9803 | |
| 9804 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9805 | |
| 9806 | err = alc_auto_add_mic_boost(codec); |
| 9807 | if (err < 0) |
| 9808 | return err; |
| 9809 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9810 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9811 | } |
| 9812 | |
| 9813 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9814 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9815 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9816 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9817 | alc882_auto_init_multi_out(codec); |
| 9818 | alc882_auto_init_hp_out(codec); |
| 9819 | alc882_auto_init_analog_input(codec); |
| 9820 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9821 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9822 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9823 | } |
| 9824 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9825 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9826 | { |
| 9827 | struct alc_spec *spec; |
| 9828 | int err, board_config; |
| 9829 | |
| 9830 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9831 | if (spec == NULL) |
| 9832 | return -ENOMEM; |
| 9833 | |
| 9834 | codec->spec = spec; |
| 9835 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9836 | switch (codec->vendor_id) { |
| 9837 | case 0x10ec0882: |
| 9838 | case 0x10ec0885: |
| 9839 | break; |
| 9840 | default: |
| 9841 | /* ALC883 and variants */ |
| 9842 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9843 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9844 | } |
| 9845 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9846 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9847 | alc882_models, |
| 9848 | alc882_cfg_tbl); |
| 9849 | |
| 9850 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9851 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9852 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9853 | |
| 9854 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 9855 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9856 | codec->chip_name); |
| 9857 | board_config = ALC882_AUTO; |
| 9858 | } |
| 9859 | |
| 9860 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9861 | |
| 9862 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9863 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9864 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9865 | if (err < 0) { |
| 9866 | alc_free(codec); |
| 9867 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9868 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9869 | printk(KERN_INFO |
| 9870 | "hda_codec: Cannot set up configuration " |
| 9871 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9872 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9873 | } |
| 9874 | } |
| 9875 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9876 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9877 | if (err < 0) { |
| 9878 | alc_free(codec); |
| 9879 | return err; |
| 9880 | } |
| 9881 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9882 | if (board_config != ALC882_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 9883 | setup_preset(codec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9884 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9885 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9886 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9887 | /* FIXME: setup DAC5 */ |
| 9888 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9889 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9890 | |
| 9891 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9892 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9893 | |
| 9894 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9895 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9896 | |
| 9897 | if (!spec->adc_nids && spec->input_mux) { |
| 9898 | int i; |
| 9899 | spec->num_adc_nids = 0; |
| 9900 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9901 | hda_nid_t cap; |
| 9902 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9903 | unsigned int wcap = get_wcaps(codec, nid); |
| 9904 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 9905 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9906 | if (wcap != AC_WID_AUD_IN) |
| 9907 | continue; |
| 9908 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9909 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9910 | if (err < 0) |
| 9911 | continue; |
| 9912 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9913 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9914 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9915 | spec->adc_nids = spec->private_adc_nids; |
| 9916 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9917 | } |
| 9918 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 9919 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9920 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9921 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9922 | spec->vmaster_nid = 0x0c; |
| 9923 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9924 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9925 | if (board_config == ALC882_AUTO) |
| 9926 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9927 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9928 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9929 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9930 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9931 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9932 | |
| 9933 | return 0; |
| 9934 | } |
| 9935 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9936 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9937 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9938 | * ALC262 support |
| 9939 | */ |
| 9940 | |
| 9941 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9942 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9943 | |
| 9944 | #define alc262_dac_nids alc260_dac_nids |
| 9945 | #define alc262_adc_nids alc882_adc_nids |
| 9946 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9947 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9948 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9949 | |
| 9950 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9951 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9952 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9953 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9954 | /* ADC0 */ |
| 9955 | 0x09 |
| 9956 | }; |
| 9957 | |
| 9958 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9960 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9961 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9962 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9963 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9964 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9965 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9966 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9967 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9968 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9969 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9970 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9971 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9972 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9973 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9975 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9976 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9977 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9978 | }; |
| 9979 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9980 | /* update HP, line and mono-out pins according to the master switch */ |
| 9981 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9982 | { |
| 9983 | struct alc_spec *spec = codec->spec; |
| 9984 | int val = spec->master_sw; |
| 9985 | |
| 9986 | /* HP & line-out */ |
| 9987 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9988 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9989 | val ? PIN_HP : 0); |
| 9990 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9991 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9992 | val ? PIN_HP : 0); |
| 9993 | /* mono (speaker) depending on the HP jack sense */ |
| 9994 | val = val && !spec->jack_present; |
| 9995 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9996 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9997 | val ? PIN_OUT : 0); |
| 9998 | } |
| 9999 | |
| 10000 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 10001 | { |
| 10002 | struct alc_spec *spec = codec->spec; |
| 10003 | unsigned int presence; |
| 10004 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 10005 | AC_VERB_GET_PIN_SENSE, 0); |
| 10006 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 10007 | alc262_hp_master_update(codec); |
| 10008 | } |
| 10009 | |
| 10010 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10011 | { |
| 10012 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10013 | return; |
| 10014 | alc262_hp_bpc_automute(codec); |
| 10015 | } |
| 10016 | |
| 10017 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 10018 | { |
| 10019 | struct alc_spec *spec = codec->spec; |
| 10020 | unsigned int presence; |
| 10021 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 10022 | AC_VERB_GET_PIN_SENSE, 0); |
| 10023 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 10024 | alc262_hp_master_update(codec); |
| 10025 | } |
| 10026 | |
| 10027 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 10028 | unsigned int res) |
| 10029 | { |
| 10030 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10031 | return; |
| 10032 | alc262_hp_wildwest_automute(codec); |
| 10033 | } |
| 10034 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10035 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10036 | |
| 10037 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10038 | struct snd_ctl_elem_value *ucontrol) |
| 10039 | { |
| 10040 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10041 | struct alc_spec *spec = codec->spec; |
| 10042 | int val = !!*ucontrol->value.integer.value; |
| 10043 | |
| 10044 | if (val == spec->master_sw) |
| 10045 | return 0; |
| 10046 | spec->master_sw = val; |
| 10047 | alc262_hp_master_update(codec); |
| 10048 | return 1; |
| 10049 | } |
| 10050 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10051 | #define ALC262_HP_MASTER_SWITCH \ |
| 10052 | { \ |
| 10053 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10054 | .name = "Master Playback Switch", \ |
| 10055 | .info = snd_ctl_boolean_mono_info, \ |
| 10056 | .get = alc262_hp_master_sw_get, \ |
| 10057 | .put = alc262_hp_master_sw_put, \ |
| 10058 | } |
| 10059 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10060 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10061 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10062 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10063 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10065 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10066 | HDA_OUTPUT), |
| 10067 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10068 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10069 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10070 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10071 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10072 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10073 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10074 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10075 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10076 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10077 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10078 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10079 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10080 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10081 | { } /* end */ |
| 10082 | }; |
| 10083 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10084 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 10085 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10087 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 10088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10090 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 10091 | HDA_OUTPUT), |
| 10092 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 10093 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10094 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10095 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10096 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10097 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10098 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10099 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10100 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10101 | { } /* end */ |
| 10102 | }; |
| 10103 | |
| 10104 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 10105 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10106 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 10107 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10108 | { } /* end */ |
| 10109 | }; |
| 10110 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10111 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10112 | static void alc262_hp_t5735_setup(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10113 | { |
| 10114 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10115 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10116 | spec->autocfg.hp_pins[0] = 0x15; |
| 10117 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10118 | } |
| 10119 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10120 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10121 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10122 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 10123 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10124 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10125 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10127 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10128 | { } /* end */ |
| 10129 | }; |
| 10130 | |
| 10131 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 10132 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10133 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10134 | |
| 10135 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10136 | { } |
| 10137 | }; |
| 10138 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10139 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 10140 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10141 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 10142 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 10143 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 10144 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10145 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10146 | { } /* end */ |
| 10147 | }; |
| 10148 | |
| 10149 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 10150 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10151 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10152 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10153 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10154 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10155 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10157 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10158 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10159 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 10160 | {} |
| 10161 | }; |
| 10162 | |
| 10163 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 10164 | .num_items = 1, |
| 10165 | .items = { |
| 10166 | { "Line", 0x1 }, |
| 10167 | }, |
| 10168 | }; |
| 10169 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10170 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 10171 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 10172 | { |
| 10173 | struct alc_spec *spec = codec->spec; |
| 10174 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10175 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10176 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10177 | unsigned int mute; |
| 10178 | |
| 10179 | /* HP */ |
| 10180 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 10181 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 10182 | HDA_AMP_MUTE, mute); |
| 10183 | /* mute internal speaker per jack sense */ |
| 10184 | if (spec->jack_present) |
| 10185 | mute = HDA_AMP_MUTE; |
| 10186 | if (line_nid) |
| 10187 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 10188 | HDA_AMP_MUTE, mute); |
| 10189 | if (speaker_nid && speaker_nid != line_nid) |
| 10190 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 10191 | HDA_AMP_MUTE, mute); |
| 10192 | } |
| 10193 | |
| 10194 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 10195 | |
| 10196 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10197 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10198 | { |
| 10199 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10200 | struct alc_spec *spec = codec->spec; |
| 10201 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10202 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10203 | if (val == spec->master_sw) |
| 10204 | return 0; |
| 10205 | spec->master_sw = val; |
| 10206 | alc262_hippo_master_update(codec); |
| 10207 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10208 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 10209 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10210 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 10211 | { \ |
| 10212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 10213 | .name = "Master Playback Switch", \ |
| 10214 | .info = snd_ctl_boolean_mono_info, \ |
| 10215 | .get = alc262_hippo_master_sw_get, \ |
| 10216 | .put = alc262_hippo_master_sw_put, \ |
| 10217 | } |
| 10218 | |
| 10219 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 10220 | ALC262_HIPPO_MASTER_SWITCH, |
| 10221 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10222 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10223 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10224 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10225 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10226 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10227 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10228 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10229 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10230 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10231 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10232 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10233 | { } /* end */ |
| 10234 | }; |
| 10235 | |
| 10236 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 10237 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10238 | ALC262_HIPPO_MASTER_SWITCH, |
| 10239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10245 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10246 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10247 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10248 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10249 | { } /* end */ |
| 10250 | }; |
| 10251 | |
| 10252 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10253 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 10254 | { |
| 10255 | struct alc_spec *spec = codec->spec; |
| 10256 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10257 | unsigned int present; |
| 10258 | |
| 10259 | /* need to execute and sync at first */ |
| 10260 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10261 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 10262 | AC_VERB_GET_PIN_SENSE, 0); |
| 10263 | spec->jack_present = (present & 0x80000000) != 0; |
| 10264 | alc262_hippo_master_update(codec); |
| 10265 | } |
| 10266 | |
| 10267 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 10268 | { |
| 10269 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10270 | return; |
| 10271 | alc262_hippo_automute(codec); |
| 10272 | } |
| 10273 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10274 | static void alc262_hippo_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10275 | { |
| 10276 | struct alc_spec *spec = codec->spec; |
| 10277 | |
| 10278 | spec->autocfg.hp_pins[0] = 0x15; |
| 10279 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10280 | } |
| 10281 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10282 | static void alc262_hippo1_setup(struct hda_codec *codec) |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10283 | { |
| 10284 | struct alc_spec *spec = codec->spec; |
| 10285 | |
| 10286 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10287 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10288 | } |
| 10289 | |
| 10290 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10291 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 10292 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10293 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10294 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10295 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10296 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10297 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10298 | { } /* end */ |
| 10299 | }; |
| 10300 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10301 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10302 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10303 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10304 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10305 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10307 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10308 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10309 | { } /* end */ |
| 10310 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10311 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10312 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 10313 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10314 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 10315 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 10316 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 10317 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10318 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10319 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10320 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10321 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10322 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10323 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10324 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10325 | { } /* end */ |
| 10326 | }; |
| 10327 | |
| 10328 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10329 | /* Headphone automute */ |
| 10330 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10331 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10332 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10333 | |
| 10334 | /* P11 AUX_IN, white 4-pin connector */ |
| 10335 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10336 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10337 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10338 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10339 | |
| 10340 | {} |
| 10341 | }; |
| 10342 | |
| 10343 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10344 | static void alc262_tyan_setup(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10345 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10346 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10347 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10348 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10349 | spec->autocfg.speaker_pins[0] = 0x15; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10350 | } |
| 10351 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10352 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10353 | #define alc262_capture_mixer alc882_capture_mixer |
| 10354 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10355 | |
| 10356 | /* |
| 10357 | * generic initialization of ADC, input mixers and output mixers |
| 10358 | */ |
| 10359 | static struct hda_verb alc262_init_verbs[] = { |
| 10360 | /* |
| 10361 | * Unmute ADC0-2 and set the default input to mic-in |
| 10362 | */ |
| 10363 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10364 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10365 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10366 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10367 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10368 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10369 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10370 | /* 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] | 10371 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10372 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10373 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10374 | */ |
| 10375 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10376 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10377 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10381 | |
| 10382 | /* |
| 10383 | * Set up output mixers (0x0c - 0x0e) |
| 10384 | */ |
| 10385 | /* set vol=0 to output mixers */ |
| 10386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10387 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10388 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10389 | /* set up input amps for analog loopback */ |
| 10390 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10391 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10392 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10393 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10394 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10395 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10396 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10397 | |
| 10398 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10399 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10400 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10401 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10402 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10403 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10404 | |
| 10405 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10406 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10407 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10408 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10409 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10410 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10411 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10412 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10413 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10414 | /* FIXME: use matrix-type input source selection */ |
| 10415 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10416 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10417 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10418 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10419 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10420 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10421 | /* Input mixer2 */ |
| 10422 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10423 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10424 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10425 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10426 | /* Input mixer3 */ |
| 10427 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10428 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10429 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10430 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10431 | |
| 10432 | { } |
| 10433 | }; |
| 10434 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10435 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10436 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10437 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10438 | { } |
| 10439 | }; |
| 10440 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10441 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10442 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10443 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10445 | |
| 10446 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10447 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10448 | {} |
| 10449 | }; |
| 10450 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10451 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10452 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10453 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10454 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10455 | |
| 10456 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10457 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10458 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10459 | }; |
| 10460 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10461 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10463 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10464 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10467 | { } /* end */ |
| 10468 | }; |
| 10469 | |
| 10470 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10471 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10472 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10473 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10474 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10475 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10476 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10477 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10478 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10479 | {} |
| 10480 | }; |
| 10481 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10482 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10483 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10484 | struct alc_spec *spec = codec->spec; |
| 10485 | |
| 10486 | spec->autocfg.hp_pins[0] = 0x15; |
| 10487 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 10488 | spec->ext_mic.pin = 0x18; |
| 10489 | spec->ext_mic.mux_idx = 0; |
| 10490 | spec->int_mic.pin = 0x12; |
| 10491 | spec->int_mic.mux_idx = 9; |
| 10492 | spec->auto_mic = 1; |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10493 | } |
| 10494 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10495 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10496 | * nec model |
| 10497 | * 0x15 = headphone |
| 10498 | * 0x16 = internal speaker |
| 10499 | * 0x18 = external mic |
| 10500 | */ |
| 10501 | |
| 10502 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10503 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10504 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10505 | |
| 10506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10509 | |
| 10510 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10511 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10512 | { } /* end */ |
| 10513 | }; |
| 10514 | |
| 10515 | static struct hda_verb alc262_nec_verbs[] = { |
| 10516 | /* Unmute Speaker */ |
| 10517 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10518 | |
| 10519 | /* Headphone */ |
| 10520 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10521 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10522 | |
| 10523 | /* External mic to headphone */ |
| 10524 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10525 | /* External mic to speaker */ |
| 10526 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10527 | {} |
| 10528 | }; |
| 10529 | |
| 10530 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10531 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10532 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10533 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10534 | */ |
| 10535 | |
| 10536 | #define ALC_HP_EVENT 0x37 |
| 10537 | |
| 10538 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10539 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10540 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10541 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10542 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10543 | {} |
| 10544 | }; |
| 10545 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10546 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10547 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10548 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10549 | {} |
| 10550 | }; |
| 10551 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10552 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10553 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10554 | .items = { |
| 10555 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10556 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10557 | { "CD", 0x4 }, |
| 10558 | }, |
| 10559 | }; |
| 10560 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10561 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10562 | .num_items = 5, |
| 10563 | .items = { |
| 10564 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10565 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10566 | { "Line", 0x2 }, |
| 10567 | { "CD", 0x4 }, |
| 10568 | { "AUX IN", 0x6 }, |
| 10569 | }, |
| 10570 | }; |
| 10571 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10572 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10573 | .num_items = 4, |
| 10574 | .items = { |
| 10575 | { "Mic", 0x0 }, |
| 10576 | { "Front Mic", 0x2 }, |
| 10577 | { "Line", 0x1 }, |
| 10578 | { "CD", 0x4 }, |
| 10579 | }, |
| 10580 | }; |
| 10581 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10582 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10583 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10584 | { |
| 10585 | struct alc_spec *spec = codec->spec; |
| 10586 | unsigned int mute; |
| 10587 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10588 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10589 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10590 | /* need to execute and sync at first */ |
| 10591 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10592 | /* check laptop HP jack */ |
| 10593 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10594 | AC_VERB_GET_PIN_SENSE, 0); |
| 10595 | /* need to execute and sync at first */ |
| 10596 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10597 | /* check docking HP jack */ |
| 10598 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10599 | AC_VERB_GET_PIN_SENSE, 0); |
| 10600 | if (present & AC_PINSENSE_PRESENCE) |
| 10601 | spec->jack_present = 1; |
| 10602 | else |
| 10603 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10604 | spec->sense_updated = 1; |
| 10605 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10606 | /* unmute internal speaker only if both HPs are unplugged and |
| 10607 | * master switch is on |
| 10608 | */ |
| 10609 | if (spec->jack_present) |
| 10610 | mute = HDA_AMP_MUTE; |
| 10611 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10612 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10613 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10614 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10615 | } |
| 10616 | |
| 10617 | /* unsolicited event for HP jack sensing */ |
| 10618 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10619 | unsigned int res) |
| 10620 | { |
| 10621 | if ((res >> 26) != ALC_HP_EVENT) |
| 10622 | return; |
| 10623 | alc262_fujitsu_automute(codec, 1); |
| 10624 | } |
| 10625 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10626 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10627 | { |
| 10628 | alc262_fujitsu_automute(codec, 1); |
| 10629 | } |
| 10630 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10631 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10632 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10633 | .ops = &snd_hda_bind_vol, |
| 10634 | .values = { |
| 10635 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10636 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10637 | 0 |
| 10638 | }, |
| 10639 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10640 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10641 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10642 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10643 | { |
| 10644 | struct alc_spec *spec = codec->spec; |
| 10645 | unsigned int mute; |
| 10646 | |
| 10647 | if (force || !spec->sense_updated) { |
| 10648 | unsigned int present_int_hp; |
| 10649 | /* need to execute and sync at first */ |
| 10650 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10651 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10652 | AC_VERB_GET_PIN_SENSE, 0); |
| 10653 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10654 | spec->sense_updated = 1; |
| 10655 | } |
| 10656 | if (spec->jack_present) { |
| 10657 | /* mute internal speaker */ |
| 10658 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10659 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10660 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10661 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10662 | } else { |
| 10663 | /* unmute internal speaker if necessary */ |
| 10664 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10665 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10666 | HDA_AMP_MUTE, mute); |
| 10667 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10668 | HDA_AMP_MUTE, mute); |
| 10669 | } |
| 10670 | } |
| 10671 | |
| 10672 | /* unsolicited event for HP jack sensing */ |
| 10673 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10674 | unsigned int res) |
| 10675 | { |
| 10676 | if ((res >> 26) != ALC_HP_EVENT) |
| 10677 | return; |
| 10678 | alc262_lenovo_3000_automute(codec, 1); |
| 10679 | } |
| 10680 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10681 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10682 | int dir, int idx, long *valp) |
| 10683 | { |
| 10684 | int i, change = 0; |
| 10685 | |
| 10686 | for (i = 0; i < 2; i++, valp++) |
| 10687 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10688 | HDA_AMP_MUTE, |
| 10689 | *valp ? 0 : HDA_AMP_MUTE); |
| 10690 | return change; |
| 10691 | } |
| 10692 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10693 | /* bind hp and internal speaker mute (with plug check) */ |
| 10694 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10695 | struct snd_ctl_elem_value *ucontrol) |
| 10696 | { |
| 10697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10698 | long *valp = ucontrol->value.integer.value; |
| 10699 | int change; |
| 10700 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10701 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10702 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10703 | if (change) |
| 10704 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10705 | return change; |
| 10706 | } |
| 10707 | |
| 10708 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10709 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10710 | { |
| 10711 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10712 | .name = "Master Playback Switch", |
| 10713 | .info = snd_hda_mixer_amp_switch_info, |
| 10714 | .get = snd_hda_mixer_amp_switch_get, |
| 10715 | .put = alc262_fujitsu_master_sw_put, |
| 10716 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10717 | }, |
| 10718 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10719 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10720 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10721 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10722 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10723 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10724 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10725 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10726 | { } /* end */ |
| 10727 | }; |
| 10728 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10729 | /* bind hp and internal speaker mute (with plug check) */ |
| 10730 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10731 | struct snd_ctl_elem_value *ucontrol) |
| 10732 | { |
| 10733 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10734 | long *valp = ucontrol->value.integer.value; |
| 10735 | int change; |
| 10736 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10737 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10738 | if (change) |
| 10739 | alc262_lenovo_3000_automute(codec, 0); |
| 10740 | return change; |
| 10741 | } |
| 10742 | |
| 10743 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10744 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10745 | { |
| 10746 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10747 | .name = "Master Playback Switch", |
| 10748 | .info = snd_hda_mixer_amp_switch_info, |
| 10749 | .get = snd_hda_mixer_amp_switch_get, |
| 10750 | .put = alc262_lenovo_3000_master_sw_put, |
| 10751 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10752 | }, |
| 10753 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10754 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10755 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10756 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10757 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10758 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10759 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10760 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10761 | { } /* end */ |
| 10762 | }; |
| 10763 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10764 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10765 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10766 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10767 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10770 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10771 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10772 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10773 | { } /* end */ |
| 10774 | }; |
| 10775 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10776 | /* additional init verbs for Benq laptops */ |
| 10777 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10778 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10779 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10780 | {} |
| 10781 | }; |
| 10782 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10783 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10784 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10786 | |
| 10787 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10788 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10789 | {} |
| 10790 | }; |
| 10791 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10792 | /* Samsung Q1 Ultra Vista model setup */ |
| 10793 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10794 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10795 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10798 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10799 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10800 | { } /* end */ |
| 10801 | }; |
| 10802 | |
| 10803 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10804 | /* output mixer */ |
| 10805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10806 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10807 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10808 | /* speaker */ |
| 10809 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10810 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10811 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10812 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10813 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10815 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10816 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10817 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10818 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10819 | /* internal mic */ |
| 10820 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10821 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10822 | /* ADC, choose mic */ |
| 10823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10824 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10825 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10826 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10827 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10828 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10829 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10830 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10831 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10832 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10833 | {} |
| 10834 | }; |
| 10835 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10836 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10837 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10838 | { |
| 10839 | struct alc_spec *spec = codec->spec; |
| 10840 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10841 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10842 | mute = 0; |
| 10843 | /* auto-mute only when HP is used as HP */ |
| 10844 | if (!spec->cur_mux[0]) { |
| 10845 | unsigned int present; |
| 10846 | /* need to execute and sync at first */ |
| 10847 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10848 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10849 | AC_VERB_GET_PIN_SENSE, 0); |
| 10850 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10851 | if (spec->jack_present) |
| 10852 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10853 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10854 | /* mute/unmute internal speaker */ |
| 10855 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10856 | HDA_AMP_MUTE, mute); |
| 10857 | /* mute/unmute HP */ |
| 10858 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10859 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10860 | } |
| 10861 | |
| 10862 | /* unsolicited event for HP jack sensing */ |
| 10863 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10864 | unsigned int res) |
| 10865 | { |
| 10866 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10867 | return; |
| 10868 | alc262_ultra_automute(codec); |
| 10869 | } |
| 10870 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10871 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10872 | .num_items = 2, |
| 10873 | .items = { |
| 10874 | { "Mic", 0x1 }, |
| 10875 | { "Headphone", 0x7 }, |
| 10876 | }, |
| 10877 | }; |
| 10878 | |
| 10879 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10880 | struct snd_ctl_elem_value *ucontrol) |
| 10881 | { |
| 10882 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10883 | struct alc_spec *spec = codec->spec; |
| 10884 | int ret; |
| 10885 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10886 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10887 | if (!ret) |
| 10888 | return 0; |
| 10889 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10890 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10891 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10892 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10893 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10894 | return ret; |
| 10895 | } |
| 10896 | |
| 10897 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10898 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10899 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10900 | { |
| 10901 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10902 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10903 | .info = alc_mux_enum_info, |
| 10904 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10905 | .put = alc262_ultra_mux_enum_put, |
| 10906 | }, |
| 10907 | { } /* end */ |
| 10908 | }; |
| 10909 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10910 | /* We use two mixers depending on the output pin; 0x16 is a mono output |
| 10911 | * and thus it's bound with a different mixer. |
| 10912 | * This function returns which mixer amp should be used. |
| 10913 | */ |
| 10914 | static int alc262_check_volbit(hda_nid_t nid) |
| 10915 | { |
| 10916 | if (!nid) |
| 10917 | return 0; |
| 10918 | else if (nid == 0x16) |
| 10919 | return 2; |
| 10920 | else |
| 10921 | return 1; |
| 10922 | } |
| 10923 | |
| 10924 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10925 | const char *pfx, int *vbits) |
| 10926 | { |
| 10927 | char name[32]; |
| 10928 | unsigned long val; |
| 10929 | int vbit; |
| 10930 | |
| 10931 | vbit = alc262_check_volbit(nid); |
| 10932 | if (!vbit) |
| 10933 | return 0; |
| 10934 | if (*vbits & vbit) /* a volume control for this mixer already there */ |
| 10935 | return 0; |
| 10936 | *vbits |= vbit; |
| 10937 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 10938 | if (vbit == 2) |
| 10939 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
| 10940 | else |
| 10941 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
| 10942 | return add_control(spec, ALC_CTL_WIDGET_VOL, name, val); |
| 10943 | } |
| 10944 | |
| 10945 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
| 10946 | const char *pfx) |
| 10947 | { |
| 10948 | char name[32]; |
| 10949 | unsigned long val; |
| 10950 | |
| 10951 | if (!nid) |
| 10952 | return 0; |
| 10953 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 10954 | if (nid == 0x16) |
| 10955 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 10956 | else |
| 10957 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 10958 | return add_control(spec, ALC_CTL_WIDGET_MUTE, name, val); |
| 10959 | } |
| 10960 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10961 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10962 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10963 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10964 | { |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10965 | const char *pfx; |
| 10966 | int vbits; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10967 | int err; |
| 10968 | |
| 10969 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10970 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10971 | spec->multiout.dac_nids[0] = 2; |
| 10972 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10973 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) |
| 10974 | pfx = "Master"; |
| 10975 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 10976 | pfx = "Speaker"; |
| 10977 | else |
| 10978 | pfx = "Front"; |
| 10979 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); |
| 10980 | if (err < 0) |
| 10981 | return err; |
| 10982 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); |
| 10983 | if (err < 0) |
| 10984 | return err; |
| 10985 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); |
| 10986 | if (err < 0) |
| 10987 | return err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10988 | |
Takashi Iwai | c3fc1f5 | 2009-08-25 16:08:47 +0200 | [diff] [blame] | 10989 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
| 10990 | alc262_check_volbit(cfg->speaker_pins[0]) | |
| 10991 | alc262_check_volbit(cfg->hp_pins[0]); |
| 10992 | if (vbits == 1 || vbits == 2) |
| 10993 | pfx = "Master"; /* only one mixer is used */ |
| 10994 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 10995 | pfx = "Speaker"; |
| 10996 | else |
| 10997 | pfx = "Front"; |
| 10998 | vbits = 0; |
| 10999 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); |
| 11000 | if (err < 0) |
| 11001 | return err; |
| 11002 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", |
| 11003 | &vbits); |
| 11004 | if (err < 0) |
| 11005 | return err; |
| 11006 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", |
| 11007 | &vbits); |
| 11008 | if (err < 0) |
| 11009 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11010 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | } |
| 11012 | |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11013 | #define alc262_auto_create_input_ctls \ |
| 11014 | alc880_auto_create_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11015 | |
| 11016 | /* |
| 11017 | * generic initialization of ADC, input mixers and output mixers |
| 11018 | */ |
| 11019 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 11020 | /* |
| 11021 | * Unmute ADC0-2 and set the default input to mic-in |
| 11022 | */ |
| 11023 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11024 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11025 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11026 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11027 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11028 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11029 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11030 | /* 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] | 11031 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11032 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11033 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11034 | */ |
| 11035 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11036 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11037 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11041 | |
| 11042 | /* |
| 11043 | * Set up output mixers (0x0c - 0x0f) |
| 11044 | */ |
| 11045 | /* set vol=0 to output mixers */ |
| 11046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11048 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11049 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11050 | /* set up input amps for analog loopback */ |
| 11051 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11052 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11053 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11056 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11057 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11058 | |
| 11059 | /* FIXME: use matrix-type input source selection */ |
| 11060 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11061 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11062 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11063 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11064 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11065 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11066 | /* Input mixer2 */ |
| 11067 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11071 | /* Input mixer3 */ |
| 11072 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11073 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11074 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11075 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11076 | |
| 11077 | { } |
| 11078 | }; |
| 11079 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11080 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 11081 | /* |
| 11082 | * Unmute ADC0-2 and set the default input to mic-in |
| 11083 | */ |
| 11084 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11086 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11088 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11090 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11091 | /* 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] | 11092 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11093 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11094 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11095 | */ |
| 11096 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11097 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11098 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11099 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11100 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11101 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11102 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11103 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11104 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11105 | /* |
| 11106 | * Set up output mixers (0x0c - 0x0e) |
| 11107 | */ |
| 11108 | /* set vol=0 to output mixers */ |
| 11109 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11110 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11112 | |
| 11113 | /* set up input amps for analog loopback */ |
| 11114 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11116 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11117 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11118 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11119 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11121 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11122 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11123 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11124 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11125 | |
| 11126 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11127 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11128 | |
| 11129 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11130 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11131 | |
| 11132 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11133 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11134 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11135 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11136 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11137 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11138 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11139 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11140 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11141 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11142 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11143 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11144 | |
| 11145 | |
| 11146 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11147 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 11148 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11149 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11150 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11151 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11152 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11154 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11157 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11158 | /* Input mixer2 */ |
| 11159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11161 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11162 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11163 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11164 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11165 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11166 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11167 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11168 | /* Input mixer3 */ |
| 11169 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 11170 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 11171 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 11172 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 11173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 11174 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 11175 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 11176 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 11177 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11178 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11179 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11180 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11181 | { } |
| 11182 | }; |
| 11183 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11184 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 11185 | /* |
| 11186 | * Unmute ADC0-2 and set the default input to mic-in |
| 11187 | */ |
| 11188 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11190 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11191 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11192 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11193 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11194 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11195 | /* 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] | 11196 | * mixer widget |
| 11197 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 11198 | * panel mic (mic 2) |
| 11199 | */ |
| 11200 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11202 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11203 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11204 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11205 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11207 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 11208 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11209 | /* |
| 11210 | * Set up output mixers (0x0c - 0x0e) |
| 11211 | */ |
| 11212 | /* set vol=0 to output mixers */ |
| 11213 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11214 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11215 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11216 | |
| 11217 | /* set up input amps for analog loopback */ |
| 11218 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11219 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11220 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11221 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11222 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11223 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11224 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11225 | |
| 11226 | |
| 11227 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 11228 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 11229 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 11230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 11231 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 11233 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 11234 | |
| 11235 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11237 | |
| 11238 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11239 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11240 | |
| 11241 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 11242 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11243 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11244 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 11245 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11246 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 11247 | |
| 11248 | /* FIXME: use matrix-type input source selection */ |
| 11249 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 11250 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11251 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 11252 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 11253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 11254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 11255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 11256 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 11258 | /* Input mixer2 */ |
| 11259 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11264 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11265 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11266 | /* Input mixer3 */ |
| 11267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 11268 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 11269 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 11270 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 11271 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 11272 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 11273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 11274 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11275 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11276 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11277 | { } |
| 11278 | }; |
| 11279 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11280 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 11281 | |
| 11282 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 11283 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 11284 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11285 | |
| 11286 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 11287 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 11288 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11289 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 11290 | |
| 11291 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 11292 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11293 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11294 | {} |
| 11295 | }; |
| 11296 | |
| 11297 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11298 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11299 | #define alc262_loopbacks alc880_loopbacks |
| 11300 | #endif |
| 11301 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11302 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11303 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11304 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11305 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11306 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11307 | |
| 11308 | /* |
| 11309 | * BIOS auto configuration |
| 11310 | */ |
| 11311 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11312 | { |
| 11313 | struct alc_spec *spec = codec->spec; |
| 11314 | int err; |
| 11315 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11316 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11317 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11318 | alc262_ignore); |
| 11319 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11320 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11321 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11322 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11323 | spec->multiout.max_channels = 2; |
| 11324 | spec->no_analog = 1; |
| 11325 | goto dig_only; |
| 11326 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11327 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11328 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11329 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11330 | if (err < 0) |
| 11331 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 11332 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11333 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11334 | return err; |
| 11335 | |
| 11336 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11337 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11338 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11339 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11340 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11341 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11342 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11343 | if (spec->autocfg.dig_in_pin) |
| 11344 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11345 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11346 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11347 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11348 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11349 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11350 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11351 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11352 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11353 | err = alc_auto_add_mic_boost(codec); |
| 11354 | if (err < 0) |
| 11355 | return err; |
| 11356 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11357 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11358 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11359 | return 1; |
| 11360 | } |
| 11361 | |
| 11362 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11363 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11364 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11365 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11366 | |
| 11367 | |
| 11368 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11369 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11370 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11371 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11372 | alc262_auto_init_multi_out(codec); |
| 11373 | alc262_auto_init_hp_out(codec); |
| 11374 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11375 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11376 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11377 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11378 | } |
| 11379 | |
| 11380 | /* |
| 11381 | * configuration and preset |
| 11382 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11383 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11384 | [ALC262_BASIC] = "basic", |
| 11385 | [ALC262_HIPPO] = "hippo", |
| 11386 | [ALC262_HIPPO_1] = "hippo_1", |
| 11387 | [ALC262_FUJITSU] = "fujitsu", |
| 11388 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11389 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11390 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11391 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11392 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11393 | [ALC262_BENQ_T31] = "benq-t31", |
| 11394 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11395 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11396 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11397 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11398 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11399 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11400 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11401 | [ALC262_AUTO] = "auto", |
| 11402 | }; |
| 11403 | |
| 11404 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11405 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11406 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11407 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11408 | ALC262_HP_BPC), |
| 11409 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11410 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11411 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11412 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11413 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11414 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11415 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11416 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11417 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11418 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11419 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11420 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11421 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11422 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11423 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11424 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11425 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11426 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11427 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11428 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11429 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11430 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11431 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11432 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11433 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11434 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11435 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11436 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11437 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11438 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11439 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11440 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11441 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11442 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11443 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11444 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11445 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11446 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11447 | {} |
| 11448 | }; |
| 11449 | |
| 11450 | static struct alc_config_preset alc262_presets[] = { |
| 11451 | [ALC262_BASIC] = { |
| 11452 | .mixers = { alc262_base_mixer }, |
| 11453 | .init_verbs = { alc262_init_verbs }, |
| 11454 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11455 | .dac_nids = alc262_dac_nids, |
| 11456 | .hp_nid = 0x03, |
| 11457 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11458 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11459 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11460 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11461 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11462 | .mixers = { alc262_hippo_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11463 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11464 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11465 | .dac_nids = alc262_dac_nids, |
| 11466 | .hp_nid = 0x03, |
| 11467 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11468 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11469 | .channel_mode = alc262_modes, |
| 11470 | .input_mux = &alc262_capture_source, |
| 11471 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11472 | .setup = alc262_hippo_setup, |
| 11473 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11474 | }, |
| 11475 | [ALC262_HIPPO_1] = { |
| 11476 | .mixers = { alc262_hippo1_mixer }, |
| 11477 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11478 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11479 | .dac_nids = alc262_dac_nids, |
| 11480 | .hp_nid = 0x02, |
| 11481 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11482 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11483 | .channel_mode = alc262_modes, |
| 11484 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11485 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11486 | .setup = alc262_hippo1_setup, |
| 11487 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11488 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11489 | [ALC262_FUJITSU] = { |
| 11490 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11491 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11492 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11493 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11494 | .dac_nids = alc262_dac_nids, |
| 11495 | .hp_nid = 0x03, |
| 11496 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11497 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11498 | .channel_mode = alc262_modes, |
| 11499 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11500 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11501 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11502 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11503 | [ALC262_HP_BPC] = { |
| 11504 | .mixers = { alc262_HP_BPC_mixer }, |
| 11505 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11506 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11507 | .dac_nids = alc262_dac_nids, |
| 11508 | .hp_nid = 0x03, |
| 11509 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11510 | .channel_mode = alc262_modes, |
| 11511 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11512 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11513 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11514 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11515 | [ALC262_HP_BPC_D7000_WF] = { |
| 11516 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11517 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11518 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11519 | .dac_nids = alc262_dac_nids, |
| 11520 | .hp_nid = 0x03, |
| 11521 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11522 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11523 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11524 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11525 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11526 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11527 | [ALC262_HP_BPC_D7000_WL] = { |
| 11528 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11529 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11530 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11531 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11532 | .dac_nids = alc262_dac_nids, |
| 11533 | .hp_nid = 0x03, |
| 11534 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11535 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11536 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11537 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11538 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11539 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11540 | [ALC262_HP_TC_T5735] = { |
| 11541 | .mixers = { alc262_hp_t5735_mixer }, |
| 11542 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11543 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11544 | .dac_nids = alc262_dac_nids, |
| 11545 | .hp_nid = 0x03, |
| 11546 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11547 | .channel_mode = alc262_modes, |
| 11548 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11549 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11550 | .setup = alc262_hp_t5735_setup, |
| 11551 | .init_hook = alc_automute_amp, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11552 | }, |
| 11553 | [ALC262_HP_RP5700] = { |
| 11554 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11555 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11556 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11557 | .dac_nids = alc262_dac_nids, |
| 11558 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11559 | .channel_mode = alc262_modes, |
| 11560 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11561 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11562 | [ALC262_BENQ_ED8] = { |
| 11563 | .mixers = { alc262_base_mixer }, |
| 11564 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11565 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11566 | .dac_nids = alc262_dac_nids, |
| 11567 | .hp_nid = 0x03, |
| 11568 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11569 | .channel_mode = alc262_modes, |
| 11570 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11571 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11572 | [ALC262_SONY_ASSAMD] = { |
| 11573 | .mixers = { alc262_sony_mixer }, |
| 11574 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11575 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11576 | .dac_nids = alc262_dac_nids, |
| 11577 | .hp_nid = 0x02, |
| 11578 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11579 | .channel_mode = alc262_modes, |
| 11580 | .input_mux = &alc262_capture_source, |
| 11581 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11582 | .setup = alc262_hippo_setup, |
| 11583 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11584 | }, |
| 11585 | [ALC262_BENQ_T31] = { |
| 11586 | .mixers = { alc262_benq_t31_mixer }, |
Wu Fengguang | 6732bd0 | 2009-07-30 09:19:14 +0200 | [diff] [blame] | 11587 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, |
| 11588 | alc_hp15_unsol_verbs }, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11589 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11590 | .dac_nids = alc262_dac_nids, |
| 11591 | .hp_nid = 0x03, |
| 11592 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11593 | .channel_mode = alc262_modes, |
| 11594 | .input_mux = &alc262_capture_source, |
| 11595 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11596 | .setup = alc262_hippo_setup, |
| 11597 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11598 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11599 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11600 | .mixers = { alc262_ultra_mixer }, |
| 11601 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11602 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11603 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11604 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11605 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11606 | .channel_mode = alc262_modes, |
| 11607 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11608 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11609 | .capsrc_nids = alc262_capsrc_nids, |
| 11610 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11611 | .unsol_event = alc262_ultra_unsol_event, |
| 11612 | .init_hook = alc262_ultra_automute, |
| 11613 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11614 | [ALC262_LENOVO_3000] = { |
| 11615 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11616 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11617 | alc262_lenovo_3000_unsol_verbs }, |
| 11618 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11619 | .dac_nids = alc262_dac_nids, |
| 11620 | .hp_nid = 0x03, |
| 11621 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11622 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11623 | .channel_mode = alc262_modes, |
| 11624 | .input_mux = &alc262_fujitsu_capture_source, |
| 11625 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11626 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11627 | [ALC262_NEC] = { |
| 11628 | .mixers = { alc262_nec_mixer }, |
| 11629 | .init_verbs = { alc262_nec_verbs }, |
| 11630 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11631 | .dac_nids = alc262_dac_nids, |
| 11632 | .hp_nid = 0x03, |
| 11633 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11634 | .channel_mode = alc262_modes, |
| 11635 | .input_mux = &alc262_capture_source, |
| 11636 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11637 | [ALC262_TOSHIBA_S06] = { |
| 11638 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11639 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11640 | alc262_eapd_verbs }, |
| 11641 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11642 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11643 | .dac_nids = alc262_dac_nids, |
| 11644 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11645 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11646 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11647 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11648 | .channel_mode = alc262_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11649 | .unsol_event = alc_sku_unsol_event, |
| 11650 | .setup = alc262_toshiba_s06_setup, |
| 11651 | .init_hook = alc_inithook, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11652 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11653 | [ALC262_TOSHIBA_RX1] = { |
| 11654 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11655 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11656 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11657 | .dac_nids = alc262_dac_nids, |
| 11658 | .hp_nid = 0x03, |
| 11659 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11660 | .channel_mode = alc262_modes, |
| 11661 | .input_mux = &alc262_capture_source, |
| 11662 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11663 | .setup = alc262_hippo_setup, |
| 11664 | .init_hook = alc262_hippo_automute, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11665 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11666 | [ALC262_TYAN] = { |
| 11667 | .mixers = { alc262_tyan_mixer }, |
| 11668 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11669 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11670 | .dac_nids = alc262_dac_nids, |
| 11671 | .hp_nid = 0x02, |
| 11672 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11673 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11674 | .channel_mode = alc262_modes, |
| 11675 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11676 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11677 | .setup = alc262_tyan_setup, |
| 11678 | .init_hook = alc_automute_amp, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11679 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11680 | }; |
| 11681 | |
| 11682 | static int patch_alc262(struct hda_codec *codec) |
| 11683 | { |
| 11684 | struct alc_spec *spec; |
| 11685 | int board_config; |
| 11686 | int err; |
| 11687 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11688 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11689 | if (spec == NULL) |
| 11690 | return -ENOMEM; |
| 11691 | |
| 11692 | codec->spec = spec; |
| 11693 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11694 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11695 | * under-run |
| 11696 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11697 | { |
| 11698 | int tmp; |
| 11699 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11700 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11701 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11702 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11703 | } |
| 11704 | #endif |
| 11705 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11706 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11707 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11708 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11709 | alc262_models, |
| 11710 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11711 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11712 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 11713 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 11714 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11715 | board_config = ALC262_AUTO; |
| 11716 | } |
| 11717 | |
| 11718 | if (board_config == ALC262_AUTO) { |
| 11719 | /* automatic parse from the BIOS config */ |
| 11720 | err = alc262_parse_auto_config(codec); |
| 11721 | if (err < 0) { |
| 11722 | alc_free(codec); |
| 11723 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11724 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11725 | printk(KERN_INFO |
| 11726 | "hda_codec: Cannot set up configuration " |
| 11727 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11728 | board_config = ALC262_BASIC; |
| 11729 | } |
| 11730 | } |
| 11731 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11732 | if (!spec->no_analog) { |
| 11733 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11734 | if (err < 0) { |
| 11735 | alc_free(codec); |
| 11736 | return err; |
| 11737 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11738 | } |
| 11739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11740 | if (board_config != ALC262_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 11741 | setup_preset(codec, &alc262_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11743 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11744 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11745 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11746 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11747 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11748 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11749 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11750 | int i; |
| 11751 | /* check whether the digital-mic has to be supported */ |
| 11752 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11753 | if (spec->input_mux->items[i].index >= 9) |
| 11754 | break; |
| 11755 | } |
| 11756 | if (i < spec->input_mux->num_items) { |
| 11757 | /* use only ADC0 */ |
| 11758 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11759 | spec->num_adc_nids = 1; |
| 11760 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11761 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11762 | /* all analog inputs */ |
| 11763 | /* check whether NID 0x07 is valid */ |
| 11764 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11765 | |
| 11766 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 11767 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11768 | if (wcap != AC_WID_AUD_IN) { |
| 11769 | spec->adc_nids = alc262_adc_nids_alt; |
| 11770 | spec->num_adc_nids = |
| 11771 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11772 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11773 | } else { |
| 11774 | spec->adc_nids = alc262_adc_nids; |
| 11775 | spec->num_adc_nids = |
| 11776 | ARRAY_SIZE(alc262_adc_nids); |
| 11777 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11778 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11779 | } |
| 11780 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11781 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 11782 | set_capture_mixer(codec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11783 | if (!spec->no_analog) |
| 11784 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11785 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11786 | spec->vmaster_nid = 0x0c; |
| 11787 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11788 | codec->patch_ops = alc_patch_ops; |
| 11789 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11790 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11791 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11792 | if (!spec->loopback.amplist) |
| 11793 | spec->loopback.amplist = alc262_loopbacks; |
| 11794 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11795 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11797 | return 0; |
| 11798 | } |
| 11799 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11800 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11801 | * ALC268 channel source setting (2 channel) |
| 11802 | */ |
| 11803 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11804 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11805 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11806 | static hda_nid_t alc268_dac_nids[2] = { |
| 11807 | /* front, hp */ |
| 11808 | 0x02, 0x03 |
| 11809 | }; |
| 11810 | |
| 11811 | static hda_nid_t alc268_adc_nids[2] = { |
| 11812 | /* ADC0-1 */ |
| 11813 | 0x08, 0x07 |
| 11814 | }; |
| 11815 | |
| 11816 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11817 | /* ADC0 */ |
| 11818 | 0x08 |
| 11819 | }; |
| 11820 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11821 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11822 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11823 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11824 | /* output mixer control */ |
| 11825 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11826 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11827 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11829 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11830 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11831 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11832 | { } |
| 11833 | }; |
| 11834 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11835 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11836 | /* output mixer control */ |
| 11837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11838 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11839 | ALC262_HIPPO_MASTER_SWITCH, |
| 11840 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11841 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11842 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11843 | { } |
| 11844 | }; |
| 11845 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11846 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11847 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11848 | .ops = &snd_hda_bind_sw, |
| 11849 | .values = { |
| 11850 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11851 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11852 | 0 |
| 11853 | }, |
| 11854 | }; |
| 11855 | |
| 11856 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11857 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11858 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11859 | { } |
| 11860 | }; |
| 11861 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11862 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11863 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11864 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11865 | { } |
| 11866 | }; |
| 11867 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11868 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11869 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11870 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11871 | { } /* end */ |
| 11872 | }; |
| 11873 | |
| 11874 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11875 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11876 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11877 | .ops = &snd_hda_bind_vol, |
| 11878 | .values = { |
| 11879 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11880 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11881 | 0 |
| 11882 | }, |
| 11883 | }; |
| 11884 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11885 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11886 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11887 | { |
| 11888 | struct alc_spec *spec = codec->spec; |
| 11889 | unsigned int mute; |
| 11890 | |
| 11891 | if (force || !spec->sense_updated) { |
| 11892 | unsigned int present; |
| 11893 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11894 | AC_VERB_GET_PIN_SENSE, 0); |
| 11895 | spec->jack_present = (present & 0x80000000) != 0; |
| 11896 | spec->sense_updated = 1; |
| 11897 | } |
| 11898 | if (spec->jack_present) |
| 11899 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11900 | else /* unmute internal speaker if necessary */ |
| 11901 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11902 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11903 | HDA_AMP_MUTE, mute); |
| 11904 | } |
| 11905 | |
| 11906 | |
| 11907 | /* bind hp and internal speaker mute (with plug check) */ |
| 11908 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11909 | struct snd_ctl_elem_value *ucontrol) |
| 11910 | { |
| 11911 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11912 | long *valp = ucontrol->value.integer.value; |
| 11913 | int change; |
| 11914 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11915 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11916 | if (change) |
| 11917 | alc268_acer_automute(codec, 0); |
| 11918 | return change; |
| 11919 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11920 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11921 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11922 | /* output mixer control */ |
| 11923 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11924 | { |
| 11925 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11926 | .name = "Master Playback Switch", |
| 11927 | .info = snd_hda_mixer_amp_switch_info, |
| 11928 | .get = snd_hda_mixer_amp_switch_get, |
| 11929 | .put = alc268_acer_master_sw_put, |
| 11930 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11931 | }, |
| 11932 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11933 | { } |
| 11934 | }; |
| 11935 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11936 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11937 | /* output mixer control */ |
| 11938 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11939 | { |
| 11940 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11941 | .name = "Master Playback Switch", |
| 11942 | .info = snd_hda_mixer_amp_switch_info, |
| 11943 | .get = snd_hda_mixer_amp_switch_get, |
| 11944 | .put = alc268_acer_master_sw_put, |
| 11945 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11946 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11947 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11948 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11949 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11950 | { } |
| 11951 | }; |
| 11952 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11953 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11954 | /* output mixer control */ |
| 11955 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11956 | { |
| 11957 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11958 | .name = "Master Playback Switch", |
| 11959 | .info = snd_hda_mixer_amp_switch_info, |
| 11960 | .get = snd_hda_mixer_amp_switch_get, |
| 11961 | .put = alc268_acer_master_sw_put, |
| 11962 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11963 | }, |
| 11964 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11965 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11966 | { } |
| 11967 | }; |
| 11968 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11969 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11970 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11972 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11973 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11974 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11975 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11976 | { } |
| 11977 | }; |
| 11978 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11979 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11980 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11981 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11982 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11983 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11984 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11985 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11986 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11987 | { } |
| 11988 | }; |
| 11989 | |
| 11990 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11991 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 11992 | #define alc268_toshiba_setup alc262_hippo_setup |
| 11993 | #define alc268_toshiba_automute alc262_hippo_automute |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11994 | |
| 11995 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11996 | unsigned int res) |
| 11997 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11998 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11999 | return; |
| 12000 | alc268_acer_automute(codec, 1); |
| 12001 | } |
| 12002 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12003 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 12004 | { |
| 12005 | alc268_acer_automute(codec, 1); |
| 12006 | } |
| 12007 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12008 | /* toggle speaker-output according to the hp-jack state */ |
| 12009 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 12010 | { |
| 12011 | unsigned int present; |
| 12012 | unsigned char bits; |
| 12013 | |
| 12014 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12015 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12016 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12017 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 12018 | AMP_IN_MUTE(0), bits); |
| 12019 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 12020 | AMP_IN_MUTE(0), bits); |
| 12021 | } |
| 12022 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12023 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 12024 | unsigned int res) |
| 12025 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12026 | switch (res >> 26) { |
| 12027 | case ALC880_HP_EVENT: |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12028 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12029 | break; |
| 12030 | case ALC880_MIC_EVENT: |
| 12031 | alc_mic_automute(codec); |
| 12032 | break; |
| 12033 | } |
| 12034 | } |
| 12035 | |
| 12036 | static void alc268_acer_lc_setup(struct hda_codec *codec) |
| 12037 | { |
| 12038 | struct alc_spec *spec = codec->spec; |
| 12039 | spec->ext_mic.pin = 0x18; |
| 12040 | spec->ext_mic.mux_idx = 0; |
| 12041 | spec->int_mic.pin = 0x12; |
| 12042 | spec->int_mic.mux_idx = 6; |
| 12043 | spec->auto_mic = 1; |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12044 | } |
| 12045 | |
| 12046 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 12047 | { |
| 12048 | alc268_aspire_one_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12049 | alc_mic_automute(codec); |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12050 | } |
| 12051 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12052 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 12053 | /* output mixer control */ |
| 12054 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12055 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12056 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12057 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12058 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12059 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12060 | { } |
| 12061 | }; |
| 12062 | |
| 12063 | static struct hda_verb alc268_dell_verbs[] = { |
| 12064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12065 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12066 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12067 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12068 | { } |
| 12069 | }; |
| 12070 | |
| 12071 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12072 | static void alc268_dell_setup(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12073 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12074 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12075 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12076 | spec->autocfg.hp_pins[0] = 0x15; |
| 12077 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12078 | spec->ext_mic.pin = 0x18; |
| 12079 | spec->ext_mic.mux_idx = 0; |
| 12080 | spec->int_mic.pin = 0x19; |
| 12081 | spec->int_mic.mux_idx = 1; |
| 12082 | spec->auto_mic = 1; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12083 | } |
| 12084 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12085 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 12086 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12087 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12088 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12089 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12090 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12091 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12092 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12093 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12094 | { } |
| 12095 | }; |
| 12096 | |
| 12097 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 12098 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12099 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 12100 | { } |
| 12101 | }; |
| 12102 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12103 | static void alc267_quanta_il1_setup(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12104 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12105 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12106 | spec->autocfg.hp_pins[0] = 0x15; |
| 12107 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12108 | spec->ext_mic.pin = 0x18; |
| 12109 | spec->ext_mic.mux_idx = 0; |
| 12110 | spec->int_mic.pin = 0x19; |
| 12111 | spec->int_mic.mux_idx = 1; |
| 12112 | spec->auto_mic = 1; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12113 | } |
| 12114 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12115 | /* |
| 12116 | * generic initialization of ADC, input mixers and output mixers |
| 12117 | */ |
| 12118 | static struct hda_verb alc268_base_init_verbs[] = { |
| 12119 | /* Unmute DAC0-1 and set vol = 0 */ |
| 12120 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12121 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12122 | |
| 12123 | /* |
| 12124 | * Set up output mixers (0x0c - 0x0e) |
| 12125 | */ |
| 12126 | /* set vol=0 to output mixers */ |
| 12127 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12128 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12129 | |
| 12130 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12131 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12132 | |
| 12133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12134 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 12135 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 12136 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12137 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12138 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12139 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12140 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12141 | |
| 12142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12143 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12144 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12145 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12146 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12147 | |
| 12148 | /* set PCBEEP vol = 0, mute connections */ |
| 12149 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12150 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12151 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12152 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12153 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12154 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 12155 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12157 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12158 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12159 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12160 | { } |
| 12161 | }; |
| 12162 | |
| 12163 | /* |
| 12164 | * generic initialization of ADC, input mixers and output mixers |
| 12165 | */ |
| 12166 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 12167 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 12168 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12169 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12170 | |
| 12171 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12172 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 12173 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12174 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12175 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 12176 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12177 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12178 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12179 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12180 | |
| 12181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12182 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12183 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12184 | /* set PCBEEP vol = 0, mute connections */ |
| 12185 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12186 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12187 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12188 | |
| 12189 | { } |
| 12190 | }; |
| 12191 | |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12192 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { |
| 12193 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12194 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12195 | { } /* end */ |
| 12196 | }; |
| 12197 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12198 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 12199 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12200 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12201 | _DEFINE_CAPSRC(1), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12202 | { } /* end */ |
| 12203 | }; |
| 12204 | |
| 12205 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 12206 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12207 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 12208 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 12209 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12210 | _DEFINE_CAPSRC(2), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12211 | { } /* end */ |
| 12212 | }; |
| 12213 | |
| 12214 | static struct hda_input_mux alc268_capture_source = { |
| 12215 | .num_items = 4, |
| 12216 | .items = { |
| 12217 | { "Mic", 0x0 }, |
| 12218 | { "Front Mic", 0x1 }, |
| 12219 | { "Line", 0x2 }, |
| 12220 | { "CD", 0x3 }, |
| 12221 | }, |
| 12222 | }; |
| 12223 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12224 | static struct hda_input_mux alc268_acer_capture_source = { |
| 12225 | .num_items = 3, |
| 12226 | .items = { |
| 12227 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12228 | { "Internal Mic", 0x1 }, |
| 12229 | { "Line", 0x2 }, |
| 12230 | }, |
| 12231 | }; |
| 12232 | |
| 12233 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 12234 | .num_items = 3, |
| 12235 | .items = { |
| 12236 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12237 | { "Internal Mic", 0x6 }, |
| 12238 | { "Line", 0x2 }, |
| 12239 | }, |
| 12240 | }; |
| 12241 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12242 | #ifdef CONFIG_SND_DEBUG |
| 12243 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12244 | /* Volume widgets */ |
| 12245 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12246 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12247 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12248 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12249 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 12250 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 12251 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 12252 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 12253 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 12254 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 12255 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 12256 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 12257 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 12258 | /* The below appears problematic on some hardwares */ |
| 12259 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12260 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 12261 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 12262 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 12263 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 12264 | |
| 12265 | /* Modes for retasking pin widgets */ |
| 12266 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12267 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12268 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12269 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12270 | |
| 12271 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12272 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12273 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12274 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12275 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12276 | |
| 12277 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12278 | * The ALC268 does not have an SPDIF input. |
| 12279 | */ |
| 12280 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12281 | |
| 12282 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12283 | * this output to turn on an external amplifier. |
| 12284 | */ |
| 12285 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12286 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12287 | |
| 12288 | { } /* end */ |
| 12289 | }; |
| 12290 | #endif |
| 12291 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12292 | /* create input playback/capture controls for the given pin */ |
| 12293 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12294 | const char *ctlname, int idx) |
| 12295 | { |
| 12296 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12297 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12298 | int err; |
| 12299 | |
| 12300 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12301 | switch (nid) { |
| 12302 | case 0x14: |
| 12303 | case 0x16: |
| 12304 | dac = 0x02; |
| 12305 | break; |
| 12306 | case 0x15: |
| 12307 | dac = 0x03; |
| 12308 | break; |
| 12309 | default: |
| 12310 | return 0; |
| 12311 | } |
| 12312 | if (spec->multiout.dac_nids[0] != dac && |
| 12313 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12314 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12315 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12316 | HDA_OUTPUT)); |
| 12317 | if (err < 0) |
| 12318 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12319 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12320 | } |
| 12321 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12322 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12323 | if (nid != 0x16) |
| 12324 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12325 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12326 | else /* mono */ |
| 12327 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12328 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12329 | if (err < 0) |
| 12330 | return err; |
| 12331 | return 0; |
| 12332 | } |
| 12333 | |
| 12334 | /* add playback controls from the parsed DAC table */ |
| 12335 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12336 | const struct auto_pin_cfg *cfg) |
| 12337 | { |
| 12338 | hda_nid_t nid; |
| 12339 | int err; |
| 12340 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12341 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12342 | |
| 12343 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12344 | if (nid) { |
| 12345 | const char *name; |
| 12346 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12347 | name = "Speaker"; |
| 12348 | else |
| 12349 | name = "Front"; |
| 12350 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12351 | if (err < 0) |
| 12352 | return err; |
| 12353 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12354 | |
| 12355 | nid = cfg->speaker_pins[0]; |
| 12356 | if (nid == 0x1d) { |
| 12357 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12358 | "Speaker Playback Volume", |
| 12359 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12360 | if (err < 0) |
| 12361 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12362 | } else { |
| 12363 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12364 | if (err < 0) |
| 12365 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12366 | } |
| 12367 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12368 | if (nid) { |
| 12369 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12370 | if (err < 0) |
| 12371 | return err; |
| 12372 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12373 | |
| 12374 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12375 | if (nid == 0x16) { |
| 12376 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12377 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12378 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12379 | if (err < 0) |
| 12380 | return err; |
| 12381 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12382 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12383 | } |
| 12384 | |
| 12385 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12386 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12387 | const struct auto_pin_cfg *cfg) |
| 12388 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12389 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12390 | } |
| 12391 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12392 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12393 | hda_nid_t nid, int pin_type) |
| 12394 | { |
| 12395 | int idx; |
| 12396 | |
| 12397 | alc_set_pin_output(codec, nid, pin_type); |
| 12398 | if (nid == 0x14 || nid == 0x16) |
| 12399 | idx = 0; |
| 12400 | else |
| 12401 | idx = 1; |
| 12402 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 12403 | } |
| 12404 | |
| 12405 | static void alc268_auto_init_multi_out(struct hda_codec *codec) |
| 12406 | { |
| 12407 | struct alc_spec *spec = codec->spec; |
| 12408 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; |
| 12409 | if (nid) { |
| 12410 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 12411 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); |
| 12412 | } |
| 12413 | } |
| 12414 | |
| 12415 | static void alc268_auto_init_hp_out(struct hda_codec *codec) |
| 12416 | { |
| 12417 | struct alc_spec *spec = codec->spec; |
| 12418 | hda_nid_t pin; |
| 12419 | |
| 12420 | pin = spec->autocfg.hp_pins[0]; |
| 12421 | if (pin) |
| 12422 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); |
| 12423 | pin = spec->autocfg.speaker_pins[0]; |
| 12424 | if (pin) |
| 12425 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); |
| 12426 | } |
| 12427 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12428 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12429 | { |
| 12430 | struct alc_spec *spec = codec->spec; |
| 12431 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12432 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12433 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12434 | unsigned int dac_vol1, dac_vol2; |
| 12435 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12436 | if (line_nid == 0x1d || speaker_nid == 0x1d) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12437 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12438 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12439 | /* mute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12440 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12441 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12442 | AMP_IN_UNMUTE(1)); |
| 12443 | snd_hda_codec_write(codec, 0x10, 0, |
| 12444 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12445 | AMP_IN_UNMUTE(1)); |
| 12446 | } else { |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 12447 | /* unmute mixer inputs from 0x1d */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12448 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12449 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12450 | snd_hda_codec_write(codec, 0x10, 0, |
| 12451 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12452 | } |
| 12453 | |
| 12454 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12455 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12456 | dac_vol2 = AMP_OUT_ZERO; |
| 12457 | else if (line_nid == 0x15) |
| 12458 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12459 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12460 | dac_vol2 = AMP_OUT_ZERO; |
| 12461 | else if (hp_nid == 0x15) |
| 12462 | dac_vol1 = AMP_OUT_ZERO; |
| 12463 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12464 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12465 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12466 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12467 | |
| 12468 | snd_hda_codec_write(codec, 0x02, 0, |
| 12469 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12470 | snd_hda_codec_write(codec, 0x03, 0, |
| 12471 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12472 | } |
| 12473 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12474 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12475 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12476 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12477 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12478 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12479 | |
| 12480 | /* |
| 12481 | * BIOS auto configuration |
| 12482 | */ |
| 12483 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12484 | { |
| 12485 | struct alc_spec *spec = codec->spec; |
| 12486 | int err; |
| 12487 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12488 | |
| 12489 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12490 | alc268_ignore); |
| 12491 | if (err < 0) |
| 12492 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12493 | if (!spec->autocfg.line_outs) { |
| 12494 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12495 | spec->multiout.max_channels = 2; |
| 12496 | spec->no_analog = 1; |
| 12497 | goto dig_only; |
| 12498 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12499 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12500 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12501 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12502 | if (err < 0) |
| 12503 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 12504 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12505 | if (err < 0) |
| 12506 | return err; |
| 12507 | |
| 12508 | spec->multiout.max_channels = 2; |
| 12509 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12510 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12511 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12512 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12513 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12514 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12515 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12516 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12517 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12518 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12519 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12520 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12521 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12522 | add_verb(spec, alc268_volume_init_verbs); |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12523 | spec->num_mux_defs = 2; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12524 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12525 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12526 | err = alc_auto_add_mic_boost(codec); |
| 12527 | if (err < 0) |
| 12528 | return err; |
| 12529 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12530 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12531 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12532 | return 1; |
| 12533 | } |
| 12534 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12535 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12536 | |
| 12537 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12538 | static void alc268_auto_init(struct hda_codec *codec) |
| 12539 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12540 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12541 | alc268_auto_init_multi_out(codec); |
| 12542 | alc268_auto_init_hp_out(codec); |
| 12543 | alc268_auto_init_mono_speaker_out(codec); |
| 12544 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12545 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12546 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12547 | } |
| 12548 | |
| 12549 | /* |
| 12550 | * configuration and preset |
| 12551 | */ |
| 12552 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12553 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12554 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12555 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12556 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12557 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12558 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12559 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12560 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12561 | #ifdef CONFIG_SND_DEBUG |
| 12562 | [ALC268_TEST] = "test", |
| 12563 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12564 | [ALC268_AUTO] = "auto", |
| 12565 | }; |
| 12566 | |
| 12567 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12568 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12569 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12570 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12571 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12572 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12573 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12574 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12575 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12576 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame^] | 12577 | /* almost compatible with toshiba but with optional digital outs; |
| 12578 | * auto-probing seems working fine |
| 12579 | */ |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12580 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
Takashi Iwai | 33d7867 | 2009-09-08 11:03:41 +0200 | [diff] [blame^] | 12581 | ALC268_AUTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12582 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12583 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12584 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12585 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12586 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12587 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12588 | {} |
| 12589 | }; |
| 12590 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12591 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ |
| 12592 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { |
| 12593 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), |
| 12594 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), |
| 12595 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12596 | ALC268_TOSHIBA), |
| 12597 | {} |
| 12598 | }; |
| 12599 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12600 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12601 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12602 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
| 12603 | alc268_capture_nosrc_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12604 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12605 | alc267_quanta_il1_verbs }, |
| 12606 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12607 | .dac_nids = alc268_dac_nids, |
| 12608 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12609 | .adc_nids = alc268_adc_nids_alt, |
| 12610 | .hp_nid = 0x03, |
| 12611 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12612 | .channel_mode = alc268_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12613 | .unsol_event = alc_sku_unsol_event, |
| 12614 | .setup = alc267_quanta_il1_setup, |
| 12615 | .init_hook = alc_inithook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12616 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12617 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12618 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12619 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12620 | .init_verbs = { alc268_base_init_verbs }, |
| 12621 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12622 | .dac_nids = alc268_dac_nids, |
| 12623 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12624 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12625 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12626 | .hp_nid = 0x03, |
| 12627 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12628 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12629 | .channel_mode = alc268_modes, |
| 12630 | .input_mux = &alc268_capture_source, |
| 12631 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12632 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12633 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12634 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12635 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12636 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12637 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12638 | .dac_nids = alc268_dac_nids, |
| 12639 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12640 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12641 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12642 | .hp_nid = 0x03, |
| 12643 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12644 | .channel_mode = alc268_modes, |
| 12645 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12646 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12647 | .setup = alc268_toshiba_setup, |
| 12648 | .init_hook = alc268_toshiba_automute, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12649 | }, |
| 12650 | [ALC268_ACER] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12651 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12652 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12653 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12654 | alc268_acer_verbs }, |
| 12655 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12656 | .dac_nids = alc268_dac_nids, |
| 12657 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12658 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12659 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12660 | .hp_nid = 0x02, |
| 12661 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12662 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12663 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12664 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12665 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12666 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12667 | [ALC268_ACER_DMIC] = { |
| 12668 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12669 | alc268_beep_mixer }, |
| 12670 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12671 | alc268_acer_verbs }, |
| 12672 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12673 | .dac_nids = alc268_dac_nids, |
| 12674 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12675 | .adc_nids = alc268_adc_nids_alt, |
| 12676 | .capsrc_nids = alc268_capsrc_nids, |
| 12677 | .hp_nid = 0x02, |
| 12678 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12679 | .channel_mode = alc268_modes, |
| 12680 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12681 | .unsol_event = alc268_acer_unsol_event, |
| 12682 | .init_hook = alc268_acer_init_hook, |
| 12683 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12684 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12685 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12686 | alc268_beep_mixer, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12687 | alc268_capture_nosrc_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12688 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12689 | alc268_acer_aspire_one_verbs }, |
| 12690 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12691 | .dac_nids = alc268_dac_nids, |
| 12692 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12693 | .adc_nids = alc268_adc_nids_alt, |
| 12694 | .capsrc_nids = alc268_capsrc_nids, |
| 12695 | .hp_nid = 0x03, |
| 12696 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12697 | .channel_mode = alc268_modes, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12698 | .unsol_event = alc268_acer_lc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12699 | .setup = alc268_acer_lc_setup, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12700 | .init_hook = alc268_acer_lc_init_hook, |
| 12701 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12702 | [ALC268_DELL] = { |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12703 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
| 12704 | alc268_capture_nosrc_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12705 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12706 | alc268_dell_verbs }, |
| 12707 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12708 | .dac_nids = alc268_dac_nids, |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12709 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12710 | .adc_nids = alc268_adc_nids_alt, |
| 12711 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12712 | .hp_nid = 0x02, |
| 12713 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12714 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12715 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12716 | .setup = alc268_dell_setup, |
| 12717 | .init_hook = alc_inithook, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12718 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12719 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12720 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12721 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12722 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12723 | alc268_toshiba_verbs }, |
| 12724 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12725 | .dac_nids = alc268_dac_nids, |
| 12726 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12727 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12728 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12729 | .hp_nid = 0x03, |
| 12730 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12731 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12732 | .channel_mode = alc268_modes, |
| 12733 | .input_mux = &alc268_capture_source, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 12734 | .setup = alc268_toshiba_setup, |
| 12735 | .init_hook = alc268_toshiba_automute, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12736 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12737 | #ifdef CONFIG_SND_DEBUG |
| 12738 | [ALC268_TEST] = { |
| 12739 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12740 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12741 | alc268_volume_init_verbs }, |
| 12742 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12743 | .dac_nids = alc268_dac_nids, |
| 12744 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12745 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12746 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12747 | .hp_nid = 0x03, |
| 12748 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12749 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12750 | .channel_mode = alc268_modes, |
| 12751 | .input_mux = &alc268_capture_source, |
| 12752 | }, |
| 12753 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12754 | }; |
| 12755 | |
| 12756 | static int patch_alc268(struct hda_codec *codec) |
| 12757 | { |
| 12758 | struct alc_spec *spec; |
| 12759 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12760 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12761 | |
| 12762 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12763 | if (spec == NULL) |
| 12764 | return -ENOMEM; |
| 12765 | |
| 12766 | codec->spec = spec; |
| 12767 | |
| 12768 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12769 | alc268_models, |
| 12770 | alc268_cfg_tbl); |
| 12771 | |
Takashi Iwai | 3abf2f3 | 2009-08-19 20:05:02 +0200 | [diff] [blame] | 12772 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) |
| 12773 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 12774 | ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); |
| 12775 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12776 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 12777 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 12778 | codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12779 | board_config = ALC268_AUTO; |
| 12780 | } |
| 12781 | |
| 12782 | if (board_config == ALC268_AUTO) { |
| 12783 | /* automatic parse from the BIOS config */ |
| 12784 | err = alc268_parse_auto_config(codec); |
| 12785 | if (err < 0) { |
| 12786 | alc_free(codec); |
| 12787 | return err; |
| 12788 | } else if (!err) { |
| 12789 | printk(KERN_INFO |
| 12790 | "hda_codec: Cannot set up configuration " |
| 12791 | "from BIOS. Using base mode...\n"); |
| 12792 | board_config = ALC268_3ST; |
| 12793 | } |
| 12794 | } |
| 12795 | |
| 12796 | if (board_config != ALC268_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 12797 | setup_preset(codec, &alc268_presets[board_config]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12798 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12799 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12800 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12801 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12802 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12803 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12804 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12805 | has_beep = 0; |
| 12806 | for (i = 0; i < spec->num_mixers; i++) { |
| 12807 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12808 | has_beep = 1; |
| 12809 | break; |
| 12810 | } |
| 12811 | } |
| 12812 | |
| 12813 | if (has_beep) { |
| 12814 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12815 | if (err < 0) { |
| 12816 | alc_free(codec); |
| 12817 | return err; |
| 12818 | } |
| 12819 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12820 | /* override the amp caps for beep generator */ |
| 12821 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12822 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12823 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12824 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12825 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12826 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12827 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12828 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12829 | /* check whether NID 0x07 is valid */ |
| 12830 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12831 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12832 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12833 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 12834 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12835 | if (spec->auto_mic || |
| 12836 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12837 | spec->adc_nids = alc268_adc_nids_alt; |
| 12838 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | fdbc662 | 2009-08-19 00:18:10 +0200 | [diff] [blame] | 12839 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12840 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12841 | else |
| 12842 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12843 | } else { |
| 12844 | spec->adc_nids = alc268_adc_nids; |
| 12845 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12846 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12847 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12848 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12849 | /* set default input source */ |
| 12850 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12851 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12852 | 0, AC_VERB_SET_CONNECT_SEL, |
Herton Ronaldo Krzesinski | 5908589 | 2009-08-11 22:33:09 -0300 | [diff] [blame] | 12853 | i < spec->num_mux_defs ? |
| 12854 | spec->input_mux[i].items[0].index : |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12855 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12856 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12857 | |
| 12858 | spec->vmaster_nid = 0x02; |
| 12859 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12860 | codec->patch_ops = alc_patch_ops; |
| 12861 | if (board_config == ALC268_AUTO) |
| 12862 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12863 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12864 | codec->proc_widget_hook = print_realtek_coef; |
| 12865 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12866 | return 0; |
| 12867 | } |
| 12868 | |
| 12869 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12870 | * ALC269 channel source setting (2 channel) |
| 12871 | */ |
| 12872 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12873 | |
| 12874 | #define alc269_dac_nids alc260_dac_nids |
| 12875 | |
| 12876 | static hda_nid_t alc269_adc_nids[1] = { |
| 12877 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12878 | 0x08, |
| 12879 | }; |
| 12880 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12881 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12882 | 0x23, |
| 12883 | }; |
| 12884 | |
| 12885 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12886 | * not a mux! |
| 12887 | */ |
| 12888 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12889 | #define alc269_modes alc260_modes |
| 12890 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12891 | |
| 12892 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12894 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12895 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12896 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12897 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12899 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12900 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12901 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12902 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12903 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12904 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12905 | { } /* end */ |
| 12906 | }; |
| 12907 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12908 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12909 | /* output mixer control */ |
| 12910 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12911 | { |
| 12912 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12913 | .name = "Master Playback Switch", |
| 12914 | .info = snd_hda_mixer_amp_switch_info, |
| 12915 | .get = snd_hda_mixer_amp_switch_get, |
| 12916 | .put = alc268_acer_master_sw_put, |
| 12917 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12918 | }, |
| 12919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12922 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12923 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12924 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12925 | { } |
| 12926 | }; |
| 12927 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12928 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12929 | /* output mixer control */ |
| 12930 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12931 | { |
| 12932 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12933 | .name = "Master Playback Switch", |
| 12934 | .info = snd_hda_mixer_amp_switch_info, |
| 12935 | .get = snd_hda_mixer_amp_switch_get, |
| 12936 | .put = alc268_acer_master_sw_put, |
| 12937 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12938 | }, |
| 12939 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12940 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12941 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12942 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12943 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12944 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12945 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12946 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12947 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12948 | { } |
| 12949 | }; |
| 12950 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12951 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12952 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12953 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12954 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12955 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12956 | { } /* end */ |
| 12957 | }; |
| 12958 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12959 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12960 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12961 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12962 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12963 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12964 | { } /* end */ |
| 12965 | }; |
| 12966 | |
| 12967 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12968 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12969 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12970 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12971 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12972 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12974 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12975 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12976 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12977 | { } |
| 12978 | }; |
| 12979 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12980 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12981 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12982 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12983 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12984 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12985 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12986 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12987 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12988 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12989 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12990 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12991 | { } |
| 12992 | }; |
| 12993 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12994 | /* toggle speaker-output according to the hp-jack state */ |
| 12995 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12996 | { |
| 12997 | unsigned int present; |
| 12998 | unsigned char bits; |
| 12999 | |
| 13000 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13001 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13002 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13003 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13004 | AMP_IN_MUTE(0), bits); |
| 13005 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13006 | AMP_IN_MUTE(0), bits); |
| 13007 | |
| 13008 | snd_hda_codec_write(codec, 0x20, 0, |
| 13009 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13010 | snd_hda_codec_write(codec, 0x20, 0, |
| 13011 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13012 | |
| 13013 | snd_hda_codec_write(codec, 0x20, 0, |
| 13014 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13015 | snd_hda_codec_write(codec, 0x20, 0, |
| 13016 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13017 | } |
| 13018 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13019 | /* toggle speaker-output according to the hp-jacks state */ |
| 13020 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 13021 | { |
| 13022 | unsigned int present; |
| 13023 | unsigned char bits; |
| 13024 | |
| 13025 | /* Check laptop headphone socket */ |
| 13026 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13027 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13028 | |
| 13029 | /* Check port replicator headphone socket */ |
| 13030 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 13031 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13032 | |
| 13033 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13034 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13035 | AMP_IN_MUTE(0), bits); |
| 13036 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13037 | AMP_IN_MUTE(0), bits); |
| 13038 | |
| 13039 | snd_hda_codec_write(codec, 0x20, 0, |
| 13040 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13041 | snd_hda_codec_write(codec, 0x20, 0, |
| 13042 | AC_VERB_SET_PROC_COEF, 0x680); |
| 13043 | |
| 13044 | snd_hda_codec_write(codec, 0x20, 0, |
| 13045 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 13046 | snd_hda_codec_write(codec, 0x20, 0, |
| 13047 | AC_VERB_SET_PROC_COEF, 0x480); |
| 13048 | } |
| 13049 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13050 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 13051 | { |
| 13052 | unsigned int present_laptop; |
| 13053 | unsigned int present_dock; |
| 13054 | |
| 13055 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 13056 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13057 | |
| 13058 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 13059 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13060 | |
| 13061 | /* Laptop mic port overrides dock mic port, design decision */ |
| 13062 | if (present_dock) |
| 13063 | snd_hda_codec_write(codec, 0x23, 0, |
| 13064 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 13065 | if (present_laptop) |
| 13066 | snd_hda_codec_write(codec, 0x23, 0, |
| 13067 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 13068 | if (!present_dock && !present_laptop) |
| 13069 | snd_hda_codec_write(codec, 0x23, 0, |
| 13070 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 13071 | } |
| 13072 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13073 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 13074 | unsigned int res) |
| 13075 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13076 | switch (res >> 26) { |
| 13077 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13078 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13079 | break; |
| 13080 | case ALC880_MIC_EVENT: |
| 13081 | alc_mic_automute(codec); |
| 13082 | break; |
| 13083 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13084 | } |
| 13085 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13086 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 13087 | unsigned int res) |
| 13088 | { |
| 13089 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13090 | alc269_lifebook_speaker_automute(codec); |
| 13091 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13092 | alc269_lifebook_mic_autoswitch(codec); |
| 13093 | } |
| 13094 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13095 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) |
| 13096 | { |
| 13097 | struct alc_spec *spec = codec->spec; |
| 13098 | spec->ext_mic.pin = 0x18; |
| 13099 | spec->ext_mic.mux_idx = 0; |
| 13100 | spec->int_mic.pin = 0x19; |
| 13101 | spec->int_mic.mux_idx = 1; |
| 13102 | spec->auto_mic = 1; |
| 13103 | } |
| 13104 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13105 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 13106 | { |
| 13107 | alc269_quanta_fl1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13108 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13109 | } |
| 13110 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13111 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 13112 | { |
| 13113 | alc269_lifebook_speaker_automute(codec); |
| 13114 | alc269_lifebook_mic_autoswitch(codec); |
| 13115 | } |
| 13116 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13117 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 13118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13119 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 13120 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 13122 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13123 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13124 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13125 | {} |
| 13126 | }; |
| 13127 | |
| 13128 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 13129 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13130 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 13131 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 13132 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 13133 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13134 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13135 | {} |
| 13136 | }; |
| 13137 | |
| 13138 | /* toggle speaker-output according to the hp-jack state */ |
| 13139 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 13140 | { |
| 13141 | unsigned int present; |
| 13142 | unsigned char bits; |
| 13143 | |
| 13144 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 13145 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13146 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 13147 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 13148 | AMP_IN_MUTE(0), bits); |
| 13149 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 13150 | AMP_IN_MUTE(0), bits); |
| 13151 | } |
| 13152 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13153 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13154 | static void alc269_eeepc_unsol_event(struct hda_codec *codec, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13155 | unsigned int res) |
| 13156 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13157 | switch (res >> 26) { |
| 13158 | case ALC880_HP_EVENT: |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13159 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13160 | break; |
| 13161 | case ALC880_MIC_EVENT: |
| 13162 | alc_mic_automute(codec); |
| 13163 | break; |
| 13164 | } |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13165 | } |
| 13166 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13167 | static void alc269_eeepc_dmic_setup(struct hda_codec *codec) |
| 13168 | { |
| 13169 | struct alc_spec *spec = codec->spec; |
| 13170 | spec->ext_mic.pin = 0x18; |
| 13171 | spec->ext_mic.mux_idx = 0; |
| 13172 | spec->int_mic.pin = 0x12; |
| 13173 | spec->int_mic.mux_idx = 5; |
| 13174 | spec->auto_mic = 1; |
| 13175 | } |
| 13176 | |
| 13177 | static void alc269_eeepc_amic_setup(struct hda_codec *codec) |
| 13178 | { |
| 13179 | struct alc_spec *spec = codec->spec; |
| 13180 | spec->ext_mic.pin = 0x18; |
| 13181 | spec->ext_mic.mux_idx = 0; |
| 13182 | spec->int_mic.pin = 0x19; |
| 13183 | spec->int_mic.mux_idx = 1; |
| 13184 | spec->auto_mic = 1; |
| 13185 | } |
| 13186 | |
| 13187 | static void alc269_eeepc_inithook(struct hda_codec *codec) |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13188 | { |
| 13189 | alc269_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13190 | alc_mic_automute(codec); |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13191 | } |
| 13192 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13193 | /* |
| 13194 | * generic initialization of ADC, input mixers and output mixers |
| 13195 | */ |
| 13196 | static struct hda_verb alc269_init_verbs[] = { |
| 13197 | /* |
| 13198 | * Unmute ADC0 and set the default input to mic-in |
| 13199 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13201 | |
| 13202 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 13203 | * analog-loopback mixer widget |
| 13204 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 13205 | * front panel mic (mic 2) |
| 13206 | */ |
| 13207 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 13208 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13209 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13210 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13211 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13212 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 13213 | |
| 13214 | /* |
| 13215 | * Set up output mixers (0x0c - 0x0e) |
| 13216 | */ |
| 13217 | /* set vol=0 to output mixers */ |
| 13218 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13219 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13220 | |
| 13221 | /* set up input amps for analog loopback */ |
| 13222 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 13223 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13226 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13227 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13228 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13229 | |
| 13230 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13232 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13233 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13234 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13235 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13236 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13237 | |
| 13238 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13240 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13241 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13242 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13243 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13244 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13245 | |
| 13246 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13247 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13248 | |
| 13249 | /* FIXME: use matrix-type input source selection */ |
| 13250 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 13251 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13252 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13253 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13254 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13256 | |
| 13257 | /* set EAPD */ |
| 13258 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13259 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13260 | { } |
| 13261 | }; |
| 13262 | |
Takashi Iwai | 9d0b71b | 2009-08-24 14:10:30 +0200 | [diff] [blame] | 13263 | #define alc269_auto_create_multi_out_ctls \ |
| 13264 | alc268_auto_create_multi_out_ctls |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13265 | #define alc269_auto_create_input_ctls \ |
| 13266 | alc268_auto_create_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13267 | |
| 13268 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13269 | #define alc269_loopbacks alc880_loopbacks |
| 13270 | #endif |
| 13271 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13272 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13273 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13274 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13275 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13276 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13277 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13278 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13279 | .substreams = 1, |
| 13280 | .channels_min = 2, |
| 13281 | .channels_max = 8, |
| 13282 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13283 | /* NID is set in alc_build_pcms */ |
| 13284 | .ops = { |
| 13285 | .open = alc880_playback_pcm_open, |
| 13286 | .prepare = alc880_playback_pcm_prepare, |
| 13287 | .cleanup = alc880_playback_pcm_cleanup |
| 13288 | }, |
| 13289 | }; |
| 13290 | |
| 13291 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13292 | .substreams = 1, |
| 13293 | .channels_min = 2, |
| 13294 | .channels_max = 2, |
| 13295 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13296 | /* NID is set in alc_build_pcms */ |
| 13297 | }; |
| 13298 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13299 | /* |
| 13300 | * BIOS auto configuration |
| 13301 | */ |
| 13302 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13303 | { |
| 13304 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13305 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13306 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13307 | |
| 13308 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13309 | alc269_ignore); |
| 13310 | if (err < 0) |
| 13311 | return err; |
| 13312 | |
| 13313 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13314 | if (err < 0) |
| 13315 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 13316 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13317 | if (err < 0) |
| 13318 | return err; |
| 13319 | |
| 13320 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13321 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13322 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13323 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13324 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13325 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13326 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13327 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13328 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13329 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13330 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13331 | /* set default input source */ |
| 13332 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13333 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13334 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13335 | |
| 13336 | err = alc_auto_add_mic_boost(codec); |
| 13337 | if (err < 0) |
| 13338 | return err; |
| 13339 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13340 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13341 | set_capture_mixer(codec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13342 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13343 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13344 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13345 | return 1; |
| 13346 | } |
| 13347 | |
Takashi Iwai | e9af4f3 | 2009-08-29 23:23:08 +0200 | [diff] [blame] | 13348 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
| 13349 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13350 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13351 | |
| 13352 | |
| 13353 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13354 | static void alc269_auto_init(struct hda_codec *codec) |
| 13355 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13356 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13357 | alc269_auto_init_multi_out(codec); |
| 13358 | alc269_auto_init_hp_out(codec); |
| 13359 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13360 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13361 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13362 | } |
| 13363 | |
| 13364 | /* |
| 13365 | * configuration and preset |
| 13366 | */ |
| 13367 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13368 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13369 | [ALC269_QUANTA_FL1] = "quanta", |
| 13370 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13371 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13372 | [ALC269_FUJITSU] = "fujitsu", |
| 13373 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13374 | }; |
| 13375 | |
| 13376 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13377 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13378 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13379 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13380 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13381 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13382 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13383 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13384 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13385 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13386 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13387 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13388 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13389 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13390 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13391 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13392 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13393 | {} |
| 13394 | }; |
| 13395 | |
| 13396 | static struct alc_config_preset alc269_presets[] = { |
| 13397 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13398 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13399 | .init_verbs = { alc269_init_verbs }, |
| 13400 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13401 | .dac_nids = alc269_dac_nids, |
| 13402 | .hp_nid = 0x03, |
| 13403 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13404 | .channel_mode = alc269_modes, |
| 13405 | .input_mux = &alc269_capture_source, |
| 13406 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13407 | [ALC269_QUANTA_FL1] = { |
| 13408 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13409 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13410 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13411 | .dac_nids = alc269_dac_nids, |
| 13412 | .hp_nid = 0x03, |
| 13413 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13414 | .channel_mode = alc269_modes, |
| 13415 | .input_mux = &alc269_capture_source, |
| 13416 | .unsol_event = alc269_quanta_fl1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13417 | .setup = alc269_quanta_fl1_setup, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13418 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13419 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13420 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13421 | .mixers = { alc269_eeepc_mixer }, |
| 13422 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13423 | .init_verbs = { alc269_init_verbs, |
| 13424 | alc269_eeepc_amic_init_verbs }, |
| 13425 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13426 | .dac_nids = alc269_dac_nids, |
| 13427 | .hp_nid = 0x03, |
| 13428 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13429 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13430 | .unsol_event = alc269_eeepc_unsol_event, |
| 13431 | .setup = alc269_eeepc_amic_setup, |
| 13432 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13433 | }, |
| 13434 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13435 | .mixers = { alc269_eeepc_mixer }, |
| 13436 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13437 | .init_verbs = { alc269_init_verbs, |
| 13438 | alc269_eeepc_dmic_init_verbs }, |
| 13439 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13440 | .dac_nids = alc269_dac_nids, |
| 13441 | .hp_nid = 0x03, |
| 13442 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13443 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13444 | .unsol_event = alc269_eeepc_unsol_event, |
| 13445 | .setup = alc269_eeepc_dmic_setup, |
| 13446 | .init_hook = alc269_eeepc_inithook, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13447 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13448 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13449 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13450 | .cap_mixer = alc269_epc_capture_mixer, |
| 13451 | .init_verbs = { alc269_init_verbs, |
| 13452 | alc269_eeepc_dmic_init_verbs }, |
| 13453 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13454 | .dac_nids = alc269_dac_nids, |
| 13455 | .hp_nid = 0x03, |
| 13456 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13457 | .channel_mode = alc269_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 13458 | .unsol_event = alc269_eeepc_unsol_event, |
| 13459 | .setup = alc269_eeepc_dmic_setup, |
| 13460 | .init_hook = alc269_eeepc_inithook, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13461 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13462 | [ALC269_LIFEBOOK] = { |
| 13463 | .mixers = { alc269_lifebook_mixer }, |
| 13464 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13465 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13466 | .dac_nids = alc269_dac_nids, |
| 13467 | .hp_nid = 0x03, |
| 13468 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13469 | .channel_mode = alc269_modes, |
| 13470 | .input_mux = &alc269_capture_source, |
| 13471 | .unsol_event = alc269_lifebook_unsol_event, |
| 13472 | .init_hook = alc269_lifebook_init_hook, |
| 13473 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13474 | }; |
| 13475 | |
| 13476 | static int patch_alc269(struct hda_codec *codec) |
| 13477 | { |
| 13478 | struct alc_spec *spec; |
| 13479 | int board_config; |
| 13480 | int err; |
| 13481 | |
| 13482 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13483 | if (spec == NULL) |
| 13484 | return -ENOMEM; |
| 13485 | |
| 13486 | codec->spec = spec; |
| 13487 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13488 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13489 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13490 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13491 | alc269_models, |
| 13492 | alc269_cfg_tbl); |
| 13493 | |
| 13494 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 13495 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 13496 | codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13497 | board_config = ALC269_AUTO; |
| 13498 | } |
| 13499 | |
| 13500 | if (board_config == ALC269_AUTO) { |
| 13501 | /* automatic parse from the BIOS config */ |
| 13502 | err = alc269_parse_auto_config(codec); |
| 13503 | if (err < 0) { |
| 13504 | alc_free(codec); |
| 13505 | return err; |
| 13506 | } else if (!err) { |
| 13507 | printk(KERN_INFO |
| 13508 | "hda_codec: Cannot set up configuration " |
| 13509 | "from BIOS. Using base mode...\n"); |
| 13510 | board_config = ALC269_BASIC; |
| 13511 | } |
| 13512 | } |
| 13513 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13514 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13515 | if (err < 0) { |
| 13516 | alc_free(codec); |
| 13517 | return err; |
| 13518 | } |
| 13519 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13520 | if (board_config != ALC269_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 13521 | setup_preset(codec, &alc269_presets[board_config]); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13522 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13523 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13524 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13525 | * fix the sample rate of analog I/O to 44.1kHz |
| 13526 | */ |
| 13527 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13528 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13529 | } else { |
| 13530 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13531 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13532 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13533 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13534 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13535 | |
| 13536 | spec->adc_nids = alc269_adc_nids; |
| 13537 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13538 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13539 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 13540 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13541 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13542 | |
Takashi Iwai | 100d5eb | 2009-08-10 11:55:51 +0200 | [diff] [blame] | 13543 | spec->vmaster_nid = 0x02; |
| 13544 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13545 | codec->patch_ops = alc_patch_ops; |
| 13546 | if (board_config == ALC269_AUTO) |
| 13547 | spec->init_hook = alc269_auto_init; |
| 13548 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13549 | if (!spec->loopback.amplist) |
| 13550 | spec->loopback.amplist = alc269_loopbacks; |
| 13551 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13552 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13553 | |
| 13554 | return 0; |
| 13555 | } |
| 13556 | |
| 13557 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13558 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13559 | */ |
| 13560 | |
| 13561 | /* |
| 13562 | * set the path ways for 2 channel output |
| 13563 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13564 | */ |
| 13565 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13566 | /* set pin widget 1Ah (line in) for input */ |
| 13567 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13568 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13569 | * the vref |
| 13570 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13571 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13573 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13574 | #if 0 |
| 13575 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13576 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13577 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13578 | { } /* end */ |
| 13579 | }; |
| 13580 | /* |
| 13581 | * 6ch mode |
| 13582 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13583 | */ |
| 13584 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13585 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13586 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13587 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13588 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13589 | |
| 13590 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13591 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13592 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13593 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13594 | #if 0 |
| 13595 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13596 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13597 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13598 | { } /* end */ |
| 13599 | }; |
| 13600 | |
| 13601 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13602 | { 2, alc861_threestack_ch2_init }, |
| 13603 | { 6, alc861_threestack_ch6_init }, |
| 13604 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13605 | /* Set mic1 as input and unmute the mixer */ |
| 13606 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13607 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13608 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13609 | { } /* end */ |
| 13610 | }; |
| 13611 | /* Set mic1 as output and mute mixer */ |
| 13612 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13613 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13614 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13615 | { } /* end */ |
| 13616 | }; |
| 13617 | |
| 13618 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13619 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13620 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13621 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13622 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13623 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13624 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13625 | /* set pin widget 1Ah (line in) for input */ |
| 13626 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13627 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13628 | * the vref |
| 13629 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13630 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13631 | |
| 13632 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13633 | #if 0 |
| 13634 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13635 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13636 | #endif |
| 13637 | { } /* end */ |
| 13638 | }; |
| 13639 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13640 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13641 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13642 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13643 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13644 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13645 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13646 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13647 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13648 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13649 | |
| 13650 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13651 | #if 0 |
| 13652 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13653 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13654 | #endif |
| 13655 | { } /* end */ |
| 13656 | }; |
| 13657 | |
| 13658 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13659 | { 2, alc861_asus_ch2_init }, |
| 13660 | { 6, alc861_asus_ch6_init }, |
| 13661 | }; |
| 13662 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13663 | /* patch-ALC861 */ |
| 13664 | |
| 13665 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13666 | /* output mixer control */ |
| 13667 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13668 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13669 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13670 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13671 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13672 | |
| 13673 | /*Input mixer control */ |
| 13674 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13675 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13676 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13677 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13678 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13679 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13680 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13681 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13682 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13683 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13685 | { } /* end */ |
| 13686 | }; |
| 13687 | |
| 13688 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13689 | /* output mixer control */ |
| 13690 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13691 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13692 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13693 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13694 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13695 | |
| 13696 | /* Input mixer control */ |
| 13697 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13698 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13699 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13700 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13701 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13702 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13703 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13704 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13705 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13707 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | { |
| 13709 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13710 | .name = "Channel Mode", |
| 13711 | .info = alc_ch_mode_info, |
| 13712 | .get = alc_ch_mode_get, |
| 13713 | .put = alc_ch_mode_put, |
| 13714 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13715 | }, |
| 13716 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13717 | }; |
| 13718 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13719 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13720 | /* output mixer control */ |
| 13721 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13724 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13725 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13726 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13727 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13728 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13729 | /* output mixer control */ |
| 13730 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13731 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13732 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13733 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13734 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13735 | |
| 13736 | /* Input mixer control */ |
| 13737 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13738 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13739 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13740 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13741 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13742 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13743 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13745 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13746 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13747 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13748 | { |
| 13749 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13750 | .name = "Channel Mode", |
| 13751 | .info = alc_ch_mode_info, |
| 13752 | .get = alc_ch_mode_get, |
| 13753 | .put = alc_ch_mode_put, |
| 13754 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13755 | }, |
| 13756 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13757 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13758 | |
| 13759 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13760 | /* output mixer control */ |
| 13761 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13762 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13763 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13764 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13765 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13766 | |
| 13767 | /* Input mixer control */ |
| 13768 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13769 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13770 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13771 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13773 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13774 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13775 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13777 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13778 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13779 | { |
| 13780 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13781 | .name = "Channel Mode", |
| 13782 | .info = alc_ch_mode_info, |
| 13783 | .get = alc_ch_mode_get, |
| 13784 | .put = alc_ch_mode_put, |
| 13785 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13786 | }, |
| 13787 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13788 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13789 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13790 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13791 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13792 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13793 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13794 | { } |
| 13795 | }; |
| 13796 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13797 | /* |
| 13798 | * generic initialization of ADC, input mixers and output mixers |
| 13799 | */ |
| 13800 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13801 | /* |
| 13802 | * Unmute ADC0 and set the default input to mic-in |
| 13803 | */ |
| 13804 | /* port-A for surround (rear panel) */ |
| 13805 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13806 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13807 | /* port-B for mic-in (rear panel) with vref */ |
| 13808 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13809 | /* port-C for line-in (rear panel) */ |
| 13810 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13811 | /* port-D for Front */ |
| 13812 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13813 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13814 | /* port-E for HP out (front panel) */ |
| 13815 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13816 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13817 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13818 | /* port-F for mic-in (front panel) with vref */ |
| 13819 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13820 | /* port-G for CLFE (rear panel) */ |
| 13821 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13822 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13823 | /* port-H for side (rear panel) */ |
| 13824 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13825 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13826 | /* CD-in */ |
| 13827 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13828 | /* route front mic to ADC1*/ |
| 13829 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13830 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13831 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13832 | /* Unmute DAC0~3 & spdif out*/ |
| 13833 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13834 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13835 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13836 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13837 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13838 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13839 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13840 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13841 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13842 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13843 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13845 | /* Unmute Stereo Mixer 15 */ |
| 13846 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13848 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13849 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13850 | |
| 13851 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13852 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13853 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13854 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13855 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13856 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13857 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13858 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13859 | /* hp used DAC 3 (Front) */ |
| 13860 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13861 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13862 | |
| 13863 | { } |
| 13864 | }; |
| 13865 | |
| 13866 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13867 | /* |
| 13868 | * Unmute ADC0 and set the default input to mic-in |
| 13869 | */ |
| 13870 | /* port-A for surround (rear panel) */ |
| 13871 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13872 | /* port-B for mic-in (rear panel) with vref */ |
| 13873 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13874 | /* port-C for line-in (rear panel) */ |
| 13875 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13876 | /* port-D for Front */ |
| 13877 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13878 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13879 | /* port-E for HP out (front panel) */ |
| 13880 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13881 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13882 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13883 | /* port-F for mic-in (front panel) with vref */ |
| 13884 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13885 | /* port-G for CLFE (rear panel) */ |
| 13886 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13887 | /* port-H for side (rear panel) */ |
| 13888 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13889 | /* CD-in */ |
| 13890 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13891 | /* route front mic to ADC1*/ |
| 13892 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13893 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13894 | /* Unmute DAC0~3 & spdif out*/ |
| 13895 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13896 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13897 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13898 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13899 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13900 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13901 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13902 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13903 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13904 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13905 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13906 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13907 | /* Unmute Stereo Mixer 15 */ |
| 13908 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13909 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13910 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13911 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13912 | |
| 13913 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13914 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13915 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13916 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13917 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13918 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13919 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13920 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13921 | /* hp used DAC 3 (Front) */ |
| 13922 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13923 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13924 | { } |
| 13925 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13926 | |
| 13927 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13928 | /* |
| 13929 | * Unmute ADC0 and set the default input to mic-in |
| 13930 | */ |
| 13931 | /* port-A for surround (rear panel) */ |
| 13932 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13933 | /* port-B for mic-in (rear panel) with vref */ |
| 13934 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13935 | /* port-C for line-in (rear panel) */ |
| 13936 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13937 | /* port-D for Front */ |
| 13938 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13939 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13940 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13941 | /* this has to be set to VREF80 */ |
| 13942 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13943 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13944 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13945 | /* port-F for mic-in (front panel) with vref */ |
| 13946 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13947 | /* port-G for CLFE (rear panel) */ |
| 13948 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13949 | /* port-H for side (rear panel) */ |
| 13950 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13951 | /* CD-in */ |
| 13952 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13953 | /* route front mic to ADC1*/ |
| 13954 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13955 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13956 | /* Unmute DAC0~3 & spdif out*/ |
| 13957 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13958 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13959 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13960 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13961 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13962 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13963 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13964 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13965 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13966 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13967 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13968 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13969 | /* Unmute Stereo Mixer 15 */ |
| 13970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13974 | |
| 13975 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13976 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13977 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13978 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13980 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13982 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13983 | /* hp used DAC 3 (Front) */ |
| 13984 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13986 | { } |
| 13987 | }; |
| 13988 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13989 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13990 | /* |
| 13991 | * Unmute ADC0 and set the default input to mic-in |
| 13992 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13993 | /* port-A for surround (rear panel) |
| 13994 | * according to codec#0 this is the HP jack |
| 13995 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13996 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13997 | /* route front PCM to HP */ |
| 13998 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13999 | /* port-B for mic-in (rear panel) with vref */ |
| 14000 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14001 | /* port-C for line-in (rear panel) */ |
| 14002 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14003 | /* port-D for Front */ |
| 14004 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14005 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 14006 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14007 | /* this has to be set to VREF80 */ |
| 14008 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14009 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 14010 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14011 | /* port-F for mic-in (front panel) with vref */ |
| 14012 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 14013 | /* port-G for CLFE (rear panel) */ |
| 14014 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14015 | /* port-H for side (rear panel) */ |
| 14016 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 14017 | /* CD-in */ |
| 14018 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 14019 | /* route front mic to ADC1*/ |
| 14020 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14021 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14022 | /* Unmute DAC0~3 & spdif out*/ |
| 14023 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14024 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14025 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14026 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14027 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14028 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14029 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14030 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14031 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14032 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14033 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14034 | /* Unmute Stereo Mixer 15 */ |
| 14035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14037 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14039 | |
| 14040 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14041 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14042 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14043 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14044 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14045 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14046 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14047 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14048 | /* hp used DAC 3 (Front) */ |
| 14049 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14050 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14051 | { } |
| 14052 | }; |
| 14053 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14054 | /* additional init verbs for ASUS laptops */ |
| 14055 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 14056 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 14057 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 14058 | { } |
| 14059 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14061 | /* |
| 14062 | * generic initialization of ADC, input mixers and output mixers |
| 14063 | */ |
| 14064 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 14065 | /* |
| 14066 | * Unmute ADC0 and set the default input to mic-in |
| 14067 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14068 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14069 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14070 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14071 | /* Unmute DAC0~3 & spdif out*/ |
| 14072 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14073 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14074 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14075 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14076 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14078 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 14079 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14080 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14081 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14082 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14083 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14084 | /* Unmute Stereo Mixer 15 */ |
| 14085 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14086 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14087 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 14088 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 14089 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14090 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14091 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14092 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14093 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14094 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14095 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14096 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14098 | |
| 14099 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14100 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14101 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14102 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14103 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14104 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14105 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14106 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14107 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14108 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14109 | |
| 14110 | { } |
| 14111 | }; |
| 14112 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14113 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 14114 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14115 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14116 | { } |
| 14117 | }; |
| 14118 | |
| 14119 | /* toggle speaker-output according to the hp-jack state */ |
| 14120 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 14121 | { |
| 14122 | unsigned int present; |
| 14123 | |
| 14124 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 14125 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14126 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 14127 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 14128 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 14129 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14130 | } |
| 14131 | |
| 14132 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 14133 | unsigned int res) |
| 14134 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14135 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14136 | alc861_toshiba_automute(codec); |
| 14137 | } |
| 14138 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14139 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14140 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 14141 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 14142 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 14143 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 14144 | |
| 14145 | |
| 14146 | #define ALC861_DIGOUT_NID 0x07 |
| 14147 | |
| 14148 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 14149 | { 8, NULL } |
| 14150 | }; |
| 14151 | |
| 14152 | static hda_nid_t alc861_dac_nids[4] = { |
| 14153 | /* front, surround, clfe, side */ |
| 14154 | 0x03, 0x06, 0x05, 0x04 |
| 14155 | }; |
| 14156 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14157 | static hda_nid_t alc660_dac_nids[3] = { |
| 14158 | /* front, clfe, surround */ |
| 14159 | 0x03, 0x05, 0x06 |
| 14160 | }; |
| 14161 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14162 | static hda_nid_t alc861_adc_nids[1] = { |
| 14163 | /* ADC0-2 */ |
| 14164 | 0x08, |
| 14165 | }; |
| 14166 | |
| 14167 | static struct hda_input_mux alc861_capture_source = { |
| 14168 | .num_items = 5, |
| 14169 | .items = { |
| 14170 | { "Mic", 0x0 }, |
| 14171 | { "Front Mic", 0x3 }, |
| 14172 | { "Line", 0x1 }, |
| 14173 | { "CD", 0x4 }, |
| 14174 | { "Mixer", 0x5 }, |
| 14175 | }, |
| 14176 | }; |
| 14177 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14178 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 14179 | { |
| 14180 | struct alc_spec *spec = codec->spec; |
| 14181 | hda_nid_t mix, srcs[5]; |
| 14182 | int i, j, num; |
| 14183 | |
| 14184 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 14185 | return 0; |
| 14186 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14187 | if (num < 0) |
| 14188 | return 0; |
| 14189 | for (i = 0; i < num; i++) { |
| 14190 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 14191 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14192 | if (type != AC_WID_AUD_OUT) |
| 14193 | continue; |
| 14194 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 14195 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 14196 | break; |
| 14197 | if (j >= spec->multiout.num_dacs) |
| 14198 | return srcs[i]; |
| 14199 | } |
| 14200 | return 0; |
| 14201 | } |
| 14202 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14203 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14204 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14205 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14206 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14207 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14208 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14209 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14210 | |
| 14211 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14212 | for (i = 0; i < cfg->line_outs; i++) { |
| 14213 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14214 | dac = alc861_look_for_dac(codec, nid); |
| 14215 | if (!dac) |
| 14216 | continue; |
| 14217 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14218 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14219 | return 0; |
| 14220 | } |
| 14221 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14222 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14223 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14224 | { |
| 14225 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14226 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14227 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14228 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14229 | } |
| 14230 | |
| 14231 | /* add playback controls from the parsed DAC table */ |
| 14232 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14233 | const struct auto_pin_cfg *cfg) |
| 14234 | { |
| 14235 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14236 | static const char *chname[4] = { |
| 14237 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14238 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14239 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14240 | int i, err; |
| 14241 | |
| 14242 | if (cfg->line_outs == 1) { |
| 14243 | const char *pfx = NULL; |
| 14244 | if (!cfg->hp_outs) |
| 14245 | pfx = "Master"; |
| 14246 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14247 | pfx = "Speaker"; |
| 14248 | if (pfx) { |
| 14249 | nid = spec->multiout.dac_nids[0]; |
| 14250 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14251 | } |
| 14252 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14253 | |
| 14254 | for (i = 0; i < cfg->line_outs; i++) { |
| 14255 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14256 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14257 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14258 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14259 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14260 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14261 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14262 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14263 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14264 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14265 | return err; |
| 14266 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14267 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14268 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | return err; |
| 14270 | } |
| 14271 | } |
| 14272 | return 0; |
| 14273 | } |
| 14274 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14275 | 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] | 14276 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14277 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14278 | int err; |
| 14279 | hda_nid_t nid; |
| 14280 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14281 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14282 | return 0; |
| 14283 | |
| 14284 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14285 | nid = alc861_look_for_dac(codec, pin); |
| 14286 | if (nid) { |
| 14287 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14288 | if (err < 0) |
| 14289 | return err; |
| 14290 | spec->multiout.hp_nid = nid; |
| 14291 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14292 | } |
| 14293 | return 0; |
| 14294 | } |
| 14295 | |
| 14296 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14297 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14298 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14299 | { |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14300 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14301 | } |
| 14302 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14303 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14304 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14305 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14306 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14307 | hda_nid_t mix, srcs[5]; |
| 14308 | int i, num; |
| 14309 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14310 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14311 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14312 | 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] | 14313 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14314 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14315 | return; |
| 14316 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14317 | if (num < 0) |
| 14318 | return; |
| 14319 | for (i = 0; i < num; i++) { |
| 14320 | unsigned int mute; |
| 14321 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14322 | mute = AMP_IN_UNMUTE(i); |
| 14323 | else |
| 14324 | mute = AMP_IN_MUTE(i); |
| 14325 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14326 | mute); |
| 14327 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14328 | } |
| 14329 | |
| 14330 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14331 | { |
| 14332 | struct alc_spec *spec = codec->spec; |
| 14333 | int i; |
| 14334 | |
| 14335 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14336 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14337 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14338 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14339 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14340 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14341 | } |
| 14342 | } |
| 14343 | |
| 14344 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14345 | { |
| 14346 | struct alc_spec *spec = codec->spec; |
| 14347 | hda_nid_t pin; |
| 14348 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14349 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14350 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14351 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14352 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14353 | pin = spec->autocfg.speaker_pins[0]; |
| 14354 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14355 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14356 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14357 | } |
| 14358 | |
| 14359 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14360 | { |
| 14361 | struct alc_spec *spec = codec->spec; |
| 14362 | int i; |
| 14363 | |
| 14364 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14365 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14366 | if (nid >= 0x0c && nid <= 0x11) |
| 14367 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14368 | } |
| 14369 | } |
| 14370 | |
| 14371 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14372 | /* return 1 if successful, 0 if the proper config is not found, |
| 14373 | * or a negative error code |
| 14374 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14375 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14376 | { |
| 14377 | struct alc_spec *spec = codec->spec; |
| 14378 | int err; |
| 14379 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14380 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14381 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14382 | alc861_ignore); |
| 14383 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14384 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14385 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14386 | return 0; /* can't find valid BIOS pin config */ |
| 14387 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14388 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14389 | if (err < 0) |
| 14390 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14391 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14392 | if (err < 0) |
| 14393 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14394 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14395 | if (err < 0) |
| 14396 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 14397 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14398 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14399 | return err; |
| 14400 | |
| 14401 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14402 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14403 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14404 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14405 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14406 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14407 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14408 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14409 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14410 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14411 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14412 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14413 | |
| 14414 | spec->adc_nids = alc861_adc_nids; |
| 14415 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 14416 | set_capture_mixer(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14417 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14418 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14419 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14420 | return 1; |
| 14421 | } |
| 14422 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14423 | /* additional initialization for auto-configuration model */ |
| 14424 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14425 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14426 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14427 | alc861_auto_init_multi_out(codec); |
| 14428 | alc861_auto_init_hp_out(codec); |
| 14429 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14430 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14431 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14432 | } |
| 14433 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14434 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14435 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14436 | { 0x15, HDA_INPUT, 0 }, |
| 14437 | { 0x15, HDA_INPUT, 1 }, |
| 14438 | { 0x15, HDA_INPUT, 2 }, |
| 14439 | { 0x15, HDA_INPUT, 3 }, |
| 14440 | { } /* end */ |
| 14441 | }; |
| 14442 | #endif |
| 14443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14444 | |
| 14445 | /* |
| 14446 | * configuration and preset |
| 14447 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14448 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14449 | [ALC861_3ST] = "3stack", |
| 14450 | [ALC660_3ST] = "3stack-660", |
| 14451 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14452 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14453 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14454 | [ALC861_TOSHIBA] = "toshiba", |
| 14455 | [ALC861_ASUS] = "asus", |
| 14456 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14457 | [ALC861_AUTO] = "auto", |
| 14458 | }; |
| 14459 | |
| 14460 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14461 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14462 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14463 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14464 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14465 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14466 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14467 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14468 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14469 | * Any other models that need this preset? |
| 14470 | */ |
| 14471 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14472 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14473 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14474 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14475 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14476 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14477 | /* FIXME: the below seems conflict */ |
| 14478 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14479 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14480 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14481 | {} |
| 14482 | }; |
| 14483 | |
| 14484 | static struct alc_config_preset alc861_presets[] = { |
| 14485 | [ALC861_3ST] = { |
| 14486 | .mixers = { alc861_3ST_mixer }, |
| 14487 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14488 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14489 | .dac_nids = alc861_dac_nids, |
| 14490 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14491 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14492 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14493 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14494 | .adc_nids = alc861_adc_nids, |
| 14495 | .input_mux = &alc861_capture_source, |
| 14496 | }, |
| 14497 | [ALC861_3ST_DIG] = { |
| 14498 | .mixers = { alc861_base_mixer }, |
| 14499 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14500 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14501 | .dac_nids = alc861_dac_nids, |
| 14502 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14503 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14504 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14505 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14506 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14507 | .adc_nids = alc861_adc_nids, |
| 14508 | .input_mux = &alc861_capture_source, |
| 14509 | }, |
| 14510 | [ALC861_6ST_DIG] = { |
| 14511 | .mixers = { alc861_base_mixer }, |
| 14512 | .init_verbs = { alc861_base_init_verbs }, |
| 14513 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14514 | .dac_nids = alc861_dac_nids, |
| 14515 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14516 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14517 | .channel_mode = alc861_8ch_modes, |
| 14518 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14519 | .adc_nids = alc861_adc_nids, |
| 14520 | .input_mux = &alc861_capture_source, |
| 14521 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14522 | [ALC660_3ST] = { |
| 14523 | .mixers = { alc861_3ST_mixer }, |
| 14524 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14525 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14526 | .dac_nids = alc660_dac_nids, |
| 14527 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14528 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14529 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14530 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14531 | .adc_nids = alc861_adc_nids, |
| 14532 | .input_mux = &alc861_capture_source, |
| 14533 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14534 | [ALC861_UNIWILL_M31] = { |
| 14535 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14536 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14537 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14538 | .dac_nids = alc861_dac_nids, |
| 14539 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14540 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14541 | .channel_mode = alc861_uniwill_m31_modes, |
| 14542 | .need_dac_fix = 1, |
| 14543 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14544 | .adc_nids = alc861_adc_nids, |
| 14545 | .input_mux = &alc861_capture_source, |
| 14546 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14547 | [ALC861_TOSHIBA] = { |
| 14548 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14549 | .init_verbs = { alc861_base_init_verbs, |
| 14550 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14551 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14552 | .dac_nids = alc861_dac_nids, |
| 14553 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14554 | .channel_mode = alc883_3ST_2ch_modes, |
| 14555 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14556 | .adc_nids = alc861_adc_nids, |
| 14557 | .input_mux = &alc861_capture_source, |
| 14558 | .unsol_event = alc861_toshiba_unsol_event, |
| 14559 | .init_hook = alc861_toshiba_automute, |
| 14560 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14561 | [ALC861_ASUS] = { |
| 14562 | .mixers = { alc861_asus_mixer }, |
| 14563 | .init_verbs = { alc861_asus_init_verbs }, |
| 14564 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14565 | .dac_nids = alc861_dac_nids, |
| 14566 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14567 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14568 | .channel_mode = alc861_asus_modes, |
| 14569 | .need_dac_fix = 1, |
| 14570 | .hp_nid = 0x06, |
| 14571 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14572 | .adc_nids = alc861_adc_nids, |
| 14573 | .input_mux = &alc861_capture_source, |
| 14574 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14575 | [ALC861_ASUS_LAPTOP] = { |
| 14576 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14577 | .init_verbs = { alc861_asus_init_verbs, |
| 14578 | alc861_asus_laptop_init_verbs }, |
| 14579 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14580 | .dac_nids = alc861_dac_nids, |
| 14581 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14582 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14583 | .channel_mode = alc883_3ST_2ch_modes, |
| 14584 | .need_dac_fix = 1, |
| 14585 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14586 | .adc_nids = alc861_adc_nids, |
| 14587 | .input_mux = &alc861_capture_source, |
| 14588 | }, |
| 14589 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14590 | |
| 14591 | |
| 14592 | static int patch_alc861(struct hda_codec *codec) |
| 14593 | { |
| 14594 | struct alc_spec *spec; |
| 14595 | int board_config; |
| 14596 | int err; |
| 14597 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14598 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14599 | if (spec == NULL) |
| 14600 | return -ENOMEM; |
| 14601 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14602 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14603 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14604 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14605 | alc861_models, |
| 14606 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14607 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14608 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 14609 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 14610 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14611 | board_config = ALC861_AUTO; |
| 14612 | } |
| 14613 | |
| 14614 | if (board_config == ALC861_AUTO) { |
| 14615 | /* automatic parse from the BIOS config */ |
| 14616 | err = alc861_parse_auto_config(codec); |
| 14617 | if (err < 0) { |
| 14618 | alc_free(codec); |
| 14619 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14620 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14621 | printk(KERN_INFO |
| 14622 | "hda_codec: Cannot set up configuration " |
| 14623 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14624 | board_config = ALC861_3ST_DIG; |
| 14625 | } |
| 14626 | } |
| 14627 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14628 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14629 | if (err < 0) { |
| 14630 | alc_free(codec); |
| 14631 | return err; |
| 14632 | } |
| 14633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14634 | if (board_config != ALC861_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 14635 | setup_preset(codec, &alc861_presets[board_config]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14636 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14637 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14638 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14639 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14640 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14641 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14642 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14643 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14644 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14645 | spec->vmaster_nid = 0x03; |
| 14646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14647 | codec->patch_ops = alc_patch_ops; |
| 14648 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14649 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14650 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14651 | if (!spec->loopback.amplist) |
| 14652 | spec->loopback.amplist = alc861_loopbacks; |
| 14653 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14654 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14655 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14656 | return 0; |
| 14657 | } |
| 14658 | |
| 14659 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14660 | * ALC861-VD support |
| 14661 | * |
| 14662 | * Based on ALC882 |
| 14663 | * |
| 14664 | * In addition, an independent DAC |
| 14665 | */ |
| 14666 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14667 | |
| 14668 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14669 | /* front, surr, clfe, side surr */ |
| 14670 | 0x02, 0x03, 0x04, 0x05 |
| 14671 | }; |
| 14672 | |
| 14673 | /* dac_nids for ALC660vd are in a different order - according to |
| 14674 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14675 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14676 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14677 | * - and it is the same as in 861vd. |
| 14678 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14679 | */ |
| 14680 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14681 | /* front, rear, clfe, rear_surr */ |
| 14682 | 0x02, 0x04, 0x03 |
| 14683 | }; |
| 14684 | |
| 14685 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14686 | /* ADC0 */ |
| 14687 | 0x09, |
| 14688 | }; |
| 14689 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14690 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14691 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14692 | /* input MUX */ |
| 14693 | /* FIXME: should be a matrix-type input source selection */ |
| 14694 | static struct hda_input_mux alc861vd_capture_source = { |
| 14695 | .num_items = 4, |
| 14696 | .items = { |
| 14697 | { "Mic", 0x0 }, |
| 14698 | { "Front Mic", 0x1 }, |
| 14699 | { "Line", 0x2 }, |
| 14700 | { "CD", 0x4 }, |
| 14701 | }, |
| 14702 | }; |
| 14703 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14704 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14705 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14706 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14707 | { "Ext Mic", 0x0 }, |
| 14708 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14709 | }, |
| 14710 | }; |
| 14711 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14712 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14713 | .num_items = 2, |
| 14714 | .items = { |
| 14715 | { "Front Mic", 0x0 }, |
| 14716 | { "ATAPI Mic", 0x1 }, |
| 14717 | }, |
| 14718 | }; |
| 14719 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14720 | /* |
| 14721 | * 2ch mode |
| 14722 | */ |
| 14723 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14724 | { 2, NULL } |
| 14725 | }; |
| 14726 | |
| 14727 | /* |
| 14728 | * 6ch mode |
| 14729 | */ |
| 14730 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14731 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14732 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14733 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14734 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14735 | { } /* end */ |
| 14736 | }; |
| 14737 | |
| 14738 | /* |
| 14739 | * 8ch mode |
| 14740 | */ |
| 14741 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14742 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14743 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14744 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14745 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14746 | { } /* end */ |
| 14747 | }; |
| 14748 | |
| 14749 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14750 | { 6, alc861vd_6stack_ch6_init }, |
| 14751 | { 8, alc861vd_6stack_ch8_init }, |
| 14752 | }; |
| 14753 | |
| 14754 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14755 | { |
| 14756 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14757 | .name = "Channel Mode", |
| 14758 | .info = alc_ch_mode_info, |
| 14759 | .get = alc_ch_mode_get, |
| 14760 | .put = alc_ch_mode_put, |
| 14761 | }, |
| 14762 | { } /* end */ |
| 14763 | }; |
| 14764 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14765 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14766 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14767 | */ |
| 14768 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14769 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14770 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14771 | |
| 14772 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14773 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14774 | |
| 14775 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14776 | HDA_OUTPUT), |
| 14777 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14778 | HDA_OUTPUT), |
| 14779 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14780 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14781 | |
| 14782 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14783 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14784 | |
| 14785 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14786 | |
| 14787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14788 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14790 | |
| 14791 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14792 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14793 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14794 | |
| 14795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14797 | |
| 14798 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14799 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14800 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14801 | { } /* end */ |
| 14802 | }; |
| 14803 | |
| 14804 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14806 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14807 | |
| 14808 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14809 | |
| 14810 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14813 | |
| 14814 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14815 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14816 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14817 | |
| 14818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14820 | |
| 14821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14823 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14824 | { } /* end */ |
| 14825 | }; |
| 14826 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14827 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14828 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14829 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14830 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14831 | |
| 14832 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14833 | |
| 14834 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14835 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14837 | |
| 14838 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14839 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14840 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14841 | |
| 14842 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14843 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14844 | |
| 14845 | { } /* end */ |
| 14846 | }; |
| 14847 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14848 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14849 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14850 | */ |
| 14851 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14852 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14853 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14854 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14855 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14856 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14857 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14858 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14859 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14860 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14861 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14862 | { } /* end */ |
| 14863 | }; |
| 14864 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14865 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14866 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14867 | */ |
| 14868 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14869 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14870 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14871 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14872 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14873 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14874 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14875 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14876 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14877 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14878 | { } /* end */ |
| 14879 | }; |
| 14880 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14881 | /* |
| 14882 | * generic initialization of ADC, input mixers and output mixers |
| 14883 | */ |
| 14884 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14885 | /* |
| 14886 | * Unmute ADC0 and set the default input to mic-in |
| 14887 | */ |
| 14888 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14889 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14890 | |
| 14891 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14892 | * the analog-loopback mixer widget |
| 14893 | */ |
| 14894 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14895 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14896 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14897 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14899 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14900 | |
| 14901 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14902 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14903 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14904 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14906 | |
| 14907 | /* |
| 14908 | * Set up output mixers (0x02 - 0x05) |
| 14909 | */ |
| 14910 | /* set vol=0 to output mixers */ |
| 14911 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14912 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14913 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14914 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14915 | |
| 14916 | /* set up input amps for analog loopback */ |
| 14917 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14919 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14924 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14926 | |
| 14927 | { } |
| 14928 | }; |
| 14929 | |
| 14930 | /* |
| 14931 | * 3-stack pin configuration: |
| 14932 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14933 | */ |
| 14934 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14935 | /* |
| 14936 | * Set pin mode and muting |
| 14937 | */ |
| 14938 | /* set front pin widgets 0x14 for output */ |
| 14939 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14940 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14941 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14942 | |
| 14943 | /* Mic (rear) pin: input vref at 80% */ |
| 14944 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14945 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14946 | /* Front Mic pin: input vref at 80% */ |
| 14947 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14949 | /* Line In pin: input */ |
| 14950 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14951 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14952 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14953 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14954 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14955 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14956 | /* CD pin widget for input */ |
| 14957 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14958 | |
| 14959 | { } |
| 14960 | }; |
| 14961 | |
| 14962 | /* |
| 14963 | * 6-stack pin configuration: |
| 14964 | */ |
| 14965 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14966 | /* |
| 14967 | * Set pin mode and muting |
| 14968 | */ |
| 14969 | /* set front pin widgets 0x14 for output */ |
| 14970 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14972 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14973 | |
| 14974 | /* Rear Pin: output 1 (0x0d) */ |
| 14975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14976 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14977 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14978 | /* CLFE Pin: output 2 (0x0e) */ |
| 14979 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14980 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14981 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14982 | /* Side Pin: output 3 (0x0f) */ |
| 14983 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14984 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14985 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14986 | |
| 14987 | /* Mic (rear) pin: input vref at 80% */ |
| 14988 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14989 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14990 | /* Front Mic pin: input vref at 80% */ |
| 14991 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14992 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14993 | /* Line In pin: input */ |
| 14994 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14995 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14996 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14997 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14998 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14999 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15000 | /* CD pin widget for input */ |
| 15001 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15002 | |
| 15003 | { } |
| 15004 | }; |
| 15005 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15006 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 15007 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15008 | { } |
| 15009 | }; |
| 15010 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15011 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 15012 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15013 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15014 | { } |
| 15015 | }; |
| 15016 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15017 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 15018 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 15021 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15022 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15023 | {} |
| 15024 | }; |
| 15025 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15026 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 15027 | { |
| 15028 | unsigned int present; |
| 15029 | unsigned char bits; |
| 15030 | |
| 15031 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 15032 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 15033 | bits = present ? HDA_AMP_MUTE : 0; |
| 15034 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 15035 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15036 | } |
| 15037 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15038 | static void alc861vd_lenovo_setup(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15039 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15040 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15041 | spec->autocfg.hp_pins[0] = 0x1b; |
| 15042 | spec->autocfg.speaker_pins[0] = 0x14; |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15043 | } |
| 15044 | |
| 15045 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
| 15046 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15047 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15048 | alc861vd_lenovo_mic_automute(codec); |
| 15049 | } |
| 15050 | |
| 15051 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 15052 | unsigned int res) |
| 15053 | { |
| 15054 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15055 | case ALC880_MIC_EVENT: |
| 15056 | alc861vd_lenovo_mic_automute(codec); |
| 15057 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15058 | default: |
| 15059 | alc_automute_amp_unsol_event(codec, res); |
| 15060 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15061 | } |
| 15062 | } |
| 15063 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15064 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 15065 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15066 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15067 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15068 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15069 | |
| 15070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15076 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15077 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15078 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15079 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15080 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15081 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15083 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15085 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15086 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15087 | |
| 15088 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15089 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15090 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 15091 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15092 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15093 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15094 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15095 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15096 | |
| 15097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15098 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15099 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 15101 | |
| 15102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15103 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15104 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15105 | |
| 15106 | { } /* end */ |
| 15107 | }; |
| 15108 | |
| 15109 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15110 | static void alc861vd_dallas_setup(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15111 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15112 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15113 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15114 | spec->autocfg.hp_pins[0] = 0x15; |
| 15115 | spec->autocfg.speaker_pins[0] = 0x14; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15116 | } |
| 15117 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15118 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15119 | #define alc861vd_loopbacks alc880_loopbacks |
| 15120 | #endif |
| 15121 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15122 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15123 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 15124 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 15125 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 15126 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 15127 | |
| 15128 | /* |
| 15129 | * configuration and preset |
| 15130 | */ |
| 15131 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 15132 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15133 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15134 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15135 | [ALC861VD_3ST] = "3stack", |
| 15136 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 15137 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15138 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15139 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 15140 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15141 | [ALC861VD_AUTO] = "auto", |
| 15142 | }; |
| 15143 | |
| 15144 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15145 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15146 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 15147 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15148 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15149 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15150 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15151 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 15152 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 15153 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Takashi Iwai | ce577e8 | 2009-08-03 08:23:52 +0200 | [diff] [blame] | 15154 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 15155 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 15156 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 15157 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 15158 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 15159 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15160 | {} |
| 15161 | }; |
| 15162 | |
| 15163 | static struct alc_config_preset alc861vd_presets[] = { |
| 15164 | [ALC660VD_3ST] = { |
| 15165 | .mixers = { alc861vd_3st_mixer }, |
| 15166 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15167 | alc861vd_3stack_init_verbs }, |
| 15168 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15169 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15170 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15171 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15172 | .input_mux = &alc861vd_capture_source, |
| 15173 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15174 | [ALC660VD_3ST_DIG] = { |
| 15175 | .mixers = { alc861vd_3st_mixer }, |
| 15176 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15177 | alc861vd_3stack_init_verbs }, |
| 15178 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15179 | .dac_nids = alc660vd_dac_nids, |
| 15180 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15181 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15182 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15183 | .input_mux = &alc861vd_capture_source, |
| 15184 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15185 | [ALC861VD_3ST] = { |
| 15186 | .mixers = { alc861vd_3st_mixer }, |
| 15187 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15188 | alc861vd_3stack_init_verbs }, |
| 15189 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15190 | .dac_nids = alc861vd_dac_nids, |
| 15191 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15192 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15193 | .input_mux = &alc861vd_capture_source, |
| 15194 | }, |
| 15195 | [ALC861VD_3ST_DIG] = { |
| 15196 | .mixers = { alc861vd_3st_mixer }, |
| 15197 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15198 | alc861vd_3stack_init_verbs }, |
| 15199 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15200 | .dac_nids = alc861vd_dac_nids, |
| 15201 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15202 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15203 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15204 | .input_mux = &alc861vd_capture_source, |
| 15205 | }, |
| 15206 | [ALC861VD_6ST_DIG] = { |
| 15207 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15208 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15209 | alc861vd_6stack_init_verbs }, |
| 15210 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15211 | .dac_nids = alc861vd_dac_nids, |
| 15212 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15213 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15214 | .channel_mode = alc861vd_6stack_modes, |
| 15215 | .input_mux = &alc861vd_capture_source, |
| 15216 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15217 | [ALC861VD_LENOVO] = { |
| 15218 | .mixers = { alc861vd_lenovo_mixer }, |
| 15219 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15220 | alc861vd_3stack_init_verbs, |
| 15221 | alc861vd_eapd_verbs, |
| 15222 | alc861vd_lenovo_unsol_verbs }, |
| 15223 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15224 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15225 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15226 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15227 | .input_mux = &alc861vd_capture_source, |
| 15228 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15229 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15230 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15231 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15232 | [ALC861VD_DALLAS] = { |
| 15233 | .mixers = { alc861vd_dallas_mixer }, |
| 15234 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15235 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15236 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15237 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15238 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15239 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15240 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15241 | .setup = alc861vd_dallas_setup, |
| 15242 | .init_hook = alc_automute_amp, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15243 | }, |
| 15244 | [ALC861VD_HP] = { |
| 15245 | .mixers = { alc861vd_hp_mixer }, |
| 15246 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15247 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15248 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15249 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15250 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15251 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15252 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15253 | .unsol_event = alc_automute_amp_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15254 | .setup = alc861vd_dallas_setup, |
| 15255 | .init_hook = alc_automute_amp, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15256 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15257 | [ALC660VD_ASUS_V1S] = { |
| 15258 | .mixers = { alc861vd_lenovo_mixer }, |
| 15259 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15260 | alc861vd_3stack_init_verbs, |
| 15261 | alc861vd_eapd_verbs, |
| 15262 | alc861vd_lenovo_unsol_verbs }, |
| 15263 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15264 | .dac_nids = alc660vd_dac_nids, |
| 15265 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15266 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15267 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15268 | .input_mux = &alc861vd_capture_source, |
| 15269 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15270 | .setup = alc861vd_lenovo_setup, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15271 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15272 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15273 | }; |
| 15274 | |
| 15275 | /* |
| 15276 | * BIOS auto configuration |
| 15277 | */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15278 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
| 15279 | const struct auto_pin_cfg *cfg) |
| 15280 | { |
| 15281 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
| 15282 | } |
| 15283 | |
| 15284 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15285 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15286 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15287 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15288 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15289 | } |
| 15290 | |
| 15291 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15292 | { |
| 15293 | struct alc_spec *spec = codec->spec; |
| 15294 | int i; |
| 15295 | |
| 15296 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15297 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15298 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15299 | if (nid) |
| 15300 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15301 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15302 | } |
| 15303 | } |
| 15304 | |
| 15305 | |
| 15306 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15307 | { |
| 15308 | struct alc_spec *spec = codec->spec; |
| 15309 | hda_nid_t pin; |
| 15310 | |
| 15311 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15312 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15313 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15314 | pin = spec->autocfg.speaker_pins[0]; |
| 15315 | if (pin) |
| 15316 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15317 | } |
| 15318 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15319 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15320 | |
| 15321 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15322 | { |
| 15323 | struct alc_spec *spec = codec->spec; |
| 15324 | int i; |
| 15325 | |
| 15326 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15327 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15328 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15329 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15330 | if (nid != ALC861VD_PIN_CD_NID && |
| 15331 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | snd_hda_codec_write(codec, nid, 0, |
| 15333 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15334 | AMP_OUT_MUTE); |
| 15335 | } |
| 15336 | } |
| 15337 | } |
| 15338 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15339 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15340 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15341 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15342 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15343 | |
| 15344 | /* add playback controls from the parsed DAC table */ |
| 15345 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15346 | * different NIDs for mute/unmute switch and volume control */ |
| 15347 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15348 | const struct auto_pin_cfg *cfg) |
| 15349 | { |
| 15350 | char name[32]; |
| 15351 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15352 | hda_nid_t nid_v, nid_s; |
| 15353 | int i, err; |
| 15354 | |
| 15355 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15356 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15357 | continue; |
| 15358 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15359 | alc880_dac_to_idx( |
| 15360 | spec->multiout.dac_nids[i])); |
| 15361 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15362 | alc880_dac_to_idx( |
| 15363 | spec->multiout.dac_nids[i])); |
| 15364 | |
| 15365 | if (i == 2) { |
| 15366 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15367 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15368 | "Center Playback Volume", |
| 15369 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15370 | HDA_OUTPUT)); |
| 15371 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15372 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15373 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15374 | "LFE Playback Volume", |
| 15375 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15376 | HDA_OUTPUT)); |
| 15377 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15378 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15379 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15380 | "Center Playback Switch", |
| 15381 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15382 | HDA_INPUT)); |
| 15383 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15384 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15385 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15386 | "LFE Playback Switch", |
| 15387 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15388 | HDA_INPUT)); |
| 15389 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15390 | return err; |
| 15391 | } else { |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15392 | const char *pfx; |
| 15393 | if (cfg->line_outs == 1 && |
| 15394 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 15395 | if (!cfg->hp_pins) |
| 15396 | pfx = "Speaker"; |
| 15397 | else |
| 15398 | pfx = "PCM"; |
| 15399 | } else |
| 15400 | pfx = chname[i]; |
| 15401 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15402 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15403 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15404 | HDA_OUTPUT)); |
| 15405 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15406 | return err; |
Takashi Iwai | a4fcd49 | 2009-08-25 16:12:15 +0200 | [diff] [blame] | 15407 | if (cfg->line_outs == 1 && |
| 15408 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 15409 | pfx = "Speaker"; |
| 15410 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15411 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15412 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15413 | HDA_INPUT)); |
| 15414 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15415 | return err; |
| 15416 | } |
| 15417 | } |
| 15418 | return 0; |
| 15419 | } |
| 15420 | |
| 15421 | /* add playback controls for speaker and HP outputs */ |
| 15422 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15423 | * different NIDs for mute/unmute switch and volume control */ |
| 15424 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15425 | hda_nid_t pin, const char *pfx) |
| 15426 | { |
| 15427 | hda_nid_t nid_v, nid_s; |
| 15428 | int err; |
| 15429 | char name[32]; |
| 15430 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15431 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15432 | return 0; |
| 15433 | |
| 15434 | if (alc880_is_fixed_pin(pin)) { |
| 15435 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15436 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15437 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15438 | spec->multiout.hp_nid = nid_v; |
| 15439 | else |
| 15440 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15441 | /* control HP volume/switch on the output mixer amp */ |
| 15442 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15443 | alc880_fixed_pin_idx(pin)); |
| 15444 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15445 | alc880_fixed_pin_idx(pin)); |
| 15446 | |
| 15447 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15448 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15449 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15450 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15451 | return err; |
| 15452 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15453 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15454 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15455 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15456 | return err; |
| 15457 | } else if (alc880_is_multi_pin(pin)) { |
| 15458 | /* set manual connection */ |
| 15459 | /* we have only a switch on HP-out PIN */ |
| 15460 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15461 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15462 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15463 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15464 | return err; |
| 15465 | } |
| 15466 | return 0; |
| 15467 | } |
| 15468 | |
| 15469 | /* parse the BIOS configuration and set up the alc_spec |
| 15470 | * return 1 if successful, 0 if the proper config is not found, |
| 15471 | * or a negative error code |
| 15472 | * Based on ALC880 version - had to change it to override |
| 15473 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15474 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15475 | { |
| 15476 | struct alc_spec *spec = codec->spec; |
| 15477 | int err; |
| 15478 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15479 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15480 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15481 | alc861vd_ignore); |
| 15482 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15483 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15484 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15485 | return 0; /* can't find valid BIOS pin config */ |
| 15486 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15487 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15488 | if (err < 0) |
| 15489 | return err; |
| 15490 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15491 | if (err < 0) |
| 15492 | return err; |
| 15493 | err = alc861vd_auto_create_extra_out(spec, |
| 15494 | spec->autocfg.speaker_pins[0], |
| 15495 | "Speaker"); |
| 15496 | if (err < 0) |
| 15497 | return err; |
| 15498 | err = alc861vd_auto_create_extra_out(spec, |
| 15499 | spec->autocfg.hp_pins[0], |
| 15500 | "Headphone"); |
| 15501 | if (err < 0) |
| 15502 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 15503 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15504 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15505 | return err; |
| 15506 | |
| 15507 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15508 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15509 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15510 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15511 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15512 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15513 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15514 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15515 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15516 | |
| 15517 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15518 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15519 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15520 | err = alc_auto_add_mic_boost(codec); |
| 15521 | if (err < 0) |
| 15522 | return err; |
| 15523 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15524 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15525 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15526 | return 1; |
| 15527 | } |
| 15528 | |
| 15529 | /* additional initialization for auto-configuration model */ |
| 15530 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15531 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15532 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15533 | alc861vd_auto_init_multi_out(codec); |
| 15534 | alc861vd_auto_init_hp_out(codec); |
| 15535 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15536 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15537 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15538 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15539 | } |
| 15540 | |
| 15541 | static int patch_alc861vd(struct hda_codec *codec) |
| 15542 | { |
| 15543 | struct alc_spec *spec; |
| 15544 | int err, board_config; |
| 15545 | |
| 15546 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15547 | if (spec == NULL) |
| 15548 | return -ENOMEM; |
| 15549 | |
| 15550 | codec->spec = spec; |
| 15551 | |
| 15552 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15553 | alc861vd_models, |
| 15554 | alc861vd_cfg_tbl); |
| 15555 | |
| 15556 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 15557 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 15558 | codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15559 | board_config = ALC861VD_AUTO; |
| 15560 | } |
| 15561 | |
| 15562 | if (board_config == ALC861VD_AUTO) { |
| 15563 | /* automatic parse from the BIOS config */ |
| 15564 | err = alc861vd_parse_auto_config(codec); |
| 15565 | if (err < 0) { |
| 15566 | alc_free(codec); |
| 15567 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15568 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15569 | printk(KERN_INFO |
| 15570 | "hda_codec: Cannot set up configuration " |
| 15571 | "from BIOS. Using base mode...\n"); |
| 15572 | board_config = ALC861VD_3ST; |
| 15573 | } |
| 15574 | } |
| 15575 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15576 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15577 | if (err < 0) { |
| 15578 | alc_free(codec); |
| 15579 | return err; |
| 15580 | } |
| 15581 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15582 | if (board_config != ALC861VD_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 15583 | setup_preset(codec, &alc861vd_presets[board_config]); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15584 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15585 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15586 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15587 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15588 | } |
| 15589 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15590 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15591 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15592 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15593 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15594 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15595 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 15596 | if (!spec->adc_nids) { |
| 15597 | spec->adc_nids = alc861vd_adc_nids; |
| 15598 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 15599 | } |
| 15600 | if (!spec->capsrc_nids) |
| 15601 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15602 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15603 | set_capture_mixer(codec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15604 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15605 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15606 | spec->vmaster_nid = 0x02; |
| 15607 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15608 | codec->patch_ops = alc_patch_ops; |
| 15609 | |
| 15610 | if (board_config == ALC861VD_AUTO) |
| 15611 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15612 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15613 | if (!spec->loopback.amplist) |
| 15614 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15615 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15616 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15617 | |
| 15618 | return 0; |
| 15619 | } |
| 15620 | |
| 15621 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15622 | * ALC662 support |
| 15623 | * |
| 15624 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15625 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15626 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15627 | * 6-channel independent captures. |
| 15628 | * |
| 15629 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15630 | * driver yet). |
| 15631 | */ |
| 15632 | #define ALC662_DIGOUT_NID 0x06 |
| 15633 | #define ALC662_DIGIN_NID 0x0a |
| 15634 | |
| 15635 | static hda_nid_t alc662_dac_nids[4] = { |
| 15636 | /* front, rear, clfe, rear_surr */ |
| 15637 | 0x02, 0x03, 0x04 |
| 15638 | }; |
| 15639 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15640 | static hda_nid_t alc272_dac_nids[2] = { |
| 15641 | 0x02, 0x03 |
| 15642 | }; |
| 15643 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15644 | static hda_nid_t alc662_adc_nids[2] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15645 | /* ADC1-2 */ |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15646 | 0x09, 0x08 |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15647 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15648 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15649 | static hda_nid_t alc272_adc_nids[1] = { |
| 15650 | /* ADC1-2 */ |
| 15651 | 0x08, |
| 15652 | }; |
| 15653 | |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 15654 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15655 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15656 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15657 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15658 | /* input MUX */ |
| 15659 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15660 | static struct hda_input_mux alc662_capture_source = { |
| 15661 | .num_items = 4, |
| 15662 | .items = { |
| 15663 | { "Mic", 0x0 }, |
| 15664 | { "Front Mic", 0x1 }, |
| 15665 | { "Line", 0x2 }, |
| 15666 | { "CD", 0x4 }, |
| 15667 | }, |
| 15668 | }; |
| 15669 | |
| 15670 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15671 | .num_items = 2, |
| 15672 | .items = { |
| 15673 | { "Mic", 0x1 }, |
| 15674 | { "Line", 0x2 }, |
| 15675 | }, |
| 15676 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15677 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15678 | static struct hda_input_mux alc663_capture_source = { |
| 15679 | .num_items = 3, |
| 15680 | .items = { |
| 15681 | { "Mic", 0x0 }, |
| 15682 | { "Front Mic", 0x1 }, |
| 15683 | { "Line", 0x2 }, |
| 15684 | }, |
| 15685 | }; |
| 15686 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 15687 | #if 0 /* set to 1 for testing other input sources below */ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15688 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15689 | .num_items = 16, |
| 15690 | .items = { |
| 15691 | { "Autoselect Mic", 0x0 }, |
| 15692 | { "Internal Mic", 0x1 }, |
| 15693 | { "In-0x02", 0x2 }, |
| 15694 | { "In-0x03", 0x3 }, |
| 15695 | { "In-0x04", 0x4 }, |
| 15696 | { "In-0x05", 0x5 }, |
| 15697 | { "In-0x06", 0x6 }, |
| 15698 | { "In-0x07", 0x7 }, |
| 15699 | { "In-0x08", 0x8 }, |
| 15700 | { "In-0x09", 0x9 }, |
| 15701 | { "In-0x0a", 0x0a }, |
| 15702 | { "In-0x0b", 0x0b }, |
| 15703 | { "In-0x0c", 0x0c }, |
| 15704 | { "In-0x0d", 0x0d }, |
| 15705 | { "In-0x0e", 0x0e }, |
| 15706 | { "In-0x0f", 0x0f }, |
| 15707 | }, |
| 15708 | }; |
| 15709 | #endif |
| 15710 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15711 | /* |
| 15712 | * 2ch mode |
| 15713 | */ |
| 15714 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15715 | { 2, NULL } |
| 15716 | }; |
| 15717 | |
| 15718 | /* |
| 15719 | * 2ch mode |
| 15720 | */ |
| 15721 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15722 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15723 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15724 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15725 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15726 | { } /* end */ |
| 15727 | }; |
| 15728 | |
| 15729 | /* |
| 15730 | * 6ch mode |
| 15731 | */ |
| 15732 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15733 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15734 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15735 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15736 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15737 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15738 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15739 | { } /* end */ |
| 15740 | }; |
| 15741 | |
| 15742 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15743 | { 2, alc662_3ST_ch2_init }, |
| 15744 | { 6, alc662_3ST_ch6_init }, |
| 15745 | }; |
| 15746 | |
| 15747 | /* |
| 15748 | * 2ch mode |
| 15749 | */ |
| 15750 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15751 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15752 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15753 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15754 | { } /* end */ |
| 15755 | }; |
| 15756 | |
| 15757 | /* |
| 15758 | * 6ch mode |
| 15759 | */ |
| 15760 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15761 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15762 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15763 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15764 | { } /* end */ |
| 15765 | }; |
| 15766 | |
| 15767 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15768 | { 2, alc662_sixstack_ch6_init }, |
| 15769 | { 6, alc662_sixstack_ch8_init }, |
| 15770 | }; |
| 15771 | |
| 15772 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15773 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15774 | */ |
| 15775 | |
| 15776 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15777 | /* output mixer control */ |
| 15778 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15779 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15780 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15781 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15782 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15783 | 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] | 15784 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15785 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15787 | |
| 15788 | /*Input mixer control */ |
| 15789 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15790 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15791 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15792 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15794 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15795 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15796 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15797 | { } /* end */ |
| 15798 | }; |
| 15799 | |
| 15800 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15801 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15802 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15803 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15806 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15807 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15808 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15809 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15810 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15811 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15812 | { } /* end */ |
| 15813 | }; |
| 15814 | |
| 15815 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15817 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15818 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15819 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15820 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15821 | 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] | 15822 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15823 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15824 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15825 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15826 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15827 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15828 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15829 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15830 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15831 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15832 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15833 | { } /* end */ |
| 15834 | }; |
| 15835 | |
| 15836 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15837 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15838 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15839 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15840 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15841 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15842 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15843 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15844 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15845 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15846 | { } /* end */ |
| 15847 | }; |
| 15848 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15849 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15850 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15851 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15852 | |
| 15853 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15854 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15855 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15856 | |
| 15857 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15858 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15859 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15860 | { } /* end */ |
| 15861 | }; |
| 15862 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15863 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15864 | ALC262_HIPPO_MASTER_SWITCH, |
| 15865 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15866 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15867 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15868 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15869 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15873 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15874 | { } /* end */ |
| 15875 | }; |
| 15876 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15877 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15878 | .ops = &snd_hda_bind_vol, |
| 15879 | .values = { |
| 15880 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15881 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15882 | 0 |
| 15883 | }, |
| 15884 | }; |
| 15885 | |
| 15886 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15887 | .ops = &snd_hda_bind_sw, |
| 15888 | .values = { |
| 15889 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15890 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15891 | 0 |
| 15892 | }, |
| 15893 | }; |
| 15894 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15895 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15896 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15897 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15899 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15900 | { } /* end */ |
| 15901 | }; |
| 15902 | |
| 15903 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15904 | .ops = &snd_hda_bind_sw, |
| 15905 | .values = { |
| 15906 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15907 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15908 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15909 | 0 |
| 15910 | }, |
| 15911 | }; |
| 15912 | |
| 15913 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15914 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15915 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15918 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15919 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15920 | |
| 15921 | { } /* end */ |
| 15922 | }; |
| 15923 | |
| 15924 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15925 | .ops = &snd_hda_bind_sw, |
| 15926 | .values = { |
| 15927 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15928 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15929 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15930 | 0 |
| 15931 | }, |
| 15932 | }; |
| 15933 | |
| 15934 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15935 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15936 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15939 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15940 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15941 | { } /* end */ |
| 15942 | }; |
| 15943 | |
| 15944 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15945 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15946 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15947 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15948 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15949 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15950 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15951 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15952 | { } /* end */ |
| 15953 | }; |
| 15954 | |
| 15955 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15956 | .ops = &snd_hda_bind_vol, |
| 15957 | .values = { |
| 15958 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15959 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15960 | 0 |
| 15961 | }, |
| 15962 | }; |
| 15963 | |
| 15964 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15965 | .ops = &snd_hda_bind_sw, |
| 15966 | .values = { |
| 15967 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15968 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15969 | 0 |
| 15970 | }, |
| 15971 | }; |
| 15972 | |
| 15973 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15974 | HDA_BIND_VOL("Master Playback Volume", |
| 15975 | &alc663_asus_two_bind_master_vol), |
| 15976 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15977 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15979 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15980 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15981 | { } /* end */ |
| 15982 | }; |
| 15983 | |
| 15984 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15985 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15986 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15987 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15988 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15991 | { } /* end */ |
| 15992 | }; |
| 15993 | |
| 15994 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15995 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15996 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15997 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15998 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15999 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16000 | |
| 16001 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16002 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16003 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16004 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16005 | { } /* end */ |
| 16006 | }; |
| 16007 | |
| 16008 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 16009 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16010 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16011 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16012 | |
| 16013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16015 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16016 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 16018 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 16019 | { } /* end */ |
| 16020 | }; |
| 16021 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16022 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 16023 | { |
| 16024 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 16025 | .name = "Channel Mode", |
| 16026 | .info = alc_ch_mode_info, |
| 16027 | .get = alc_ch_mode_get, |
| 16028 | .put = alc_ch_mode_put, |
| 16029 | }, |
| 16030 | { } /* end */ |
| 16031 | }; |
| 16032 | |
| 16033 | static struct hda_verb alc662_init_verbs[] = { |
| 16034 | /* ADC: mute amp left and right */ |
| 16035 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16036 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16037 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 16038 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16041 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16042 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16044 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16047 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16048 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16049 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16050 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16051 | |
| 16052 | /* Front Pin: output 0 (0x0c) */ |
| 16053 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16054 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16055 | |
| 16056 | /* Rear Pin: output 1 (0x0d) */ |
| 16057 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16058 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16059 | |
| 16060 | /* CLFE Pin: output 2 (0x0e) */ |
| 16061 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16062 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16063 | |
| 16064 | /* Mic (rear) pin: input vref at 80% */ |
| 16065 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16066 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16067 | /* Front Mic pin: input vref at 80% */ |
| 16068 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 16069 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16070 | /* Line In pin: input */ |
| 16071 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16072 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 16073 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 16074 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16075 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16076 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16077 | /* CD pin widget for input */ |
| 16078 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16079 | |
| 16080 | /* FIXME: use matrix-type input source selection */ |
| 16081 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16082 | /* Input mixer */ |
| 16083 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16084 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16085 | |
| 16086 | /* always trun on EAPD */ |
| 16087 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16088 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 16089 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16090 | { } |
| 16091 | }; |
| 16092 | |
| 16093 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 16094 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16095 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16096 | {} |
| 16097 | }; |
| 16098 | |
| 16099 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 16100 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16101 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16102 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16103 | }; |
| 16104 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16105 | /* Set Unsolicited Event*/ |
| 16106 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 16107 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 16108 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16109 | {} |
| 16110 | }; |
| 16111 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16112 | /* |
| 16113 | * generic initialization of ADC, input mixers and output mixers |
| 16114 | */ |
| 16115 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 16116 | /* |
| 16117 | * Unmute ADC and set the default input to mic-in |
| 16118 | */ |
| 16119 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 16120 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16121 | |
| 16122 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 16123 | * mixer widget |
| 16124 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 16125 | * panel mic (mic 2) |
| 16126 | */ |
| 16127 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16128 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 16130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 16131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 16132 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16133 | |
| 16134 | /* |
| 16135 | * Set up output mixers (0x0c - 0x0f) |
| 16136 | */ |
| 16137 | /* set vol=0 to output mixers */ |
| 16138 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16139 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16140 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 16141 | |
| 16142 | /* set up input amps for analog loopback */ |
| 16143 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16145 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16146 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16147 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16148 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16149 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16150 | |
| 16151 | |
| 16152 | /* FIXME: use matrix-type input source selection */ |
| 16153 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 16154 | /* Input mixer */ |
| 16155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 16156 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16157 | { } |
| 16158 | }; |
| 16159 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 16160 | /* additional verbs for ALC663 */ |
| 16161 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16163 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16164 | { } |
| 16165 | }; |
| 16166 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16167 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16169 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16170 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16171 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16172 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16173 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16174 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16175 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16176 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16177 | {} |
| 16178 | }; |
| 16179 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16180 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16181 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16182 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16183 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16184 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16185 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16186 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16187 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16188 | {} |
| 16189 | }; |
| 16190 | |
| 16191 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16192 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16193 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16194 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16195 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16196 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16197 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16198 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16199 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16200 | {} |
| 16201 | }; |
| 16202 | |
| 16203 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16204 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16205 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16206 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16207 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16209 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16210 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16211 | {} |
| 16212 | }; |
| 16213 | |
| 16214 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16215 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16216 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16217 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16218 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16220 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16221 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16222 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16223 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16224 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16225 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16227 | {} |
| 16228 | }; |
| 16229 | |
| 16230 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16231 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16233 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16234 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16236 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16237 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16238 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16239 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16240 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16241 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16242 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16243 | {} |
| 16244 | }; |
| 16245 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16246 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16247 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16248 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16249 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16250 | |
| 16251 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16252 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16253 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16254 | |
| 16255 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16256 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16257 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16258 | {} |
| 16259 | }; |
| 16260 | |
| 16261 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16262 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16263 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16264 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16265 | |
| 16266 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16267 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16268 | {} |
| 16269 | }; |
| 16270 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16271 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16274 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16275 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16276 | {} |
| 16277 | }; |
| 16278 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16279 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16280 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16281 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16282 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16283 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16284 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16285 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16286 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16287 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16289 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16290 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16291 | {} |
| 16292 | }; |
| 16293 | |
| 16294 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16295 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16296 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16298 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16299 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16300 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16301 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16302 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16303 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16304 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16305 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16306 | {} |
| 16307 | }; |
| 16308 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16309 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16310 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16311 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16312 | { } /* end */ |
| 16313 | }; |
| 16314 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16315 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16316 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16317 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16318 | { } /* end */ |
| 16319 | }; |
| 16320 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16321 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16322 | { |
| 16323 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16324 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16325 | |
| 16326 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16327 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16328 | bits = present ? HDA_AMP_MUTE : 0; |
| 16329 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16330 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16331 | } |
| 16332 | |
| 16333 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16334 | { |
| 16335 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16336 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16337 | |
| 16338 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16339 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16340 | bits = present ? HDA_AMP_MUTE : 0; |
| 16341 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16342 | HDA_AMP_MUTE, bits); |
| 16343 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16344 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16345 | } |
| 16346 | |
| 16347 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16348 | unsigned int res) |
| 16349 | { |
| 16350 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16351 | alc662_lenovo_101e_all_automute(codec); |
| 16352 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16353 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16354 | } |
| 16355 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16356 | /* unsolicited event for HP jack sensing */ |
| 16357 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16358 | unsigned int res) |
| 16359 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16360 | if ((res >> 26) == ALC880_MIC_EVENT) |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16361 | alc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16362 | else |
| 16363 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16364 | } |
| 16365 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16366 | static void alc662_eeepc_setup(struct hda_codec *codec) |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16367 | { |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16368 | struct alc_spec *spec = codec->spec; |
| 16369 | |
| 16370 | alc262_hippo1_setup(codec); |
| 16371 | spec->ext_mic.pin = 0x18; |
| 16372 | spec->ext_mic.mux_idx = 0; |
| 16373 | spec->int_mic.pin = 0x19; |
| 16374 | spec->int_mic.mux_idx = 1; |
| 16375 | spec->auto_mic = 1; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16376 | } |
| 16377 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16378 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16379 | { |
| 16380 | alc262_hippo_automute(codec); |
| 16381 | alc_mic_automute(codec); |
| 16382 | } |
| 16383 | |
| 16384 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16385 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16386 | struct alc_spec *spec = codec->spec; |
| 16387 | |
| 16388 | spec->autocfg.hp_pins[0] = 0x14; |
| 16389 | spec->autocfg.speaker_pins[0] = 0x1b; |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16390 | } |
| 16391 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16392 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update |
| 16393 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16394 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16395 | { |
| 16396 | unsigned int present; |
| 16397 | unsigned char bits; |
| 16398 | |
| 16399 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16400 | AC_VERB_GET_PIN_SENSE, 0) |
| 16401 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16402 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16403 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16404 | AMP_IN_MUTE(0), bits); |
| 16405 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16406 | AMP_IN_MUTE(0), bits); |
| 16407 | } |
| 16408 | |
| 16409 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16410 | { |
| 16411 | unsigned int present; |
| 16412 | unsigned char bits; |
| 16413 | |
| 16414 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16415 | AC_VERB_GET_PIN_SENSE, 0) |
| 16416 | & AC_PINSENSE_PRESENCE; |
| 16417 | bits = present ? HDA_AMP_MUTE : 0; |
| 16418 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16419 | AMP_IN_MUTE(0), bits); |
| 16420 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16421 | AMP_IN_MUTE(0), bits); |
| 16422 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16423 | AMP_IN_MUTE(0), bits); |
| 16424 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16425 | AMP_IN_MUTE(0), bits); |
| 16426 | } |
| 16427 | |
| 16428 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16429 | { |
| 16430 | unsigned int present; |
| 16431 | unsigned char bits; |
| 16432 | |
| 16433 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16434 | AC_VERB_GET_PIN_SENSE, 0) |
| 16435 | & AC_PINSENSE_PRESENCE; |
| 16436 | bits = present ? HDA_AMP_MUTE : 0; |
| 16437 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16438 | AMP_IN_MUTE(0), bits); |
| 16439 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16440 | AMP_IN_MUTE(0), bits); |
| 16441 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16442 | AMP_IN_MUTE(0), bits); |
| 16443 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16444 | AMP_IN_MUTE(0), bits); |
| 16445 | } |
| 16446 | |
| 16447 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16448 | { |
| 16449 | unsigned int present; |
| 16450 | unsigned char bits; |
| 16451 | |
| 16452 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16453 | AC_VERB_GET_PIN_SENSE, 0) |
| 16454 | & AC_PINSENSE_PRESENCE; |
| 16455 | bits = present ? 0 : PIN_OUT; |
| 16456 | snd_hda_codec_write(codec, 0x14, 0, |
| 16457 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16458 | } |
| 16459 | |
| 16460 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16461 | { |
| 16462 | unsigned int present1, present2; |
| 16463 | |
| 16464 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16465 | AC_VERB_GET_PIN_SENSE, 0) |
| 16466 | & AC_PINSENSE_PRESENCE; |
| 16467 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16468 | AC_VERB_GET_PIN_SENSE, 0) |
| 16469 | & AC_PINSENSE_PRESENCE; |
| 16470 | |
| 16471 | if (present1 || present2) { |
| 16472 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16473 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16474 | } else { |
| 16475 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16476 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16477 | } |
| 16478 | } |
| 16479 | |
| 16480 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16481 | { |
| 16482 | unsigned int present1, present2; |
| 16483 | |
| 16484 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16485 | AC_VERB_GET_PIN_SENSE, 0) |
| 16486 | & AC_PINSENSE_PRESENCE; |
| 16487 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16488 | AC_VERB_GET_PIN_SENSE, 0) |
| 16489 | & AC_PINSENSE_PRESENCE; |
| 16490 | |
| 16491 | if (present1 || present2) { |
| 16492 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16493 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16494 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16495 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16496 | } else { |
| 16497 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16498 | AMP_IN_MUTE(0), 0); |
| 16499 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16500 | AMP_IN_MUTE(0), 0); |
| 16501 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16502 | } |
| 16503 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16504 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16505 | unsigned int res) |
| 16506 | { |
| 16507 | switch (res >> 26) { |
| 16508 | case ALC880_HP_EVENT: |
| 16509 | alc663_m51va_speaker_automute(codec); |
| 16510 | break; |
| 16511 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16512 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16513 | break; |
| 16514 | } |
| 16515 | } |
| 16516 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16517 | static void alc663_m51va_setup(struct hda_codec *codec) |
| 16518 | { |
| 16519 | struct alc_spec *spec = codec->spec; |
| 16520 | spec->ext_mic.pin = 0x18; |
| 16521 | spec->ext_mic.mux_idx = 0; |
| 16522 | spec->int_mic.pin = 0x12; |
| 16523 | spec->int_mic.mux_idx = 1; |
| 16524 | spec->auto_mic = 1; |
| 16525 | } |
| 16526 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16527 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16528 | { |
| 16529 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16530 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16531 | } |
| 16532 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16533 | /* ***************** Mode1 ******************************/ |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16534 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
| 16535 | #define alc663_mode1_setup alc663_m51va_setup |
| 16536 | #define alc663_mode1_inithook alc663_m51va_inithook |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16537 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16538 | /* ***************** Mode2 ******************************/ |
| 16539 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16540 | unsigned int res) |
| 16541 | { |
| 16542 | switch (res >> 26) { |
| 16543 | case ALC880_HP_EVENT: |
| 16544 | alc662_f5z_speaker_automute(codec); |
| 16545 | break; |
| 16546 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16547 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16548 | break; |
| 16549 | } |
| 16550 | } |
| 16551 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16552 | #define alc662_mode2_setup alc663_m51va_setup |
| 16553 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16554 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16555 | { |
| 16556 | alc662_f5z_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16557 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16558 | } |
| 16559 | /* ***************** Mode3 ******************************/ |
| 16560 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16561 | unsigned int res) |
| 16562 | { |
| 16563 | switch (res >> 26) { |
| 16564 | case ALC880_HP_EVENT: |
| 16565 | alc663_two_hp_m1_speaker_automute(codec); |
| 16566 | break; |
| 16567 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16568 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16569 | break; |
| 16570 | } |
| 16571 | } |
| 16572 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16573 | #define alc663_mode3_setup alc663_m51va_setup |
| 16574 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16575 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16576 | { |
| 16577 | alc663_two_hp_m1_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16578 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16579 | } |
| 16580 | /* ***************** Mode4 ******************************/ |
| 16581 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16582 | unsigned int res) |
| 16583 | { |
| 16584 | switch (res >> 26) { |
| 16585 | case ALC880_HP_EVENT: |
| 16586 | alc663_21jd_two_speaker_automute(codec); |
| 16587 | break; |
| 16588 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16589 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16590 | break; |
| 16591 | } |
| 16592 | } |
| 16593 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16594 | #define alc663_mode4_setup alc663_m51va_setup |
| 16595 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16596 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16597 | { |
| 16598 | alc663_21jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16599 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16600 | } |
| 16601 | /* ***************** Mode5 ******************************/ |
| 16602 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16603 | unsigned int res) |
| 16604 | { |
| 16605 | switch (res >> 26) { |
| 16606 | case ALC880_HP_EVENT: |
| 16607 | alc663_15jd_two_speaker_automute(codec); |
| 16608 | break; |
| 16609 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16610 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16611 | break; |
| 16612 | } |
| 16613 | } |
| 16614 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16615 | #define alc663_mode5_setup alc663_m51va_setup |
| 16616 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16617 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16618 | { |
| 16619 | alc663_15jd_two_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16620 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16621 | } |
| 16622 | /* ***************** Mode6 ******************************/ |
| 16623 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16624 | unsigned int res) |
| 16625 | { |
| 16626 | switch (res >> 26) { |
| 16627 | case ALC880_HP_EVENT: |
| 16628 | alc663_two_hp_m2_speaker_automute(codec); |
| 16629 | break; |
| 16630 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16631 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16632 | break; |
| 16633 | } |
| 16634 | } |
| 16635 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16636 | #define alc663_mode6_setup alc663_m51va_setup |
| 16637 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16638 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16639 | { |
| 16640 | alc663_two_hp_m2_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16641 | alc_mic_automute(codec); |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16642 | } |
| 16643 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16644 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16645 | { |
| 16646 | unsigned int present; |
| 16647 | unsigned char bits; |
| 16648 | |
| 16649 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16650 | AC_VERB_GET_PIN_SENSE, 0) |
| 16651 | & AC_PINSENSE_PRESENCE; |
| 16652 | bits = present ? HDA_AMP_MUTE : 0; |
| 16653 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16654 | HDA_AMP_MUTE, bits); |
| 16655 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16656 | HDA_AMP_MUTE, bits); |
| 16657 | } |
| 16658 | |
| 16659 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16660 | { |
| 16661 | unsigned int present; |
| 16662 | unsigned char bits; |
| 16663 | |
| 16664 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16665 | AC_VERB_GET_PIN_SENSE, 0) |
| 16666 | & AC_PINSENSE_PRESENCE; |
| 16667 | bits = present ? HDA_AMP_MUTE : 0; |
| 16668 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16669 | HDA_AMP_MUTE, bits); |
| 16670 | } |
| 16671 | |
| 16672 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16673 | unsigned int res) |
| 16674 | { |
| 16675 | switch (res >> 26) { |
| 16676 | case ALC880_HP_EVENT: |
| 16677 | alc663_g71v_hp_automute(codec); |
| 16678 | break; |
| 16679 | case ALC880_FRONT_EVENT: |
| 16680 | alc663_g71v_front_automute(codec); |
| 16681 | break; |
| 16682 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16683 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16684 | break; |
| 16685 | } |
| 16686 | } |
| 16687 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16688 | #define alc663_g71v_setup alc663_m51va_setup |
| 16689 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16690 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16691 | { |
| 16692 | alc663_g71v_front_automute(codec); |
| 16693 | alc663_g71v_hp_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16694 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16695 | } |
| 16696 | |
| 16697 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16698 | unsigned int res) |
| 16699 | { |
| 16700 | switch (res >> 26) { |
| 16701 | case ALC880_HP_EVENT: |
| 16702 | alc663_m51va_speaker_automute(codec); |
| 16703 | break; |
| 16704 | case ALC880_MIC_EVENT: |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16705 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16706 | break; |
| 16707 | } |
| 16708 | } |
| 16709 | |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16710 | #define alc663_g50v_setup alc663_m51va_setup |
| 16711 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16712 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16713 | { |
| 16714 | alc663_m51va_speaker_automute(codec); |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16715 | alc_mic_automute(codec); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16716 | } |
| 16717 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16718 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16719 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16720 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16721 | |
| 16722 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16723 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16724 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16725 | |
| 16726 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16727 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16728 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16729 | { } /* end */ |
| 16730 | }; |
| 16731 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16732 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16733 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16734 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16735 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16736 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16738 | |
| 16739 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16740 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16741 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16742 | |
| 16743 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16744 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16745 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16746 | { } /* end */ |
| 16747 | }; |
| 16748 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16749 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16750 | #define alc662_loopbacks alc880_loopbacks |
| 16751 | #endif |
| 16752 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16753 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16754 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16755 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16756 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16757 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16758 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16759 | |
| 16760 | /* |
| 16761 | * configuration and preset |
| 16762 | */ |
| 16763 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16764 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16765 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16766 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16767 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16768 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16769 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16770 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16771 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16772 | [ALC663_ASUS_M51VA] = "m51va", |
| 16773 | [ALC663_ASUS_G71V] = "g71v", |
| 16774 | [ALC663_ASUS_H13] = "h13", |
| 16775 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16776 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16777 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16778 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16779 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16780 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16781 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16782 | [ALC272_DELL] = "dell", |
| 16783 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16784 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16785 | [ALC662_AUTO] = "auto", |
| 16786 | }; |
| 16787 | |
| 16788 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16789 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16790 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16791 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16792 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16793 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16794 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16795 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16796 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16797 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16798 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16799 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16800 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16801 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16802 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16803 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16804 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16805 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16806 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16807 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16808 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16809 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16810 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16811 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16812 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16813 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16814 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16815 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16816 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16817 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16818 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16819 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16820 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16821 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16822 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16823 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16824 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16825 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16826 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16827 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16828 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16829 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16830 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16831 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16832 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16833 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16834 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16835 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16836 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16837 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16838 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16839 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16840 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16841 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16842 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16843 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16844 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16845 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16846 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16847 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16848 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16849 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16850 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16851 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16852 | {} |
| 16853 | }; |
| 16854 | |
| 16855 | static struct alc_config_preset alc662_presets[] = { |
| 16856 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16857 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16858 | .init_verbs = { alc662_init_verbs }, |
| 16859 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16860 | .dac_nids = alc662_dac_nids, |
| 16861 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16862 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16863 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16864 | .channel_mode = alc662_3ST_2ch_modes, |
| 16865 | .input_mux = &alc662_capture_source, |
| 16866 | }, |
| 16867 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16868 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16869 | .init_verbs = { alc662_init_verbs }, |
| 16870 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16871 | .dac_nids = alc662_dac_nids, |
| 16872 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16873 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16874 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16875 | .channel_mode = alc662_3ST_6ch_modes, |
| 16876 | .need_dac_fix = 1, |
| 16877 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16878 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16879 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16880 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16881 | .init_verbs = { alc662_init_verbs }, |
| 16882 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16883 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16884 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16885 | .channel_mode = alc662_3ST_6ch_modes, |
| 16886 | .need_dac_fix = 1, |
| 16887 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16888 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16889 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16890 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16891 | .init_verbs = { alc662_init_verbs }, |
| 16892 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16893 | .dac_nids = alc662_dac_nids, |
| 16894 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16895 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16896 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16897 | .channel_mode = alc662_5stack_modes, |
| 16898 | .input_mux = &alc662_capture_source, |
| 16899 | }, |
| 16900 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16901 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16902 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16903 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16904 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16905 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16906 | .channel_mode = alc662_3ST_2ch_modes, |
| 16907 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16908 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16909 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16910 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16911 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16912 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16913 | .init_verbs = { alc662_init_verbs, |
| 16914 | alc662_eeepc_sue_init_verbs }, |
| 16915 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16916 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16917 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16918 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16919 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16920 | .setup = alc662_eeepc_setup, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16921 | .init_hook = alc662_eeepc_inithook, |
| 16922 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16923 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16924 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16925 | alc662_chmode_mixer }, |
| 16926 | .init_verbs = { alc662_init_verbs, |
| 16927 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16928 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16929 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16930 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16931 | .channel_mode = alc662_3ST_6ch_modes, |
| 16932 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16933 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16934 | .setup = alc662_eeepc_ep20_setup, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16935 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16936 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16937 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16938 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16939 | .init_verbs = { alc662_init_verbs, |
| 16940 | alc662_ecs_init_verbs }, |
| 16941 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16942 | .dac_nids = alc662_dac_nids, |
| 16943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16944 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16945 | .unsol_event = alc662_eeepc_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16946 | .setup = alc662_eeepc_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16947 | .init_hook = alc662_eeepc_inithook, |
| 16948 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16949 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16950 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16951 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16952 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16953 | .dac_nids = alc662_dac_nids, |
| 16954 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16955 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16956 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16957 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16958 | .setup = alc663_m51va_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16959 | .init_hook = alc663_m51va_inithook, |
| 16960 | }, |
| 16961 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16962 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16963 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16964 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16965 | .dac_nids = alc662_dac_nids, |
| 16966 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16967 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16968 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16969 | .unsol_event = alc663_g71v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16970 | .setup = alc663_g71v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16971 | .init_hook = alc663_g71v_inithook, |
| 16972 | }, |
| 16973 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16974 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16975 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16976 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16977 | .dac_nids = alc662_dac_nids, |
| 16978 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16979 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16980 | .unsol_event = alc663_m51va_unsol_event, |
| 16981 | .init_hook = alc663_m51va_inithook, |
| 16982 | }, |
| 16983 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16984 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16985 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16986 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16987 | .dac_nids = alc662_dac_nids, |
| 16988 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16989 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16990 | .channel_mode = alc662_3ST_6ch_modes, |
| 16991 | .input_mux = &alc663_capture_source, |
| 16992 | .unsol_event = alc663_g50v_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 16993 | .setup = alc663_g50v_setup, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16994 | .init_hook = alc663_g50v_inithook, |
| 16995 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16996 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16997 | .mixers = { alc663_m51va_mixer }, |
| 16998 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16999 | .init_verbs = { alc662_init_verbs, |
| 17000 | alc663_21jd_amic_init_verbs }, |
| 17001 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17002 | .hp_nid = 0x03, |
| 17003 | .dac_nids = alc662_dac_nids, |
| 17004 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17005 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17006 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17007 | .unsol_event = alc663_mode1_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17008 | .setup = alc663_mode1_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17009 | .init_hook = alc663_mode1_inithook, |
| 17010 | }, |
| 17011 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17012 | .mixers = { alc662_1bjd_mixer }, |
| 17013 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17014 | .init_verbs = { alc662_init_verbs, |
| 17015 | alc662_1bjd_amic_init_verbs }, |
| 17016 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17017 | .dac_nids = alc662_dac_nids, |
| 17018 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17019 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17020 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17021 | .unsol_event = alc662_mode2_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17022 | .setup = alc662_mode2_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17023 | .init_hook = alc662_mode2_inithook, |
| 17024 | }, |
| 17025 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17026 | .mixers = { alc663_two_hp_m1_mixer }, |
| 17027 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17028 | .init_verbs = { alc662_init_verbs, |
| 17029 | alc663_two_hp_amic_m1_init_verbs }, |
| 17030 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17031 | .hp_nid = 0x03, |
| 17032 | .dac_nids = alc662_dac_nids, |
| 17033 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17034 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17035 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17036 | .unsol_event = alc663_mode3_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17037 | .setup = alc663_mode3_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17038 | .init_hook = alc663_mode3_inithook, |
| 17039 | }, |
| 17040 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17041 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 17042 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17043 | .init_verbs = { alc662_init_verbs, |
| 17044 | alc663_21jd_amic_init_verbs}, |
| 17045 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17046 | .hp_nid = 0x03, |
| 17047 | .dac_nids = alc662_dac_nids, |
| 17048 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17049 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17050 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17051 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17052 | .setup = alc663_mode4_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17053 | .init_hook = alc663_mode4_inithook, |
| 17054 | }, |
| 17055 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17056 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 17057 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17058 | .init_verbs = { alc662_init_verbs, |
| 17059 | alc663_15jd_amic_init_verbs }, |
| 17060 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17061 | .hp_nid = 0x03, |
| 17062 | .dac_nids = alc662_dac_nids, |
| 17063 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17064 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17065 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17066 | .unsol_event = alc663_mode5_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17067 | .setup = alc663_mode5_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17068 | .init_hook = alc663_mode5_inithook, |
| 17069 | }, |
| 17070 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17071 | .mixers = { alc663_two_hp_m2_mixer }, |
| 17072 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17073 | .init_verbs = { alc662_init_verbs, |
| 17074 | alc663_two_hp_amic_m2_init_verbs }, |
| 17075 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 17076 | .hp_nid = 0x03, |
| 17077 | .dac_nids = alc662_dac_nids, |
| 17078 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 17079 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17080 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17081 | .unsol_event = alc663_mode6_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17082 | .setup = alc663_mode6_setup, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 17083 | .init_hook = alc663_mode6_inithook, |
| 17084 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17085 | [ALC272_DELL] = { |
| 17086 | .mixers = { alc663_m51va_mixer }, |
| 17087 | .cap_mixer = alc272_auto_capture_mixer, |
| 17088 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 17089 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17090 | .dac_nids = alc662_dac_nids, |
| 17091 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17092 | .adc_nids = alc272_adc_nids, |
| 17093 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 17094 | .capsrc_nids = alc272_capsrc_nids, |
| 17095 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17096 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17097 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17098 | .init_hook = alc663_m51va_inithook, |
| 17099 | }, |
| 17100 | [ALC272_DELL_ZM1] = { |
| 17101 | .mixers = { alc663_m51va_mixer }, |
| 17102 | .cap_mixer = alc662_auto_capture_mixer, |
| 17103 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 17104 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17105 | .dac_nids = alc662_dac_nids, |
| 17106 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17107 | .adc_nids = alc662_adc_nids, |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17108 | .num_adc_nids = 1, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17109 | .capsrc_nids = alc662_capsrc_nids, |
| 17110 | .channel_mode = alc662_3ST_2ch_modes, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17111 | .unsol_event = alc663_m51va_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17112 | .setup = alc663_m51va_setup, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 17113 | .init_hook = alc663_m51va_inithook, |
| 17114 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17115 | [ALC272_SAMSUNG_NC10] = { |
| 17116 | .mixers = { alc272_nc10_mixer }, |
| 17117 | .init_verbs = { alc662_init_verbs, |
| 17118 | alc663_21jd_amic_init_verbs }, |
| 17119 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 17120 | .dac_nids = alc272_dac_nids, |
| 17121 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 17122 | .channel_mode = alc662_3ST_2ch_modes, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17123 | /*.input_mux = &alc272_nc10_capture_source,*/ |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17124 | .unsol_event = alc663_mode4_unsol_event, |
Takashi Iwai | 4f5d1706 | 2009-08-11 18:17:46 +0200 | [diff] [blame] | 17125 | .setup = alc663_mode4_setup, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 17126 | .init_hook = alc663_mode4_inithook, |
| 17127 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17128 | }; |
| 17129 | |
| 17130 | |
| 17131 | /* |
| 17132 | * BIOS auto configuration |
| 17133 | */ |
| 17134 | |
| 17135 | /* add playback controls from the parsed DAC table */ |
| 17136 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 17137 | const struct auto_pin_cfg *cfg) |
| 17138 | { |
| 17139 | char name[32]; |
| 17140 | static const char *chname[4] = { |
| 17141 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 17142 | }; |
| 17143 | hda_nid_t nid; |
| 17144 | int i, err; |
| 17145 | |
| 17146 | for (i = 0; i < cfg->line_outs; i++) { |
| 17147 | if (!spec->multiout.dac_nids[i]) |
| 17148 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 17149 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17150 | if (i == 2) { |
| 17151 | /* Center/LFE */ |
| 17152 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17153 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17154 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17155 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17156 | if (err < 0) |
| 17157 | return err; |
| 17158 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17159 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17160 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17161 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17162 | if (err < 0) |
| 17163 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17164 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17165 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17166 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17167 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17168 | if (err < 0) |
| 17169 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17170 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17171 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17172 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17173 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17174 | if (err < 0) |
| 17175 | return err; |
| 17176 | } else { |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17177 | const char *pfx; |
| 17178 | if (cfg->line_outs == 1 && |
| 17179 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { |
| 17180 | if (!cfg->hp_pins) |
| 17181 | pfx = "Speaker"; |
| 17182 | else |
| 17183 | pfx = "PCM"; |
| 17184 | } else |
| 17185 | pfx = chname[i]; |
| 17186 | sprintf(name, "%s Playback Volume", pfx); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17187 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17188 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17189 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17190 | if (err < 0) |
| 17191 | return err; |
Takashi Iwai | 0d884cb | 2009-08-25 16:14:35 +0200 | [diff] [blame] | 17192 | if (cfg->line_outs == 1 && |
| 17193 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 17194 | pfx = "Speaker"; |
| 17195 | sprintf(name, "%s Playback Switch", pfx); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17196 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17197 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17198 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17199 | if (err < 0) |
| 17200 | return err; |
| 17201 | } |
| 17202 | } |
| 17203 | return 0; |
| 17204 | } |
| 17205 | |
| 17206 | /* add playback controls for speaker and HP outputs */ |
| 17207 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17208 | const char *pfx) |
| 17209 | { |
| 17210 | hda_nid_t nid; |
| 17211 | int err; |
| 17212 | char name[32]; |
| 17213 | |
| 17214 | if (!pin) |
| 17215 | return 0; |
| 17216 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17217 | if (pin == 0x17) { |
| 17218 | /* ALC663 has a mono output pin on 0x17 */ |
| 17219 | sprintf(name, "%s Playback Switch", pfx); |
| 17220 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17221 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17222 | return err; |
| 17223 | } |
| 17224 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17225 | if (alc880_is_fixed_pin(pin)) { |
| 17226 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17227 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17228 | /* specify the DAC as the extra output */ |
| 17229 | if (!spec->multiout.hp_nid) |
| 17230 | spec->multiout.hp_nid = nid; |
| 17231 | else |
| 17232 | spec->multiout.extra_out_nid[0] = nid; |
| 17233 | /* control HP volume/switch on the output mixer amp */ |
| 17234 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17235 | sprintf(name, "%s Playback Volume", pfx); |
| 17236 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17237 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17238 | if (err < 0) |
| 17239 | return err; |
| 17240 | sprintf(name, "%s Playback Switch", pfx); |
| 17241 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17242 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17243 | if (err < 0) |
| 17244 | return err; |
| 17245 | } else if (alc880_is_multi_pin(pin)) { |
| 17246 | /* set manual connection */ |
| 17247 | /* we have only a switch on HP-out PIN */ |
| 17248 | sprintf(name, "%s Playback Switch", pfx); |
| 17249 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17250 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17251 | if (err < 0) |
| 17252 | return err; |
| 17253 | } |
| 17254 | return 0; |
| 17255 | } |
| 17256 | |
| 17257 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17258 | #define alc662_auto_create_input_ctls \ |
| 17259 | alc880_auto_create_input_ctls |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17260 | |
| 17261 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17262 | hda_nid_t nid, int pin_type, |
| 17263 | int dac_idx) |
| 17264 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17265 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17266 | /* need the manual connection? */ |
| 17267 | if (alc880_is_multi_pin(nid)) { |
| 17268 | struct alc_spec *spec = codec->spec; |
| 17269 | int idx = alc880_multi_pin_idx(nid); |
| 17270 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17271 | AC_VERB_SET_CONNECT_SEL, |
| 17272 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17273 | } |
| 17274 | } |
| 17275 | |
| 17276 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17277 | { |
| 17278 | struct alc_spec *spec = codec->spec; |
| 17279 | int i; |
| 17280 | |
| 17281 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17282 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17283 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17284 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17285 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17286 | i); |
| 17287 | } |
| 17288 | } |
| 17289 | |
| 17290 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17291 | { |
| 17292 | struct alc_spec *spec = codec->spec; |
| 17293 | hda_nid_t pin; |
| 17294 | |
| 17295 | pin = spec->autocfg.hp_pins[0]; |
| 17296 | if (pin) /* connect to front */ |
| 17297 | /* use dac 0 */ |
| 17298 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17299 | pin = spec->autocfg.speaker_pins[0]; |
| 17300 | if (pin) |
| 17301 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17302 | } |
| 17303 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17304 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17305 | |
| 17306 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17307 | { |
| 17308 | struct alc_spec *spec = codec->spec; |
| 17309 | int i; |
| 17310 | |
| 17311 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17312 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17313 | if (alc_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17314 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17315 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17316 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17317 | snd_hda_codec_write(codec, nid, 0, |
| 17318 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17319 | AMP_OUT_MUTE); |
| 17320 | } |
| 17321 | } |
| 17322 | } |
| 17323 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17324 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17325 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17326 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17327 | { |
| 17328 | struct alc_spec *spec = codec->spec; |
| 17329 | int err; |
| 17330 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17331 | |
| 17332 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17333 | alc662_ignore); |
| 17334 | if (err < 0) |
| 17335 | return err; |
| 17336 | if (!spec->autocfg.line_outs) |
| 17337 | return 0; /* can't find valid BIOS pin config */ |
| 17338 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17339 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17340 | if (err < 0) |
| 17341 | return err; |
| 17342 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17343 | if (err < 0) |
| 17344 | return err; |
| 17345 | err = alc662_auto_create_extra_out(spec, |
| 17346 | spec->autocfg.speaker_pins[0], |
| 17347 | "Speaker"); |
| 17348 | if (err < 0) |
| 17349 | return err; |
| 17350 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17351 | "Headphone"); |
| 17352 | if (err < 0) |
| 17353 | return err; |
Takashi Iwai | 05f5f47 | 2009-08-25 13:10:18 +0200 | [diff] [blame] | 17354 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17355 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17356 | return err; |
| 17357 | |
| 17358 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17359 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17360 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17361 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17362 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17363 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17364 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17365 | |
| 17366 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17367 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17368 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17369 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17370 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17371 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17372 | |
| 17373 | err = alc_auto_add_mic_boost(codec); |
| 17374 | if (err < 0) |
| 17375 | return err; |
| 17376 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17377 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17378 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17379 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17380 | } |
| 17381 | |
| 17382 | /* additional initialization for auto-configuration model */ |
| 17383 | static void alc662_auto_init(struct hda_codec *codec) |
| 17384 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17385 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17386 | alc662_auto_init_multi_out(codec); |
| 17387 | alc662_auto_init_hp_out(codec); |
| 17388 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17389 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17390 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17391 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17392 | } |
| 17393 | |
| 17394 | static int patch_alc662(struct hda_codec *codec) |
| 17395 | { |
| 17396 | struct alc_spec *spec; |
| 17397 | int err, board_config; |
| 17398 | |
| 17399 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17400 | if (!spec) |
| 17401 | return -ENOMEM; |
| 17402 | |
| 17403 | codec->spec = spec; |
| 17404 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17405 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17406 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17407 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17408 | alc662_models, |
| 17409 | alc662_cfg_tbl); |
| 17410 | if (board_config < 0) { |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 17411 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 17412 | codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17413 | board_config = ALC662_AUTO; |
| 17414 | } |
| 17415 | |
| 17416 | if (board_config == ALC662_AUTO) { |
| 17417 | /* automatic parse from the BIOS config */ |
| 17418 | err = alc662_parse_auto_config(codec); |
| 17419 | if (err < 0) { |
| 17420 | alc_free(codec); |
| 17421 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17422 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17423 | printk(KERN_INFO |
| 17424 | "hda_codec: Cannot set up configuration " |
| 17425 | "from BIOS. Using base mode...\n"); |
| 17426 | board_config = ALC662_3ST_2ch_DIG; |
| 17427 | } |
| 17428 | } |
| 17429 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17430 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17431 | if (err < 0) { |
| 17432 | alc_free(codec); |
| 17433 | return err; |
| 17434 | } |
| 17435 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17436 | if (board_config != ALC662_AUTO) |
Takashi Iwai | e9c364c | 2009-08-11 17:16:13 +0200 | [diff] [blame] | 17437 | setup_preset(codec, &alc662_presets[board_config]); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17438 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17439 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17440 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17441 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17442 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17443 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17444 | |
Takashi Iwai | dd70469 | 2009-08-11 08:45:11 +0200 | [diff] [blame] | 17445 | if (!spec->adc_nids) { |
| 17446 | spec->adc_nids = alc662_adc_nids; |
| 17447 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17448 | } |
| 17449 | if (!spec->capsrc_nids) |
| 17450 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17451 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17452 | if (!spec->cap_mixer) |
Takashi Iwai | b59bdf3 | 2009-08-11 09:47:30 +0200 | [diff] [blame] | 17453 | set_capture_mixer(codec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17454 | if (codec->vendor_id == 0x10ec0662) |
| 17455 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17456 | else |
| 17457 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17458 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17459 | spec->vmaster_nid = 0x02; |
| 17460 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17461 | codec->patch_ops = alc_patch_ops; |
| 17462 | if (board_config == ALC662_AUTO) |
| 17463 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17464 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17465 | if (!spec->loopback.amplist) |
| 17466 | spec->loopback.amplist = alc662_loopbacks; |
| 17467 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17468 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17469 | |
| 17470 | return 0; |
| 17471 | } |
| 17472 | |
| 17473 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17474 | * patch entries |
| 17475 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17476 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17477 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17478 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17479 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17480 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17481 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17482 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17483 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17484 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17485 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17486 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17487 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17488 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17489 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17490 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17491 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17492 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17493 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17494 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17495 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17496 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17497 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17498 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17499 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17500 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17501 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17502 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17503 | .patch = patch_alc882 }, |
| 17504 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17505 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17506 | {} /* terminator */ |
| 17507 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17508 | |
| 17509 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17510 | |
| 17511 | MODULE_LICENSE("GPL"); |
| 17512 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17513 | |
| 17514 | static struct hda_codec_preset_list realtek_list = { |
| 17515 | .preset = snd_hda_preset_realtek, |
| 17516 | .owner = THIS_MODULE, |
| 17517 | }; |
| 17518 | |
| 17519 | static int __init patch_realtek_init(void) |
| 17520 | { |
| 17521 | return snd_hda_add_codec_preset(&realtek_list); |
| 17522 | } |
| 17523 | |
| 17524 | static void __exit patch_realtek_exit(void) |
| 17525 | { |
| 17526 | snd_hda_delete_codec_preset(&realtek_list); |
| 17527 | } |
| 17528 | |
| 17529 | module_init(patch_realtek_init) |
| 17530 | module_exit(patch_realtek_exit) |