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, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 223 | ALC883_MEDION, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 224 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 225 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 226 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 227 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 228 | ALC888_LENOVO_MS7195_DIG, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 229 | ALC888_LENOVO_SKY, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 230 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 231 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 232 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 233 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 234 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 235 | ALC883_FUJITSU_PI2515, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 236 | ALC888_FUJITSU_XA3530, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 237 | ALC883_3ST_6ch_INTEL, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 238 | ALC889A_INTEL, |
| 239 | ALC889_INTEL, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 240 | ALC888_ASUS_M90V, |
| 241 | ALC888_ASUS_EEE1601, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 242 | ALC889A_MB31, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 243 | ALC1200_ASUS_P5Q, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 244 | ALC883_SONY_VAIO_TT, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 245 | ALC882_AUTO, |
| 246 | ALC882_MODEL_LAST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 247 | }; |
| 248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 249 | /* for GPIO Poll */ |
| 250 | #define GPIO_MASK 0x03 |
| 251 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 252 | /* extra amp-initialization sequence types */ |
| 253 | enum { |
| 254 | ALC_INIT_NONE, |
| 255 | ALC_INIT_DEFAULT, |
| 256 | ALC_INIT_GPIO1, |
| 257 | ALC_INIT_GPIO2, |
| 258 | ALC_INIT_GPIO3, |
| 259 | }; |
| 260 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | struct alc_spec { |
| 262 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 263 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | unsigned int num_mixers; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 265 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 266 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 268 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 269 | * don't forget NULL |
| 270 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 271 | */ |
| 272 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 274 | char stream_name_analog[16]; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 275 | struct hda_pcm_stream *stream_analog_playback; |
| 276 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 277 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 278 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 280 | char stream_name_digital[16]; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | struct hda_pcm_stream *stream_digital_playback; |
| 282 | struct hda_pcm_stream *stream_digital_capture; |
| 283 | |
| 284 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 285 | struct hda_multi_out multiout; /* playback set-up |
| 286 | * max_channels, dacs must be set |
| 287 | * dig_out_nid and hp_nid are optional |
| 288 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 289 | hda_nid_t alt_dac_nid; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 290 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 291 | int dig_out_type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
| 293 | /* capture */ |
| 294 | unsigned int num_adc_nids; |
| 295 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 296 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 297 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | |
| 299 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 300 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | const struct hda_input_mux *input_mux; |
| 302 | unsigned int cur_mux[3]; |
| 303 | |
| 304 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 305 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 307 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 308 | int const_channel_count; |
| 309 | int ext_channel_count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | |
| 311 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 312 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 313 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 314 | /* dynamic controls, init_verbs and input_mux */ |
| 315 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 316 | struct snd_array kctls; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 317 | struct hda_input_mux private_imux[3]; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 318 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 319 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; |
| 320 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 321 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 322 | /* hooks */ |
| 323 | void (*init_hook)(struct hda_codec *codec); |
| 324 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 325 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 326 | /* for pin sensing */ |
| 327 | unsigned int sense_updated: 1; |
| 328 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 329 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 330 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 331 | /* other flags */ |
| 332 | unsigned int no_analog :1; /* digital I/O only */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 333 | int init_amp; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 334 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 335 | /* for virtual master */ |
| 336 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 337 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 338 | struct hda_loopback_check loopback; |
| 339 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 340 | |
| 341 | /* for PLL fix */ |
| 342 | hda_nid_t pll_nid; |
| 343 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 344 | }; |
| 345 | |
| 346 | /* |
| 347 | * configuration template - to be copied to the spec instance |
| 348 | */ |
| 349 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 350 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 351 | * with spec |
| 352 | */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 353 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 354 | const struct hda_verb *init_verbs[5]; |
| 355 | unsigned int num_dacs; |
| 356 | hda_nid_t *dac_nids; |
| 357 | hda_nid_t dig_out_nid; /* optional */ |
| 358 | hda_nid_t hp_nid; /* optional */ |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 359 | hda_nid_t *slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 360 | unsigned int num_adc_nids; |
| 361 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 362 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 363 | hda_nid_t dig_in_nid; |
| 364 | unsigned int num_channel_mode; |
| 365 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 366 | int need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 367 | int const_channel_count; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 368 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 369 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 370 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 371 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 372 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 373 | struct hda_amp_list *loopbacks; |
| 374 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | }; |
| 376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
| 378 | /* |
| 379 | * input MUX handling |
| 380 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 381 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 382 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | { |
| 384 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 385 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 386 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 387 | if (mux_idx >= spec->num_mux_defs) |
| 388 | mux_idx = 0; |
| 389 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 392 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 393 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 394 | { |
| 395 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 396 | struct alc_spec *spec = codec->spec; |
| 397 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 398 | |
| 399 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 400 | return 0; |
| 401 | } |
| 402 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 403 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 404 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | { |
| 406 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 407 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 408 | const struct hda_input_mux *imux; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 410 | unsigned int mux_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 411 | hda_nid_t nid = spec->capsrc_nids ? |
| 412 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 413 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 415 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 416 | imux = &spec->input_mux[mux_idx]; |
| 417 | |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 418 | type = get_wcaps_type(get_wcaps(codec, nid)); |
Takashi Iwai | 0169b6b | 2009-06-22 10:50:19 +0200 | [diff] [blame] | 419 | if (type == AC_WID_AUD_MIX) { |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 420 | /* Matrix-mixer style (e.g. ALC882) */ |
| 421 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 422 | unsigned int i, idx; |
| 423 | |
| 424 | idx = ucontrol->value.enumerated.item[0]; |
| 425 | if (idx >= imux->num_items) |
| 426 | idx = imux->num_items - 1; |
| 427 | if (*cur_val == idx) |
| 428 | return 0; |
| 429 | for (i = 0; i < imux->num_items; i++) { |
| 430 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 431 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 432 | imux->items[i].index, |
| 433 | HDA_AMP_MUTE, v); |
| 434 | } |
| 435 | *cur_val = idx; |
| 436 | return 1; |
| 437 | } else { |
| 438 | /* MUX style (e.g. ALC880) */ |
Takashi Iwai | cd896c3 | 2008-11-18 12:36:33 +0100 | [diff] [blame] | 439 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 440 | &spec->cur_mux[adc_idx]); |
| 441 | } |
| 442 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 443 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 444 | /* |
| 445 | * channel mode setting |
| 446 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | { |
| 450 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 451 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 452 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 453 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 456 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 457 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | { |
| 459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 460 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 461 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 462 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 463 | spec->ext_channel_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | } |
| 465 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 467 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | { |
| 469 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 470 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 471 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 472 | spec->num_channel_mode, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 473 | &spec->ext_channel_count); |
| 474 | if (err >= 0 && !spec->const_channel_count) { |
| 475 | spec->multiout.max_channels = spec->ext_channel_count; |
| 476 | if (spec->need_dac_fix) |
| 477 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 478 | } |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 479 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | } |
| 481 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | * 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] | 484 | * instead of "%" to avoid consequences of accidently treating the % as |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | * being part of a format specifier. Maximum allowed length of a value is |
| 486 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 487 | * |
| 488 | * Note: some retasking pin complexes seem to ignore requests for input |
| 489 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 490 | * are requested. Therefore order this list so that this behaviour will not |
| 491 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 492 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 493 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 494 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 495 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 496 | "Mic 50pc bias", "Mic 80pc bias", |
| 497 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 498 | }; |
| 499 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 500 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 501 | }; |
| 502 | /* 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] | 503 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 504 | * addition, "input" pins may or may not process the mic bias option |
| 505 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 506 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 507 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 508 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 509 | #define ALC_PIN_DIR_IN 0x00 |
| 510 | #define ALC_PIN_DIR_OUT 0x01 |
| 511 | #define ALC_PIN_DIR_INOUT 0x02 |
| 512 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 513 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 515 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | * For each direction the minimum and maximum values are given. |
| 517 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 518 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 520 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 521 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 522 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 523 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 524 | }; |
| 525 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 526 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 527 | #define alc_pin_mode_n_items(_dir) \ |
| 528 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 529 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 530 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 531 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 532 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 533 | unsigned int item_num = uinfo->value.enumerated.item; |
| 534 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 535 | |
| 536 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 537 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 538 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 539 | |
| 540 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 541 | item_num = alc_pin_mode_min(dir); |
| 542 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 543 | return 0; |
| 544 | } |
| 545 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 547 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 548 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 549 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 550 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 551 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 552 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 553 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 554 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 555 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 556 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 557 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 558 | /* Find enumerated value for current pinctl setting */ |
| 559 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 561 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 562 | *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] | 563 | return 0; |
| 564 | } |
| 565 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 566 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 567 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 568 | { |
| 569 | signed int change; |
| 570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 571 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 572 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 573 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 574 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 575 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 576 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 577 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 578 | 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] | 579 | val = alc_pin_mode_min(dir); |
| 580 | |
| 581 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 582 | if (change) { |
| 583 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 584 | snd_hda_codec_write_cache(codec, nid, 0, |
| 585 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 586 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 587 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 588 | /* Also enable the retasking pin's input/output as required |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 589 | * for the requested pin mode. Enum values of 2 or less are |
| 590 | * input modes. |
| 591 | * |
| 592 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 593 | * reduces noise slightly (particularly on input) so we'll |
| 594 | * do it. However, having both input and output buffers |
| 595 | * enabled simultaneously doesn't seem to be problematic if |
| 596 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 597 | */ |
| 598 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 599 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 600 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 601 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 602 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 603 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 604 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 605 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 606 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 607 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 608 | } |
| 609 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 610 | return change; |
| 611 | } |
| 612 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 613 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 614 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 615 | .info = alc_pin_mode_info, \ |
| 616 | .get = alc_pin_mode_get, \ |
| 617 | .put = alc_pin_mode_put, \ |
| 618 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 619 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 620 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 621 | * together using a mask with more than one bit set. This control is |
| 622 | * currently used only by the ALC260 test model. At this stage they are not |
| 623 | * needed for any "production" models. |
| 624 | */ |
| 625 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 626 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 627 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 628 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 629 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 630 | { |
| 631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 632 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 633 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 634 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 635 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 636 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 637 | |
| 638 | *valp = (val & mask) != 0; |
| 639 | return 0; |
| 640 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 641 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 642 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 643 | { |
| 644 | signed int change; |
| 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 val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 649 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 650 | AC_VERB_GET_GPIO_DATA, |
| 651 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 652 | |
| 653 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 654 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 655 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 656 | gpio_data &= ~mask; |
| 657 | else |
| 658 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 659 | snd_hda_codec_write_cache(codec, nid, 0, |
| 660 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 661 | |
| 662 | return change; |
| 663 | } |
| 664 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 665 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 666 | .info = alc_gpio_data_info, \ |
| 667 | .get = alc_gpio_data_get, \ |
| 668 | .put = alc_gpio_data_put, \ |
| 669 | .private_value = nid | (mask<<16) } |
| 670 | #endif /* CONFIG_SND_DEBUG */ |
| 671 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 672 | /* A switch control to allow the enabling of the digital IO pins on the |
| 673 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 674 | * to provide something in the test model allowing digital outputs to be |
| 675 | * identified if present. If models are found which can utilise these |
| 676 | * outputs a more complete mixer control can be devised for those models if |
| 677 | * necessary. |
| 678 | */ |
| 679 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 680 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 681 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 682 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 683 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 684 | { |
| 685 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 686 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 687 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 688 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 689 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 690 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 691 | |
| 692 | *valp = (val & mask) != 0; |
| 693 | return 0; |
| 694 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 696 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 697 | { |
| 698 | signed int change; |
| 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 val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 703 | unsigned int ctrl_data = 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, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 705 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 706 | |
| 707 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 708 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 709 | if (val==0) |
| 710 | ctrl_data &= ~mask; |
| 711 | else |
| 712 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 713 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 714 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 715 | |
| 716 | return change; |
| 717 | } |
| 718 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 719 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 720 | .info = alc_spdif_ctrl_info, \ |
| 721 | .get = alc_spdif_ctrl_get, \ |
| 722 | .put = alc_spdif_ctrl_put, \ |
| 723 | .private_value = nid | (mask<<16) } |
| 724 | #endif /* CONFIG_SND_DEBUG */ |
| 725 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 726 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 727 | * Again, this is only used in the ALC26x test models to help identify when |
| 728 | * the EAPD line must be asserted for features to work. |
| 729 | */ |
| 730 | #ifdef CONFIG_SND_DEBUG |
| 731 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 732 | |
| 733 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 734 | struct snd_ctl_elem_value *ucontrol) |
| 735 | { |
| 736 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 737 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 738 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 739 | long *valp = ucontrol->value.integer.value; |
| 740 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 741 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 742 | |
| 743 | *valp = (val & mask) != 0; |
| 744 | return 0; |
| 745 | } |
| 746 | |
| 747 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 748 | struct snd_ctl_elem_value *ucontrol) |
| 749 | { |
| 750 | int change; |
| 751 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 752 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 753 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 754 | long val = *ucontrol->value.integer.value; |
| 755 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 756 | AC_VERB_GET_EAPD_BTLENABLE, |
| 757 | 0x00); |
| 758 | |
| 759 | /* Set/unset the masked control bit(s) as needed */ |
| 760 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 761 | if (!val) |
| 762 | ctrl_data &= ~mask; |
| 763 | else |
| 764 | ctrl_data |= mask; |
| 765 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 766 | ctrl_data); |
| 767 | |
| 768 | return change; |
| 769 | } |
| 770 | |
| 771 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 772 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 773 | .info = alc_eapd_ctrl_info, \ |
| 774 | .get = alc_eapd_ctrl_get, \ |
| 775 | .put = alc_eapd_ctrl_put, \ |
| 776 | .private_value = nid | (mask<<16) } |
| 777 | #endif /* CONFIG_SND_DEBUG */ |
| 778 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 779 | /* |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 780 | * set up the input pin config (depending on the given auto-pin type) |
| 781 | */ |
| 782 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, |
| 783 | int auto_pin_type) |
| 784 | { |
| 785 | unsigned int val = PIN_IN; |
| 786 | |
| 787 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { |
| 788 | unsigned int pincap; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 789 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 790 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 791 | if (pincap & AC_PINCAP_VREF_80) |
| 792 | val = PIN_VREF80; |
Takashi Iwai | 461c6c3 | 2009-05-25 08:06:02 +0200 | [diff] [blame] | 793 | else if (pincap & AC_PINCAP_VREF_50) |
| 794 | val = PIN_VREF50; |
| 795 | else if (pincap & AC_PINCAP_VREF_100) |
| 796 | val = PIN_VREF100; |
| 797 | else if (pincap & AC_PINCAP_VREF_GRD) |
| 798 | val = PIN_VREFGRD; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 799 | } |
| 800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
| 801 | } |
| 802 | |
| 803 | /* |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 804 | */ |
| 805 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
| 806 | { |
| 807 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 808 | return; |
| 809 | spec->mixers[spec->num_mixers++] = mix; |
| 810 | } |
| 811 | |
| 812 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) |
| 813 | { |
| 814 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) |
| 815 | return; |
| 816 | spec->init_verbs[spec->num_init_verbs++] = verb; |
| 817 | } |
| 818 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 819 | #ifdef CONFIG_PROC_FS |
| 820 | /* |
| 821 | * hook for proc |
| 822 | */ |
| 823 | static void print_realtek_coef(struct snd_info_buffer *buffer, |
| 824 | struct hda_codec *codec, hda_nid_t nid) |
| 825 | { |
| 826 | int coeff; |
| 827 | |
| 828 | if (nid != 0x20) |
| 829 | return; |
| 830 | coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); |
| 831 | snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); |
| 832 | coeff = snd_hda_codec_read(codec, nid, 0, |
| 833 | AC_VERB_GET_COEF_INDEX, 0); |
| 834 | snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); |
| 835 | } |
| 836 | #else |
| 837 | #define print_realtek_coef NULL |
| 838 | #endif |
| 839 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 840 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 841 | * set up from the preset table |
| 842 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 843 | static void setup_preset(struct alc_spec *spec, |
| 844 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 845 | { |
| 846 | int i; |
| 847 | |
| 848 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 849 | add_mixer(spec, preset->mixers[i]); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 850 | spec->cap_mixer = preset->cap_mixer; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 851 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 852 | i++) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 853 | add_verb(spec, preset->init_verbs[i]); |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 854 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 855 | spec->channel_mode = preset->channel_mode; |
| 856 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 857 | spec->need_dac_fix = preset->need_dac_fix; |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 858 | spec->const_channel_count = preset->const_channel_count; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 859 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 860 | if (preset->const_channel_count) |
| 861 | spec->multiout.max_channels = preset->const_channel_count; |
| 862 | else |
| 863 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 864 | spec->ext_channel_count = spec->channel_mode[0].channels; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 865 | |
| 866 | spec->multiout.num_dacs = preset->num_dacs; |
| 867 | spec->multiout.dac_nids = preset->dac_nids; |
| 868 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 869 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 870 | spec->multiout.hp_nid = preset->hp_nid; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 871 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 872 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 873 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 874 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 875 | spec->input_mux = preset->input_mux; |
| 876 | |
| 877 | spec->num_adc_nids = preset->num_adc_nids; |
| 878 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 879 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 880 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 881 | |
| 882 | spec->unsol_event = preset->unsol_event; |
| 883 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 884 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 885 | spec->loopback.amplist = preset->loopbacks; |
| 886 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 887 | } |
| 888 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 889 | /* Enable GPIO mask and set output */ |
| 890 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 891 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 892 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 893 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 894 | { } |
| 895 | }; |
| 896 | |
| 897 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 898 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 899 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 900 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 901 | { } |
| 902 | }; |
| 903 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 904 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 905 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 906 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 907 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 908 | { } |
| 909 | }; |
| 910 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 911 | /* |
| 912 | * Fix hardware PLL issue |
| 913 | * On some codecs, the analog PLL gating control must be off while |
| 914 | * the default value is 1. |
| 915 | */ |
| 916 | static void alc_fix_pll(struct hda_codec *codec) |
| 917 | { |
| 918 | struct alc_spec *spec = codec->spec; |
| 919 | unsigned int val; |
| 920 | |
| 921 | if (!spec->pll_nid) |
| 922 | return; |
| 923 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 924 | spec->pll_coef_idx); |
| 925 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 926 | AC_VERB_GET_PROC_COEF, 0); |
| 927 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 928 | spec->pll_coef_idx); |
| 929 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 930 | val & ~(1 << spec->pll_coef_bit)); |
| 931 | } |
| 932 | |
| 933 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 934 | unsigned int coef_idx, unsigned int coef_bit) |
| 935 | { |
| 936 | struct alc_spec *spec = codec->spec; |
| 937 | spec->pll_nid = nid; |
| 938 | spec->pll_coef_idx = coef_idx; |
| 939 | spec->pll_coef_bit = coef_bit; |
| 940 | alc_fix_pll(codec); |
| 941 | } |
| 942 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 943 | static void alc_automute_pin(struct hda_codec *codec) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 944 | { |
| 945 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 946 | unsigned int present, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 947 | unsigned int nid = spec->autocfg.hp_pins[0]; |
| 948 | int i; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 949 | |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 950 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 951 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 952 | 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] | 953 | present = snd_hda_codec_read(codec, nid, 0, |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 954 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 955 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 956 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 957 | nid = spec->autocfg.speaker_pins[i]; |
| 958 | if (!nid) |
| 959 | break; |
| 960 | snd_hda_codec_write(codec, nid, 0, |
| 961 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 962 | spec->jack_present ? 0 : PIN_OUT); |
| 963 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 964 | } |
| 965 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 966 | #if 0 /* it's broken in some cases -- temporarily disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 967 | static void alc_mic_automute(struct hda_codec *codec) |
| 968 | { |
| 969 | struct alc_spec *spec = codec->spec; |
| 970 | unsigned int present; |
| 971 | unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 972 | unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 973 | unsigned int mix_nid = spec->capsrc_nids[0]; |
| 974 | unsigned int capsrc_idx_mic, capsrc_idx_fmic; |
| 975 | |
| 976 | capsrc_idx_mic = mic_nid - 0x18; |
| 977 | capsrc_idx_fmic = fmic_nid - 0x18; |
| 978 | present = snd_hda_codec_read(codec, mic_nid, 0, |
| 979 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 980 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 981 | 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80)); |
| 982 | snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 983 | 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0)); |
| 984 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
| 985 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 986 | } |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 987 | #else |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 988 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
Takashi Iwai | 4605b71 | 2008-10-31 14:18:24 +0100 | [diff] [blame] | 989 | #endif /* disabled */ |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 990 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 991 | /* unsolicited event for HP jack sensing */ |
| 992 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 993 | { |
| 994 | if (codec->vendor_id == 0x10ec0880) |
| 995 | res >>= 28; |
| 996 | else |
| 997 | res >>= 26; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 998 | switch (res) { |
| 999 | case ALC880_HP_EVENT: |
| 1000 | alc_automute_pin(codec); |
| 1001 | break; |
| 1002 | case ALC880_MIC_EVENT: |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1003 | alc_mic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1004 | break; |
| 1005 | } |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | static void alc_inithook(struct hda_codec *codec) |
| 1009 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1010 | alc_automute_pin(codec); |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 1011 | alc_mic_automute(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1014 | /* additional initialization for ALC888 variants */ |
| 1015 | static void alc888_coef_init(struct hda_codec *codec) |
| 1016 | { |
| 1017 | unsigned int tmp; |
| 1018 | |
| 1019 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 1020 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1021 | 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] | 1022 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1023 | /* alc888S-VC */ |
| 1024 | snd_hda_codec_read(codec, 0x20, 0, |
| 1025 | AC_VERB_SET_PROC_COEF, 0x830); |
| 1026 | else |
| 1027 | /* alc888-VB */ |
| 1028 | snd_hda_codec_read(codec, 0x20, 0, |
| 1029 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 1030 | } |
| 1031 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1032 | static void alc889_coef_init(struct hda_codec *codec) |
| 1033 | { |
| 1034 | unsigned int tmp; |
| 1035 | |
| 1036 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1037 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 1038 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 1039 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 1040 | } |
| 1041 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1042 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1043 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1044 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1045 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1046 | switch (type) { |
| 1047 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1048 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 1049 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1050 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1051 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 1052 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1053 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1054 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 1055 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1056 | case ALC_INIT_DEFAULT: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1057 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1058 | case 0x10ec0260: |
| 1059 | snd_hda_codec_write(codec, 0x0f, 0, |
| 1060 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1061 | snd_hda_codec_write(codec, 0x10, 0, |
| 1062 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1063 | break; |
| 1064 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1065 | case 0x10ec0267: |
| 1066 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1067 | case 0x10ec0269: |
Takashi Iwai | c6e8f2d | 2009-02-06 12:45:52 +0100 | [diff] [blame] | 1068 | case 0x10ec0272: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1069 | case 0x10ec0660: |
| 1070 | case 0x10ec0662: |
| 1071 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1072 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1073 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1074 | snd_hda_codec_write(codec, 0x14, 0, |
| 1075 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 1076 | snd_hda_codec_write(codec, 0x15, 0, |
| 1077 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1078 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 1079 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1080 | switch (codec->vendor_id) { |
| 1081 | case 0x10ec0260: |
| 1082 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1083 | AC_VERB_SET_COEF_INDEX, 7); |
| 1084 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 1085 | AC_VERB_GET_PROC_COEF, 0); |
| 1086 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1087 | AC_VERB_SET_COEF_INDEX, 7); |
| 1088 | snd_hda_codec_write(codec, 0x1a, 0, |
| 1089 | AC_VERB_SET_PROC_COEF, |
| 1090 | tmp | 0x2010); |
| 1091 | break; |
| 1092 | case 0x10ec0262: |
| 1093 | case 0x10ec0880: |
| 1094 | case 0x10ec0882: |
| 1095 | case 0x10ec0883: |
| 1096 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 1097 | case 0x10ec0887: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 1098 | case 0x10ec0889: |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 1099 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1100 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1101 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1102 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 1103 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1104 | case 0x10ec0267: |
| 1105 | case 0x10ec0268: |
| 1106 | snd_hda_codec_write(codec, 0x20, 0, |
| 1107 | AC_VERB_SET_COEF_INDEX, 7); |
| 1108 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 1109 | AC_VERB_GET_PROC_COEF, 0); |
| 1110 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1111 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1112 | snd_hda_codec_write(codec, 0x20, 0, |
| 1113 | AC_VERB_SET_PROC_COEF, |
| 1114 | tmp | 0x3000); |
| 1115 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1116 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1117 | break; |
| 1118 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1119 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1120 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1121 | static void alc_init_auto_hp(struct hda_codec *codec) |
| 1122 | { |
| 1123 | struct alc_spec *spec = codec->spec; |
| 1124 | |
| 1125 | if (!spec->autocfg.hp_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1126 | return; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1127 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1128 | if (!spec->autocfg.speaker_pins[0]) { |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1129 | if (spec->autocfg.line_out_pins[0] && |
| 1130 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1131 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 1132 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1133 | else |
| 1134 | return; |
| 1135 | } |
| 1136 | |
Takashi Iwai | 2a2ed0d | 2009-04-28 13:01:26 +0200 | [diff] [blame] | 1137 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", |
| 1138 | spec->autocfg.hp_pins[0]); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1139 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, |
| 1140 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1141 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1142 | spec->unsol_event = alc_sku_unsol_event; |
| 1143 | } |
| 1144 | |
| 1145 | /* check subsystem ID and set up device-specific initialization; |
| 1146 | * return 1 if initialized, 0 if invalid SSID |
| 1147 | */ |
| 1148 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 1149 | * 31 ~ 16 : Manufacture ID |
| 1150 | * 15 ~ 8 : SKU ID |
| 1151 | * 7 ~ 0 : Assembly ID |
| 1152 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 1153 | */ |
| 1154 | static int alc_subsystem_id(struct hda_codec *codec, |
| 1155 | hda_nid_t porta, hda_nid_t porte, |
| 1156 | hda_nid_t portd) |
| 1157 | { |
| 1158 | unsigned int ass, tmp, i; |
| 1159 | unsigned nid; |
| 1160 | struct alc_spec *spec = codec->spec; |
| 1161 | |
| 1162 | ass = codec->subsystem_id & 0xffff; |
| 1163 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 1164 | goto do_sku; |
| 1165 | |
| 1166 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 1167 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 1168 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1169 | * 29~21 : reserve |
| 1170 | * 20 : PCBEEP input |
| 1171 | * 19~16 : Check sum (15:1) |
| 1172 | * 15~1 : Custom |
| 1173 | * 0 : override |
| 1174 | */ |
| 1175 | nid = 0x1d; |
| 1176 | if (codec->vendor_id == 0x10ec0260) |
| 1177 | nid = 0x17; |
| 1178 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 1179 | snd_printd("realtek: No valid SSID, " |
| 1180 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 1181 | ass, nid); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1182 | if (!(ass & 1) && !(ass & 0x100000)) |
| 1183 | return 0; |
| 1184 | if ((ass >> 30) != 1) /* no physical connection */ |
| 1185 | return 0; |
| 1186 | |
| 1187 | /* check sum */ |
| 1188 | tmp = 0; |
| 1189 | for (i = 1; i < 16; i++) { |
| 1190 | if ((ass >> i) & 1) |
| 1191 | tmp++; |
| 1192 | } |
| 1193 | if (((ass >> 16) & 0xf) != tmp) |
| 1194 | return 0; |
| 1195 | do_sku: |
| 1196 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 1197 | ass & 0xffff, codec->vendor_id); |
| 1198 | /* |
| 1199 | * 0 : override |
| 1200 | * 1 : Swap Jack |
| 1201 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 1202 | * 3~5 : External Amplifier control |
| 1203 | * 7~6 : Reserved |
| 1204 | */ |
| 1205 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 1206 | switch (tmp) { |
| 1207 | case 1: |
| 1208 | spec->init_amp = ALC_INIT_GPIO1; |
| 1209 | break; |
| 1210 | case 3: |
| 1211 | spec->init_amp = ALC_INIT_GPIO2; |
| 1212 | break; |
| 1213 | case 7: |
| 1214 | spec->init_amp = ALC_INIT_GPIO3; |
| 1215 | break; |
| 1216 | case 5: |
| 1217 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1218 | break; |
| 1219 | } |
| 1220 | |
| 1221 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 1222 | * when the external headphone out jack is plugged" |
| 1223 | */ |
| 1224 | if (!(ass & 0x8000)) |
| 1225 | return 1; |
| 1226 | /* |
| 1227 | * 10~8 : Jack location |
| 1228 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 1229 | * 14~13: Resvered |
| 1230 | * 15 : 1 --> enable the function "Mute internal speaker |
| 1231 | * when the external headphone out jack is plugged" |
| 1232 | */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1233 | if (!spec->autocfg.hp_pins[0]) { |
| 1234 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1235 | if (tmp == 0) |
| 1236 | spec->autocfg.hp_pins[0] = porta; |
| 1237 | else if (tmp == 1) |
| 1238 | spec->autocfg.hp_pins[0] = porte; |
| 1239 | else if (tmp == 2) |
| 1240 | spec->autocfg.hp_pins[0] = portd; |
| 1241 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1242 | return 1; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 1243 | } |
| 1244 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1245 | alc_init_auto_hp(codec); |
| 1246 | return 1; |
| 1247 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 1248 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 1249 | static void alc_ssid_check(struct hda_codec *codec, |
| 1250 | hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) |
| 1251 | { |
| 1252 | if (!alc_subsystem_id(codec, porta, porte, portd)) { |
| 1253 | struct alc_spec *spec = codec->spec; |
| 1254 | snd_printd("realtek: " |
| 1255 | "Enable default setup for auto mode as fallback\n"); |
| 1256 | spec->init_amp = ALC_INIT_DEFAULT; |
| 1257 | alc_init_auto_hp(codec); |
| 1258 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1259 | } |
| 1260 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1261 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1262 | * Fix-up pin default configurations |
| 1263 | */ |
| 1264 | |
| 1265 | struct alc_pincfg { |
| 1266 | hda_nid_t nid; |
| 1267 | u32 val; |
| 1268 | }; |
| 1269 | |
| 1270 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1271 | const struct snd_pci_quirk *quirk, |
| 1272 | const struct alc_pincfg **pinfix) |
| 1273 | { |
| 1274 | const struct alc_pincfg *cfg; |
| 1275 | |
| 1276 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1277 | if (!quirk) |
| 1278 | return; |
| 1279 | |
| 1280 | cfg = pinfix[quirk->value]; |
Takashi Iwai | 0e8a21b | 2009-02-20 14:13:06 +0100 | [diff] [blame] | 1281 | for (; cfg->nid; cfg++) |
| 1282 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | /* |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1286 | * ALC888 |
| 1287 | */ |
| 1288 | |
| 1289 | /* |
| 1290 | * 2ch mode |
| 1291 | */ |
| 1292 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { |
| 1293 | /* Mic-in jack as mic in */ |
| 1294 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1295 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1296 | /* Line-in jack as Line in */ |
| 1297 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1298 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1299 | /* Line-Out as Front */ |
| 1300 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | /* |
| 1305 | * 4ch mode |
| 1306 | */ |
| 1307 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { |
| 1308 | /* Mic-in jack as mic in */ |
| 1309 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1310 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1311 | /* Line-in jack as Surround */ |
| 1312 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1313 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1314 | /* Line-Out as Front */ |
| 1315 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1316 | { } /* end */ |
| 1317 | }; |
| 1318 | |
| 1319 | /* |
| 1320 | * 6ch mode |
| 1321 | */ |
| 1322 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { |
| 1323 | /* Mic-in jack as CLFE */ |
| 1324 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1325 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1326 | /* Line-in jack as Surround */ |
| 1327 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1328 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1329 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ |
| 1330 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1331 | { } /* end */ |
| 1332 | }; |
| 1333 | |
| 1334 | /* |
| 1335 | * 8ch mode |
| 1336 | */ |
| 1337 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { |
| 1338 | /* Mic-in jack as CLFE */ |
| 1339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1341 | /* Line-in jack as Surround */ |
| 1342 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1343 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1344 | /* Line-Out as Side */ |
| 1345 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1346 | { } /* end */ |
| 1347 | }; |
| 1348 | |
| 1349 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { |
| 1350 | { 2, alc888_4ST_ch2_intel_init }, |
| 1351 | { 4, alc888_4ST_ch4_intel_init }, |
| 1352 | { 6, alc888_4ST_ch6_intel_init }, |
| 1353 | { 8, alc888_4ST_ch8_intel_init }, |
| 1354 | }; |
| 1355 | |
| 1356 | /* |
| 1357 | * ALC888 Fujitsu Siemens Amillo xa3530 |
| 1358 | */ |
| 1359 | |
| 1360 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { |
| 1361 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1362 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1363 | /* Connect Internal HP to Front */ |
| 1364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1366 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1367 | /* Connect Bass HP to Front */ |
| 1368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1369 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1371 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 1372 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1373 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1374 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 1375 | /* Connect Mic jack to CLFE */ |
| 1376 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1377 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1378 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1379 | /* Connect Line-in jack to Surround */ |
| 1380 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1381 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1382 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1383 | /* Connect HP out jack to Front */ |
| 1384 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1385 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1386 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1387 | /* Enable unsolicited event for HP jack and Line-out jack */ |
| 1388 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1389 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1390 | {} |
| 1391 | }; |
| 1392 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1393 | static void alc_automute_amp(struct hda_codec *codec) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1394 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1395 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1396 | unsigned int val, mute, pincap; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1397 | hda_nid_t nid; |
| 1398 | int i; |
| 1399 | |
| 1400 | spec->jack_present = 0; |
| 1401 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
| 1402 | nid = spec->autocfg.hp_pins[i]; |
| 1403 | if (!nid) |
| 1404 | break; |
Takashi Iwai | 261c240 | 2009-06-25 08:13:40 +0200 | [diff] [blame] | 1405 | pincap = snd_hda_query_pin_caps(codec, nid); |
| 1406 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
| 1407 | snd_hda_codec_read(codec, nid, 0, |
| 1408 | AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1409 | val = snd_hda_codec_read(codec, nid, 0, |
| 1410 | AC_VERB_GET_PIN_SENSE, 0); |
| 1411 | if (val & AC_PINSENSE_PRESENCE) { |
| 1412 | spec->jack_present = 1; |
| 1413 | break; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1418 | /* Toggle internal speakers muting */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1419 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
| 1420 | nid = spec->autocfg.speaker_pins[i]; |
| 1421 | if (!nid) |
| 1422 | break; |
| 1423 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 1424 | HDA_AMP_MUTE, mute); |
| 1425 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1426 | } |
| 1427 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1428 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, |
| 1429 | unsigned int res) |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1430 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1431 | if (codec->vendor_id == 0x10ec0880) |
| 1432 | res >>= 28; |
| 1433 | else |
| 1434 | res >>= 26; |
| 1435 | if (res == ALC880_HP_EVENT) |
| 1436 | alc_automute_amp(codec); |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1437 | } |
| 1438 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1439 | static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec) |
| 1440 | { |
| 1441 | struct alc_spec *spec = codec->spec; |
| 1442 | |
| 1443 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ |
| 1444 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ |
| 1445 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ |
| 1446 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ |
| 1447 | alc_automute_amp(codec); |
| 1448 | } |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1449 | |
| 1450 | /* |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1451 | * ALC888 Acer Aspire 4930G model |
| 1452 | */ |
| 1453 | |
| 1454 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { |
| 1455 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1456 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1457 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1458 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1459 | /* Enable unsolicited event for HP jack */ |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1460 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1461 | /* Connect Internal HP to front */ |
| 1462 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1463 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1464 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1465 | /* Connect HP out to front */ |
| 1466 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1467 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1468 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1469 | { } |
| 1470 | }; |
| 1471 | |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1472 | /* |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1473 | * ALC888 Acer Aspire 6530G model |
| 1474 | */ |
| 1475 | |
| 1476 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { |
| 1477 | /* Bias voltage on for external mic port */ |
| 1478 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1479 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1480 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1481 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1483 | /* Enable unsolicited event for HP jack */ |
| 1484 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1485 | /* Enable speaker output */ |
| 1486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1487 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1488 | /* Enable headphone output */ |
| 1489 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
| 1490 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1492 | { } |
| 1493 | }; |
| 1494 | |
| 1495 | /* |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1496 | * ALC889 Acer Aspire 8930G model |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1497 | */ |
| 1498 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1499 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1500 | /* Front Mic: set to PIN_IN (empty by default) */ |
| 1501 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1502 | /* Unselect Front Mic by default in input mixer 3 */ |
| 1503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, |
| 1504 | /* Enable unsolicited event for HP jack */ |
| 1505 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 1506 | /* Connect Internal Front to Front */ |
| 1507 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1508 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1509 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1510 | /* Connect Internal Rear to Rear */ |
| 1511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1513 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1514 | /* Connect Internal CLFE to CLFE */ |
| 1515 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1516 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1517 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1518 | /* Connect HP out to Front */ |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1520 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1521 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1522 | /* Enable all DACs */ |
| 1523 | /* DAC DISABLE/MUTE 1? */ |
| 1524 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ |
| 1525 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, |
| 1526 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1527 | /* DAC DISABLE/MUTE 2? */ |
| 1528 | /* some bit here disables the other DACs. Init=0x4900 */ |
| 1529 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
| 1530 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
| 1531 | /* Enable amplifiers */ |
| 1532 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 1533 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1534 | /* DMIC fix |
| 1535 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
| 1536 | * which makes the stereo useless. However, either the mic or the ALC889 |
| 1537 | * makes the signal become a difference/sum signal instead of standard |
| 1538 | * stereo, which is annoying. So instead we flip this bit which makes the |
| 1539 | * codec replicate the sum signal to both channels, turning it into a |
| 1540 | * normal mono mic. |
| 1541 | */ |
| 1542 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1543 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 1544 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1545 | { } |
| 1546 | }; |
| 1547 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1548 | static struct hda_input_mux alc888_2_capture_sources[2] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1549 | /* Front mic only available on one ADC */ |
| 1550 | { |
| 1551 | .num_items = 4, |
| 1552 | .items = { |
| 1553 | { "Mic", 0x0 }, |
| 1554 | { "Line", 0x2 }, |
| 1555 | { "CD", 0x4 }, |
| 1556 | { "Front Mic", 0xb }, |
| 1557 | }, |
| 1558 | }, |
| 1559 | { |
| 1560 | .num_items = 3, |
| 1561 | .items = { |
| 1562 | { "Mic", 0x0 }, |
| 1563 | { "Line", 0x2 }, |
| 1564 | { "CD", 0x4 }, |
| 1565 | }, |
| 1566 | } |
| 1567 | }; |
| 1568 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1569 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { |
| 1570 | /* Interal mic only available on one ADC */ |
| 1571 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1572 | .num_items = 5, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1573 | .items = { |
| 1574 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1575 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1576 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1577 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1578 | { "Int Mic", 0xb }, |
| 1579 | }, |
| 1580 | }, |
| 1581 | { |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1582 | .num_items = 4, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1583 | .items = { |
| 1584 | { "Ext Mic", 0x0 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1585 | { "Line In", 0x2 }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1586 | { "CD", 0x4 }, |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 1587 | { "Input Mix", 0xa }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 1588 | }, |
| 1589 | } |
| 1590 | }; |
| 1591 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1592 | static struct hda_input_mux alc889_capture_sources[3] = { |
| 1593 | /* Digital mic only available on first "ADC" */ |
| 1594 | { |
| 1595 | .num_items = 5, |
| 1596 | .items = { |
| 1597 | { "Mic", 0x0 }, |
| 1598 | { "Line", 0x2 }, |
| 1599 | { "CD", 0x4 }, |
| 1600 | { "Front Mic", 0xb }, |
| 1601 | { "Input Mix", 0xa }, |
| 1602 | }, |
| 1603 | }, |
| 1604 | { |
| 1605 | .num_items = 4, |
| 1606 | .items = { |
| 1607 | { "Mic", 0x0 }, |
| 1608 | { "Line", 0x2 }, |
| 1609 | { "CD", 0x4 }, |
| 1610 | { "Input Mix", 0xa }, |
| 1611 | }, |
| 1612 | }, |
| 1613 | { |
| 1614 | .num_items = 4, |
| 1615 | .items = { |
| 1616 | { "Mic", 0x0 }, |
| 1617 | { "Line", 0x2 }, |
| 1618 | { "CD", 0x4 }, |
| 1619 | { "Input Mix", 0xa }, |
| 1620 | }, |
| 1621 | } |
| 1622 | }; |
| 1623 | |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 1624 | static struct snd_kcontrol_new alc888_base_mixer[] = { |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1625 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1626 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1627 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1628 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1629 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 1630 | HDA_OUTPUT), |
| 1631 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1632 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1633 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1634 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 1635 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 1636 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1637 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1638 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1639 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1640 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1641 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 1642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1643 | { } /* end */ |
| 1644 | }; |
| 1645 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1646 | static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec) |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1647 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1648 | struct alc_spec *spec = codec->spec; |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1649 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 1650 | spec->autocfg.hp_pins[0] = 0x15; |
| 1651 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1652 | alc_automute_amp(codec); |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1653 | } |
| 1654 | |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 1655 | static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec) |
| 1656 | { |
| 1657 | struct alc_spec *spec = codec->spec; |
| 1658 | |
| 1659 | spec->autocfg.hp_pins[0] = 0x15; |
| 1660 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1661 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1662 | spec->autocfg.speaker_pins[2] = 0x17; |
| 1663 | alc_automute_amp(codec); |
| 1664 | } |
| 1665 | |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 1666 | static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec) |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 1667 | { |
| 1668 | struct alc_spec *spec = codec->spec; |
| 1669 | |
| 1670 | spec->autocfg.hp_pins[0] = 0x15; |
| 1671 | spec->autocfg.speaker_pins[0] = 0x14; |
| 1672 | spec->autocfg.speaker_pins[1] = 0x16; |
| 1673 | spec->autocfg.speaker_pins[2] = 0x1b; |
| 1674 | alc_automute_amp(codec); |
| 1675 | } |
| 1676 | |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 1677 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | * ALC880 3-stack model |
| 1679 | * |
| 1680 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1681 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1682 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1683 | */ |
| 1684 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | static hda_nid_t alc880_dac_nids[4] = { |
| 1686 | /* front, rear, clfe, rear_surr */ |
| 1687 | 0x02, 0x05, 0x04, 0x03 |
| 1688 | }; |
| 1689 | |
| 1690 | static hda_nid_t alc880_adc_nids[3] = { |
| 1691 | /* ADC0-2 */ |
| 1692 | 0x07, 0x08, 0x09, |
| 1693 | }; |
| 1694 | |
| 1695 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1696 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1697 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1700 | /* ADC1-2 */ |
| 1701 | 0x08, 0x09, |
| 1702 | }; |
| 1703 | |
| 1704 | #define ALC880_DIGOUT_NID 0x06 |
| 1705 | #define ALC880_DIGIN_NID 0x0a |
| 1706 | |
| 1707 | static struct hda_input_mux alc880_capture_source = { |
| 1708 | .num_items = 4, |
| 1709 | .items = { |
| 1710 | { "Mic", 0x0 }, |
| 1711 | { "Front Mic", 0x3 }, |
| 1712 | { "Line", 0x2 }, |
| 1713 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1715 | }; |
| 1716 | |
| 1717 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1718 | /* 2ch mode */ |
| 1719 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1720 | /* set line-in to input, mute it */ |
| 1721 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1722 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1723 | /* set mic-in to input vref 80%, mute it */ |
| 1724 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1725 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1726 | { } /* end */ |
| 1727 | }; |
| 1728 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | /* 6ch mode */ |
| 1730 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1731 | /* set line-in to output, unmute it */ |
| 1732 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1733 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1734 | /* set mic-in to output, unmute it */ |
| 1735 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1736 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1737 | { } /* end */ |
| 1738 | }; |
| 1739 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1740 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | { 2, alc880_threestack_ch2_init }, |
| 1742 | { 6, alc880_threestack_ch6_init }, |
| 1743 | }; |
| 1744 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1745 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1747 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1748 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1749 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1750 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1751 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 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), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1754 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1755 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1756 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1757 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1758 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1759 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1760 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1761 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | { |
| 1764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1765 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1766 | .info = alc_ch_mode_info, |
| 1767 | .get = alc_ch_mode_get, |
| 1768 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1769 | }, |
| 1770 | { } /* end */ |
| 1771 | }; |
| 1772 | |
| 1773 | /* capture mixer elements */ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1774 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, |
| 1775 | struct snd_ctl_elem_info *uinfo) |
| 1776 | { |
| 1777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1778 | struct alc_spec *spec = codec->spec; |
| 1779 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1780 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1781 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1782 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1783 | HDA_INPUT); |
| 1784 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1785 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1786 | return err; |
| 1787 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1788 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1789 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
| 1790 | unsigned int size, unsigned int __user *tlv) |
| 1791 | { |
| 1792 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1793 | struct alc_spec *spec = codec->spec; |
| 1794 | int err; |
| 1795 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1796 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1797 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, |
| 1798 | HDA_INPUT); |
| 1799 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1800 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1801 | return err; |
| 1802 | } |
| 1803 | |
| 1804 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, |
| 1805 | struct snd_ctl_elem_value *ucontrol); |
| 1806 | |
| 1807 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, |
| 1808 | struct snd_ctl_elem_value *ucontrol, |
| 1809 | getput_call_t func) |
| 1810 | { |
| 1811 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1812 | struct alc_spec *spec = codec->spec; |
| 1813 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 1814 | int err; |
| 1815 | |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1816 | mutex_lock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1817 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], |
| 1818 | 3, 0, HDA_INPUT); |
| 1819 | err = func(kcontrol, ucontrol); |
Wu Fengguang | 5a9e02e | 2009-01-09 16:45:24 +0800 | [diff] [blame] | 1820 | mutex_unlock(&codec->control_mutex); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1821 | return err; |
| 1822 | } |
| 1823 | |
| 1824 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, |
| 1825 | struct snd_ctl_elem_value *ucontrol) |
| 1826 | { |
| 1827 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1828 | snd_hda_mixer_amp_volume_get); |
| 1829 | } |
| 1830 | |
| 1831 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, |
| 1832 | struct snd_ctl_elem_value *ucontrol) |
| 1833 | { |
| 1834 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1835 | snd_hda_mixer_amp_volume_put); |
| 1836 | } |
| 1837 | |
| 1838 | /* capture mixer elements */ |
| 1839 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info |
| 1840 | |
| 1841 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, |
| 1842 | struct snd_ctl_elem_value *ucontrol) |
| 1843 | { |
| 1844 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1845 | snd_hda_mixer_amp_switch_get); |
| 1846 | } |
| 1847 | |
| 1848 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, |
| 1849 | struct snd_ctl_elem_value *ucontrol) |
| 1850 | { |
| 1851 | return alc_cap_getput_caller(kcontrol, ucontrol, |
| 1852 | snd_hda_mixer_amp_switch_put); |
| 1853 | } |
| 1854 | |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1855 | #define _DEFINE_CAPMIX(num) \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1856 | { \ |
| 1857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1858 | .name = "Capture Switch", \ |
| 1859 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
| 1860 | .count = num, \ |
| 1861 | .info = alc_cap_sw_info, \ |
| 1862 | .get = alc_cap_sw_get, \ |
| 1863 | .put = alc_cap_sw_put, \ |
| 1864 | }, \ |
| 1865 | { \ |
| 1866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1867 | .name = "Capture Volume", \ |
| 1868 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1869 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1870 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ |
| 1871 | .count = num, \ |
| 1872 | .info = alc_cap_vol_info, \ |
| 1873 | .get = alc_cap_vol_get, \ |
| 1874 | .put = alc_cap_vol_put, \ |
| 1875 | .tlv = { .c = alc_cap_vol_tlv }, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
| 1878 | #define _DEFINE_CAPSRC(num) \ |
Takashi Iwai | 3c3e989 | 2008-10-31 17:48:56 +0100 | [diff] [blame] | 1879 | { \ |
| 1880 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1881 | /* .name = "Capture Source", */ \ |
| 1882 | .name = "Input Source", \ |
| 1883 | .count = num, \ |
| 1884 | .info = alc_mux_enum_info, \ |
| 1885 | .get = alc_mux_enum_get, \ |
| 1886 | .put = alc_mux_enum_put, \ |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1887 | } |
| 1888 | |
| 1889 | #define DEFINE_CAPMIX(num) \ |
| 1890 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ |
| 1891 | _DEFINE_CAPMIX(num), \ |
| 1892 | _DEFINE_CAPSRC(num), \ |
| 1893 | { } /* end */ \ |
| 1894 | } |
| 1895 | |
| 1896 | #define DEFINE_CAPMIX_NOSRC(num) \ |
| 1897 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ |
| 1898 | _DEFINE_CAPMIX(num), \ |
| 1899 | { } /* end */ \ |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 1900 | } |
| 1901 | |
| 1902 | /* up to three ADCs */ |
| 1903 | DEFINE_CAPMIX(1); |
| 1904 | DEFINE_CAPMIX(2); |
| 1905 | DEFINE_CAPMIX(3); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 1906 | DEFINE_CAPMIX_NOSRC(1); |
| 1907 | DEFINE_CAPMIX_NOSRC(2); |
| 1908 | DEFINE_CAPMIX_NOSRC(3); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1909 | |
| 1910 | /* |
| 1911 | * ALC880 5-stack model |
| 1912 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1913 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1914 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1915 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1916 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1917 | */ |
| 1918 | |
| 1919 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1920 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1921 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1922 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1923 | { } /* end */ |
| 1924 | }; |
| 1925 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1926 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1927 | /* 6ch mode */ |
| 1928 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1929 | /* set line-in to input, mute it */ |
| 1930 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1931 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1932 | { } /* end */ |
| 1933 | }; |
| 1934 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1935 | /* 8ch mode */ |
| 1936 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1937 | /* set line-in to output, unmute it */ |
| 1938 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1939 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1940 | { } /* end */ |
| 1941 | }; |
| 1942 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1943 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1944 | { 6, alc880_fivestack_ch6_init }, |
| 1945 | { 8, alc880_fivestack_ch8_init }, |
| 1946 | }; |
| 1947 | |
| 1948 | |
| 1949 | /* |
| 1950 | * ALC880 6-stack model |
| 1951 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1952 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1953 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1954 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1955 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1956 | */ |
| 1957 | |
| 1958 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1959 | /* front, rear, clfe, rear_surr */ |
| 1960 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1961 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1962 | |
| 1963 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1964 | .num_items = 4, |
| 1965 | .items = { |
| 1966 | { "Mic", 0x0 }, |
| 1967 | { "Front Mic", 0x1 }, |
| 1968 | { "Line", 0x2 }, |
| 1969 | { "CD", 0x4 }, |
| 1970 | }, |
| 1971 | }; |
| 1972 | |
| 1973 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1974 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1975 | { 8, NULL }, |
| 1976 | }; |
| 1977 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1978 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1979 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1980 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1981 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1982 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1983 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1984 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1985 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1986 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1987 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1988 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1989 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1990 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1995 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1996 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1997 | { |
| 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1999 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2000 | .info = alc_ch_mode_info, |
| 2001 | .get = alc_ch_mode_get, |
| 2002 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2003 | }, |
| 2004 | { } /* end */ |
| 2005 | }; |
| 2006 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2007 | |
| 2008 | /* |
| 2009 | * ALC880 W810 model |
| 2010 | * |
| 2011 | * W810 has rear IO for: |
| 2012 | * Front (DAC 02) |
| 2013 | * Surround (DAC 03) |
| 2014 | * Center/LFE (DAC 04) |
| 2015 | * Digital out (06) |
| 2016 | * |
| 2017 | * The system also has a pair of internal speakers, and a headphone jack. |
| 2018 | * 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] | 2019 | * |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2020 | * There is a variable resistor to control the speaker or headphone |
| 2021 | * volume. This is a hardware-only device without a software API. |
| 2022 | * |
| 2023 | * Plugging headphones in will disable the internal speakers. This is |
| 2024 | * implemented in hardware, not via the driver using jack sense. In |
| 2025 | * a similar fashion, plugging into the rear socket marked "front" will |
| 2026 | * disable both the speakers and headphones. |
| 2027 | * |
| 2028 | * For input, there's a microphone jack, and an "audio in" jack. |
| 2029 | * These may not do anything useful with this driver yet, because I |
| 2030 | * haven't setup any initialization verbs for these yet... |
| 2031 | */ |
| 2032 | |
| 2033 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 2034 | /* front, rear/surround, clfe */ |
| 2035 | 0x02, 0x03, 0x04 |
| 2036 | }; |
| 2037 | |
| 2038 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2039 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2040 | { 6, NULL } |
| 2041 | }; |
| 2042 | |
| 2043 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2044 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2045 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2046 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2047 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2048 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2050 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2051 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2052 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2053 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2054 | { } /* end */ |
| 2055 | }; |
| 2056 | |
| 2057 | |
| 2058 | /* |
| 2059 | * Z710V model |
| 2060 | * |
| 2061 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2062 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 2063 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2064 | */ |
| 2065 | |
| 2066 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 2067 | 0x02 |
| 2068 | }; |
| 2069 | #define ALC880_Z71V_HP_DAC 0x03 |
| 2070 | |
| 2071 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2072 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2073 | { 2, NULL } |
| 2074 | }; |
| 2075 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2076 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2077 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2078 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2079 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2080 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2081 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2082 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2083 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2084 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2085 | { } /* end */ |
| 2086 | }; |
| 2087 | |
| 2088 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2089 | /* |
| 2090 | * ALC880 F1734 model |
| 2091 | * |
| 2092 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 2093 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 2094 | */ |
| 2095 | |
| 2096 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 2097 | 0x03 |
| 2098 | }; |
| 2099 | #define ALC880_F1734_HP_DAC 0x02 |
| 2100 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2101 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2102 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2103 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2104 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 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), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2109 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2110 | { } /* end */ |
| 2111 | }; |
| 2112 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2113 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 2114 | .num_items = 2, |
| 2115 | .items = { |
| 2116 | { "Mic", 0x1 }, |
| 2117 | { "CD", 0x4 }, |
| 2118 | }, |
| 2119 | }; |
| 2120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2122 | /* |
| 2123 | * ALC880 ASUS model |
| 2124 | * |
| 2125 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2126 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2127 | * Mic = 0x18, Line = 0x1a |
| 2128 | */ |
| 2129 | |
| 2130 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 2131 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 2132 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2133 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2134 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2135 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2136 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2137 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2138 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2139 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2140 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2141 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2142 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2143 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2144 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2145 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2146 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2147 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2148 | { |
| 2149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2150 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2151 | .info = alc_ch_mode_info, |
| 2152 | .get = alc_ch_mode_get, |
| 2153 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2154 | }, |
| 2155 | { } /* end */ |
| 2156 | }; |
| 2157 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2158 | /* |
| 2159 | * ALC880 ASUS W1V model |
| 2160 | * |
| 2161 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 2162 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 2163 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 2164 | */ |
| 2165 | |
| 2166 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2167 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2168 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 2169 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2170 | { } /* end */ |
| 2171 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2172 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2173 | /* TCL S700 */ |
| 2174 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 2175 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2176 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 2177 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 2178 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 2179 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 2180 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 2181 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 2182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 2183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2184 | { } /* end */ |
| 2185 | }; |
| 2186 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2187 | /* Uniwill */ |
| 2188 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2189 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2190 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2191 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2192 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2193 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2194 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2195 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2196 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2197 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2198 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2199 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2200 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 2201 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2202 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2203 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2204 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2205 | { |
| 2206 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2207 | .name = "Channel Mode", |
| 2208 | .info = alc_ch_mode_info, |
| 2209 | .get = alc_ch_mode_get, |
| 2210 | .put = alc_ch_mode_put, |
| 2211 | }, |
| 2212 | { } /* end */ |
| 2213 | }; |
| 2214 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2215 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 2216 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2217 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2218 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2219 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 2222 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2223 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2224 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2225 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2226 | { } /* end */ |
| 2227 | }; |
| 2228 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2229 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2230 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2231 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2232 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2233 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2236 | { } /* end */ |
| 2237 | }; |
| 2238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2239 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2240 | * virtual master controls |
| 2241 | */ |
| 2242 | |
| 2243 | /* |
| 2244 | * slave controls for virtual master |
| 2245 | */ |
| 2246 | static const char *alc_slave_vols[] = { |
| 2247 | "Front Playback Volume", |
| 2248 | "Surround Playback Volume", |
| 2249 | "Center Playback Volume", |
| 2250 | "LFE Playback Volume", |
| 2251 | "Side Playback Volume", |
| 2252 | "Headphone Playback Volume", |
| 2253 | "Speaker Playback Volume", |
| 2254 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2255 | "Line-Out Playback Volume", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 2256 | "PCM Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2257 | NULL, |
| 2258 | }; |
| 2259 | |
| 2260 | static const char *alc_slave_sws[] = { |
| 2261 | "Front Playback Switch", |
| 2262 | "Surround Playback Switch", |
| 2263 | "Center Playback Switch", |
| 2264 | "LFE Playback Switch", |
| 2265 | "Side Playback Switch", |
| 2266 | "Headphone Playback Switch", |
| 2267 | "Speaker Playback Switch", |
| 2268 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 2269 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2270 | NULL, |
| 2271 | }; |
| 2272 | |
| 2273 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2274 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2275 | */ |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2276 | |
| 2277 | static void alc_free_kctls(struct hda_codec *codec); |
| 2278 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2279 | /* additional beep mixers; the actual parameters are overwritten at build */ |
| 2280 | static struct snd_kcontrol_new alc_beep_mixer[] = { |
| 2281 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
| 2282 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), |
| 2283 | { } /* end */ |
| 2284 | }; |
| 2285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2286 | static int alc_build_controls(struct hda_codec *codec) |
| 2287 | { |
| 2288 | struct alc_spec *spec = codec->spec; |
| 2289 | int err; |
| 2290 | int i; |
| 2291 | |
| 2292 | for (i = 0; i < spec->num_mixers; i++) { |
| 2293 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 2294 | if (err < 0) |
| 2295 | return err; |
| 2296 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 2297 | if (spec->cap_mixer) { |
| 2298 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); |
| 2299 | if (err < 0) |
| 2300 | return err; |
| 2301 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2302 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2303 | err = snd_hda_create_spdif_out_ctls(codec, |
| 2304 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2305 | if (err < 0) |
| 2306 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2307 | if (!spec->no_analog) { |
| 2308 | err = snd_hda_create_spdif_share_sw(codec, |
| 2309 | &spec->multiout); |
| 2310 | if (err < 0) |
| 2311 | return err; |
| 2312 | spec->multiout.share_spdif = 1; |
| 2313 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2314 | } |
| 2315 | if (spec->dig_in_nid) { |
| 2316 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 2317 | if (err < 0) |
| 2318 | return err; |
| 2319 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2320 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 2321 | /* create beep controls if needed */ |
| 2322 | if (spec->beep_amp) { |
| 2323 | struct snd_kcontrol_new *knew; |
| 2324 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 2325 | struct snd_kcontrol *kctl; |
| 2326 | kctl = snd_ctl_new1(knew, codec); |
| 2327 | if (!kctl) |
| 2328 | return -ENOMEM; |
| 2329 | kctl->private_value = spec->beep_amp; |
| 2330 | err = snd_hda_ctl_add(codec, kctl); |
| 2331 | if (err < 0) |
| 2332 | return err; |
| 2333 | } |
| 2334 | } |
| 2335 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2336 | /* if we have no master control, let's create it */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2337 | if (!spec->no_analog && |
| 2338 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2339 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2340 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2341 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2342 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 2343 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2344 | if (err < 0) |
| 2345 | return err; |
| 2346 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 2347 | if (!spec->no_analog && |
| 2348 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2349 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 2350 | NULL, alc_slave_sws); |
| 2351 | if (err < 0) |
| 2352 | return err; |
| 2353 | } |
| 2354 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2355 | alc_free_kctls(codec); /* no longer needed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2356 | return 0; |
| 2357 | } |
| 2358 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2359 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2360 | /* |
| 2361 | * initialize the codec volumes, etc |
| 2362 | */ |
| 2363 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2364 | /* |
| 2365 | * generic initialization of ADC, input mixers and output mixers |
| 2366 | */ |
| 2367 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 2368 | /* |
| 2369 | * Unmute ADC0-2 and set the default input to mic-in |
| 2370 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2371 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2372 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2373 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2375 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2378 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 2379 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2380 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 2381 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2383 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2384 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2385 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2386 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2387 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2388 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 2389 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2390 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2392 | /* |
| 2393 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2395 | /* set vol=0 to output mixers */ |
| 2396 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2400 | /* set up input amps for analog loopback */ |
| 2401 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2402 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2403 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2404 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2405 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2406 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2407 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2408 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2409 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | |
| 2411 | { } |
| 2412 | }; |
| 2413 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2414 | /* |
| 2415 | * 3-stack pin configuration: |
| 2416 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 2417 | */ |
| 2418 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 2419 | /* |
| 2420 | * preset connection lists of input pins |
| 2421 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2422 | */ |
| 2423 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2424 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2425 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2426 | |
| 2427 | /* |
| 2428 | * Set pin mode and muting |
| 2429 | */ |
| 2430 | /* set front pin widgets 0x14 for output */ |
| 2431 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2432 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2433 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2434 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2435 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2436 | /* Mic2 (as headphone out) for HP output */ |
| 2437 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2438 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2439 | /* Line In pin widget for input */ |
| 2440 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2441 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2442 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2443 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2444 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2445 | /* CD pin widget for input */ |
| 2446 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2447 | |
| 2448 | { } |
| 2449 | }; |
| 2450 | |
| 2451 | /* |
| 2452 | * 5-stack pin configuration: |
| 2453 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 2454 | * line-in/side = 0x1a, f-mic = 0x1b |
| 2455 | */ |
| 2456 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 2457 | /* |
| 2458 | * preset connection lists of input pins |
| 2459 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 2460 | */ |
| 2461 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2462 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 2463 | |
| 2464 | /* |
| 2465 | * Set pin mode and muting |
| 2466 | */ |
| 2467 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2468 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2470 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2471 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2472 | /* unmute pins for output (no gain on this amp) */ |
| 2473 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2474 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2475 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2476 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2477 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2478 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2480 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2481 | /* Mic2 (as headphone out) for HP output */ |
| 2482 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2483 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2484 | /* Line In pin widget for input */ |
| 2485 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2486 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2487 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 2488 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2489 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2490 | /* CD pin widget for input */ |
| 2491 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | |
| 2493 | { } |
| 2494 | }; |
| 2495 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2496 | /* |
| 2497 | * W810 pin configuration: |
| 2498 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 2499 | */ |
| 2500 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | /* hphone/speaker input selector: front DAC */ |
| 2502 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 2503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2504 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2506 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2507 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2508 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2509 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2510 | |
| 2511 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2512 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | { } |
| 2515 | }; |
| 2516 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2517 | /* |
| 2518 | * Z71V pin configuration: |
| 2519 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 2520 | */ |
| 2521 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2522 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2524 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2525 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2526 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2527 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2528 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2529 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2530 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 2531 | |
| 2532 | { } |
| 2533 | }; |
| 2534 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2535 | /* |
| 2536 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2537 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 2538 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2539 | */ |
| 2540 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 2541 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2542 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2543 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2544 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2545 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2546 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2547 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2548 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2549 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2550 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2551 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2552 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2553 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2554 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2555 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2556 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2557 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2558 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2559 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2560 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2562 | { } |
| 2563 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2564 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2565 | /* |
| 2566 | * Uniwill pin configuration: |
| 2567 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 2568 | * line = 0x1a |
| 2569 | */ |
| 2570 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 2571 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2572 | |
| 2573 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2574 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2576 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2577 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2578 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2579 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2580 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2583 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2584 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2585 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2586 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2587 | |
| 2588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2589 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2590 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2591 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2592 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2593 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2594 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 2595 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 2596 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2597 | |
| 2598 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2599 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 2600 | |
| 2601 | { } |
| 2602 | }; |
| 2603 | |
| 2604 | /* |
| 2605 | * Uniwill P53 |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2606 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2607 | */ |
| 2608 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 2609 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2610 | |
| 2611 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2612 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2613 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2614 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2615 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2616 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2618 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2619 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2620 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2621 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 2622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 2623 | |
| 2624 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2625 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2626 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2627 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2628 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2629 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2630 | |
| 2631 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2632 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 2633 | |
| 2634 | { } |
| 2635 | }; |
| 2636 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2637 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 2638 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 2639 | { } |
| 2640 | }; |
| 2641 | |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2642 | /* auto-toggle front mic */ |
| 2643 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 2644 | { |
| 2645 | unsigned int present; |
| 2646 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2647 | |
| 2648 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 2649 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2650 | bits = present ? HDA_AMP_MUTE : 0; |
| 2651 | 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] | 2652 | } |
| 2653 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2654 | static void alc880_uniwill_init_hook(struct hda_codec *codec) |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2655 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2656 | struct alc_spec *spec = codec->spec; |
| 2657 | |
| 2658 | spec->autocfg.hp_pins[0] = 0x14; |
| 2659 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2660 | spec->autocfg.speaker_pins[0] = 0x16; |
| 2661 | alc_automute_amp(codec); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2662 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2663 | } |
| 2664 | |
| 2665 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 2666 | unsigned int res) |
| 2667 | { |
| 2668 | /* Looks like the unsol event is incompatible with the standard |
| 2669 | * definition. 4bit tag is placed at 28 bit! |
| 2670 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2671 | switch (res >> 28) { |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2672 | case ALC880_MIC_EVENT: |
| 2673 | alc880_uniwill_mic_automute(codec); |
| 2674 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2675 | default: |
| 2676 | alc_automute_amp_unsol_event(codec, res); |
| 2677 | break; |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 2678 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2679 | } |
| 2680 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2681 | static void alc880_uniwill_p53_init_hook(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2682 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2683 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2684 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2685 | spec->autocfg.hp_pins[0] = 0x14; |
| 2686 | spec->autocfg.speaker_pins[0] = 0x15; |
| 2687 | alc_automute_amp(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2688 | } |
| 2689 | |
| 2690 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 2691 | { |
| 2692 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2693 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2694 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2695 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 2696 | present &= HDA_AMP_VOLMASK; |
| 2697 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 2698 | HDA_AMP_VOLMASK, present); |
| 2699 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 2700 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2701 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2702 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2703 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 2704 | unsigned int res) |
| 2705 | { |
| 2706 | /* Looks like the unsol event is incompatible with the standard |
| 2707 | * definition. 4bit tag is placed at 28 bit! |
| 2708 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2710 | alc880_uniwill_p53_dcvol_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2711 | else |
| 2712 | alc_automute_amp_unsol_event(codec, res); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 2713 | } |
| 2714 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2715 | /* |
| 2716 | * F1734 pin configuration: |
| 2717 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 2718 | */ |
| 2719 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2720 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2721 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2722 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2723 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2724 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2725 | |
| 2726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2727 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2728 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2729 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2730 | |
| 2731 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2733 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2734 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2735 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2736 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2737 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2738 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2739 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2740 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2741 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2742 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2743 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2744 | { } |
| 2745 | }; |
| 2746 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2747 | /* |
| 2748 | * ASUS pin configuration: |
| 2749 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2750 | */ |
| 2751 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2752 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2753 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2754 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2755 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2756 | |
| 2757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2759 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2761 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2762 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2763 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2764 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2765 | |
| 2766 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2767 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2768 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2770 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2771 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2772 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2773 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2774 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 2775 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2776 | { } |
| 2777 | }; |
| 2778 | |
| 2779 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2780 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2781 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 2782 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2783 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2784 | /* Clevo m520g init */ |
| 2785 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2786 | /* headphone output */ |
| 2787 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2788 | /* line-out */ |
| 2789 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2790 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2791 | /* Line-in */ |
| 2792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2794 | /* CD */ |
| 2795 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2796 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2797 | /* Mic1 (rear panel) */ |
| 2798 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2799 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2800 | /* Mic2 (front panel) */ |
| 2801 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2802 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2803 | /* headphone */ |
| 2804 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2805 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2806 | /* change to EAPD mode */ |
| 2807 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2808 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2809 | |
| 2810 | { } |
| 2811 | }; |
| 2812 | |
| 2813 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2814 | /* change to EAPD mode */ |
| 2815 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2816 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2817 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2818 | /* Headphone output */ |
| 2819 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2820 | /* Front output*/ |
| 2821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2822 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2823 | |
| 2824 | /* Line In pin widget for input */ |
| 2825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2826 | /* CD pin widget for input */ |
| 2827 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2828 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2829 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2830 | |
| 2831 | /* change to EAPD mode */ |
| 2832 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2833 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2834 | |
| 2835 | { } |
| 2836 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2837 | |
| 2838 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2839 | * LG m1 express dual |
| 2840 | * |
| 2841 | * Pin assignment: |
| 2842 | * Rear Line-In/Out (blue): 0x14 |
| 2843 | * Build-in Mic-In: 0x15 |
| 2844 | * Speaker-out: 0x17 |
| 2845 | * HP-Out (green): 0x1b |
| 2846 | * Mic-In/Out (red): 0x19 |
| 2847 | * SPDIF-Out: 0x1e |
| 2848 | */ |
| 2849 | |
| 2850 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2851 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2852 | 0x05, 0x02, 0x03 |
| 2853 | }; |
| 2854 | |
| 2855 | /* seems analog CD is not working */ |
| 2856 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2857 | .num_items = 3, |
| 2858 | .items = { |
| 2859 | { "Mic", 0x1 }, |
| 2860 | { "Line", 0x5 }, |
| 2861 | { "Internal Mic", 0x6 }, |
| 2862 | }, |
| 2863 | }; |
| 2864 | |
| 2865 | /* 2,4,6 channel modes */ |
| 2866 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2867 | /* set line-in and mic-in to input */ |
| 2868 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2869 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2870 | { } |
| 2871 | }; |
| 2872 | |
| 2873 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2874 | /* set line-in to out and mic-in to input */ |
| 2875 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2876 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2877 | { } |
| 2878 | }; |
| 2879 | |
| 2880 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2881 | /* set line-in and mic-in to output */ |
| 2882 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2883 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2884 | { } |
| 2885 | }; |
| 2886 | |
| 2887 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2888 | { 2, alc880_lg_ch2_init }, |
| 2889 | { 4, alc880_lg_ch4_init }, |
| 2890 | { 6, alc880_lg_ch6_init }, |
| 2891 | }; |
| 2892 | |
| 2893 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2894 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2895 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2896 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2897 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2898 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2899 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2900 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2901 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2904 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2905 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2906 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2907 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2908 | { |
| 2909 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2910 | .name = "Channel Mode", |
| 2911 | .info = alc_ch_mode_info, |
| 2912 | .get = alc_ch_mode_get, |
| 2913 | .put = alc_ch_mode_put, |
| 2914 | }, |
| 2915 | { } /* end */ |
| 2916 | }; |
| 2917 | |
| 2918 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2919 | /* set capture source to mic-in */ |
| 2920 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2921 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2923 | /* mute all amp mixer inputs */ |
| 2924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2927 | /* line-in to input */ |
| 2928 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2929 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2930 | /* built-in mic */ |
| 2931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2932 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2933 | /* speaker-out */ |
| 2934 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2935 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2936 | /* mic-in to input */ |
| 2937 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2938 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2939 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2940 | /* HP-out */ |
| 2941 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2942 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2943 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2944 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2945 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2946 | { } |
| 2947 | }; |
| 2948 | |
| 2949 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2950 | static void alc880_lg_init_hook(struct hda_codec *codec) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2951 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2952 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2953 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 2954 | spec->autocfg.hp_pins[0] = 0x1b; |
| 2955 | spec->autocfg.speaker_pins[0] = 0x17; |
| 2956 | alc_automute_amp(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2957 | } |
| 2958 | |
| 2959 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2960 | * LG LW20 |
| 2961 | * |
| 2962 | * Pin assignment: |
| 2963 | * Speaker-out: 0x14 |
| 2964 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2965 | * Built-in Mic-In: 0x19 |
| 2966 | * Line-In: 0x1b |
| 2967 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2968 | * SPDIF-Out: 0x1e |
| 2969 | */ |
| 2970 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2971 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2972 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2973 | .items = { |
| 2974 | { "Mic", 0x0 }, |
| 2975 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2976 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2977 | }, |
| 2978 | }; |
| 2979 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2980 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2981 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2982 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2985 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2986 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2987 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2988 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2989 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2990 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2991 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2992 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2993 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2994 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2995 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2996 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2997 | { |
| 2998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2999 | .name = "Channel Mode", |
| 3000 | .info = alc_ch_mode_info, |
| 3001 | .get = alc_ch_mode_get, |
| 3002 | .put = alc_ch_mode_put, |
| 3003 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3004 | { } /* end */ |
| 3005 | }; |
| 3006 | |
| 3007 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3008 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3009 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 3010 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 3011 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3012 | /* set capture source to mic-in */ |
| 3013 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3014 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3015 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3016 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3017 | /* speaker-out */ |
| 3018 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3019 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3020 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3021 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3022 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3023 | /* mic-in to input */ |
| 3024 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3025 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3026 | /* built-in mic */ |
| 3027 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3028 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3029 | /* jack sense */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3030 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3031 | { } |
| 3032 | }; |
| 3033 | |
| 3034 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3035 | static void alc880_lg_lw_init_hook(struct hda_codec *codec) |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3036 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3037 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3038 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3039 | spec->autocfg.hp_pins[0] = 0x1b; |
| 3040 | spec->autocfg.speaker_pins[0] = 0x14; |
| 3041 | alc_automute_amp(codec); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3042 | } |
| 3043 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3044 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 3045 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3046 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3049 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3050 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3051 | { } /* end */ |
| 3052 | }; |
| 3053 | |
| 3054 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 3055 | .num_items = 2, |
| 3056 | .items = { |
| 3057 | { "Mic", 0x0 }, |
| 3058 | { "Internal Mic", 0x1 }, |
| 3059 | }, |
| 3060 | }; |
| 3061 | |
| 3062 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 3063 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 3064 | |
| 3065 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3066 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3067 | |
| 3068 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 3069 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3070 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3071 | /* Mic2 (as headphone out) for HP output */ |
| 3072 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 3073 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3074 | /* Internal Speaker */ |
| 3075 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3076 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3077 | |
| 3078 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 3079 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 3080 | |
| 3081 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3082 | { } |
| 3083 | }; |
| 3084 | |
| 3085 | /* toggle speaker-output according to the hp-jack state */ |
| 3086 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 3087 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3088 | struct alc_spec *spec = codec->spec; |
| 3089 | alc_automute_amp(codec); |
| 3090 | /* toggle EAPD */ |
| 3091 | if (spec->jack_present) |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3092 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 3093 | else |
| 3094 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 3095 | } |
| 3096 | |
| 3097 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 3098 | unsigned int res) |
| 3099 | { |
| 3100 | /* Looks like the unsol event is incompatible with the standard |
| 3101 | * definition. 4bit tag is placed at 28 bit! |
| 3102 | */ |
| 3103 | if ((res >> 28) == ALC880_HP_EVENT) |
| 3104 | alc880_medion_rim_automute(codec); |
| 3105 | } |
| 3106 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3107 | static void alc880_medion_rim_init_hook(struct hda_codec *codec) |
| 3108 | { |
| 3109 | struct alc_spec *spec = codec->spec; |
| 3110 | |
| 3111 | spec->autocfg.hp_pins[0] = 0x14; |
| 3112 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 3113 | alc880_medion_rim_automute(codec); |
| 3114 | } |
| 3115 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3116 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3117 | static struct hda_amp_list alc880_loopbacks[] = { |
| 3118 | { 0x0b, HDA_INPUT, 0 }, |
| 3119 | { 0x0b, HDA_INPUT, 1 }, |
| 3120 | { 0x0b, HDA_INPUT, 2 }, |
| 3121 | { 0x0b, HDA_INPUT, 3 }, |
| 3122 | { 0x0b, HDA_INPUT, 4 }, |
| 3123 | { } /* end */ |
| 3124 | }; |
| 3125 | |
| 3126 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 3127 | { 0x0b, HDA_INPUT, 1 }, |
| 3128 | { 0x0b, HDA_INPUT, 6 }, |
| 3129 | { 0x0b, HDA_INPUT, 7 }, |
| 3130 | { } /* end */ |
| 3131 | }; |
| 3132 | #endif |
| 3133 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3134 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3135 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3138 | static int alc_init(struct hda_codec *codec) |
| 3139 | { |
| 3140 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | unsigned int i; |
| 3142 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3143 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 3144 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | for (i = 0; i < spec->num_init_verbs; i++) |
| 3147 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3148 | |
| 3149 | if (spec->init_hook) |
| 3150 | spec->init_hook(codec); |
| 3151 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3152 | return 0; |
| 3153 | } |
| 3154 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3155 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3156 | { |
| 3157 | struct alc_spec *spec = codec->spec; |
| 3158 | |
| 3159 | if (spec->unsol_event) |
| 3160 | spec->unsol_event(codec, res); |
| 3161 | } |
| 3162 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3163 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3164 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 3165 | { |
| 3166 | struct alc_spec *spec = codec->spec; |
| 3167 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 3168 | } |
| 3169 | #endif |
| 3170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3171 | /* |
| 3172 | * Analog playback callbacks |
| 3173 | */ |
| 3174 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3175 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3176 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3177 | { |
| 3178 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 3179 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 3180 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3181 | } |
| 3182 | |
| 3183 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3184 | struct hda_codec *codec, |
| 3185 | unsigned int stream_tag, |
| 3186 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3187 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3188 | { |
| 3189 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3190 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 3191 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3192 | } |
| 3193 | |
| 3194 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3195 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3196 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3197 | { |
| 3198 | struct alc_spec *spec = codec->spec; |
| 3199 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 3200 | } |
| 3201 | |
| 3202 | /* |
| 3203 | * Digital out |
| 3204 | */ |
| 3205 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 3206 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3207 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3208 | { |
| 3209 | struct alc_spec *spec = codec->spec; |
| 3210 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 3211 | } |
| 3212 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3213 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 3214 | struct hda_codec *codec, |
| 3215 | unsigned int stream_tag, |
| 3216 | unsigned int format, |
| 3217 | struct snd_pcm_substream *substream) |
| 3218 | { |
| 3219 | struct alc_spec *spec = codec->spec; |
| 3220 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 3221 | stream_tag, format, substream); |
| 3222 | } |
| 3223 | |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3224 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 3225 | struct hda_codec *codec, |
| 3226 | struct snd_pcm_substream *substream) |
| 3227 | { |
| 3228 | struct alc_spec *spec = codec->spec; |
| 3229 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 3230 | } |
| 3231 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3232 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 3233 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3234 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3235 | { |
| 3236 | struct alc_spec *spec = codec->spec; |
| 3237 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 3238 | } |
| 3239 | |
| 3240 | /* |
| 3241 | * Analog capture |
| 3242 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3243 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3244 | struct hda_codec *codec, |
| 3245 | unsigned int stream_tag, |
| 3246 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3247 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3248 | { |
| 3249 | struct alc_spec *spec = codec->spec; |
| 3250 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3251 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3252 | stream_tag, 0, format); |
| 3253 | return 0; |
| 3254 | } |
| 3255 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3256 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3257 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3258 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3259 | { |
| 3260 | struct alc_spec *spec = codec->spec; |
| 3261 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 3262 | snd_hda_codec_cleanup_stream(codec, |
| 3263 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3264 | return 0; |
| 3265 | } |
| 3266 | |
| 3267 | |
| 3268 | /* |
| 3269 | */ |
| 3270 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 3271 | .substreams = 1, |
| 3272 | .channels_min = 2, |
| 3273 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3274 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3275 | .ops = { |
| 3276 | .open = alc880_playback_pcm_open, |
| 3277 | .prepare = alc880_playback_pcm_prepare, |
| 3278 | .cleanup = alc880_playback_pcm_cleanup |
| 3279 | }, |
| 3280 | }; |
| 3281 | |
| 3282 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3283 | .substreams = 1, |
| 3284 | .channels_min = 2, |
| 3285 | .channels_max = 2, |
| 3286 | /* NID is set in alc_build_pcms */ |
| 3287 | }; |
| 3288 | |
| 3289 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 3290 | .substreams = 1, |
| 3291 | .channels_min = 2, |
| 3292 | .channels_max = 2, |
| 3293 | /* NID is set in alc_build_pcms */ |
| 3294 | }; |
| 3295 | |
| 3296 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 3297 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3298 | .channels_min = 2, |
| 3299 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3300 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3301 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3302 | .prepare = alc880_alt_capture_pcm_prepare, |
| 3303 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3304 | }, |
| 3305 | }; |
| 3306 | |
| 3307 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 3308 | .substreams = 1, |
| 3309 | .channels_min = 2, |
| 3310 | .channels_max = 2, |
| 3311 | /* NID is set in alc_build_pcms */ |
| 3312 | .ops = { |
| 3313 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 3314 | .close = alc880_dig_playback_pcm_close, |
Takashi Iwai | 9b5f12e | 2009-02-13 11:47:37 +0100 | [diff] [blame] | 3315 | .prepare = alc880_dig_playback_pcm_prepare, |
| 3316 | .cleanup = alc880_dig_playback_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3317 | }, |
| 3318 | }; |
| 3319 | |
| 3320 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 3321 | .substreams = 1, |
| 3322 | .channels_min = 2, |
| 3323 | .channels_max = 2, |
| 3324 | /* NID is set in alc_build_pcms */ |
| 3325 | }; |
| 3326 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3327 | /* 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] | 3328 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3329 | .substreams = 0, |
| 3330 | .channels_min = 0, |
| 3331 | .channels_max = 0, |
| 3332 | }; |
| 3333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3334 | static int alc_build_pcms(struct hda_codec *codec) |
| 3335 | { |
| 3336 | struct alc_spec *spec = codec->spec; |
| 3337 | struct hda_pcm *info = spec->pcm_rec; |
| 3338 | int i; |
| 3339 | |
| 3340 | codec->num_pcms = 1; |
| 3341 | codec->pcm_info = info; |
| 3342 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3343 | if (spec->no_analog) |
| 3344 | goto skip_analog; |
| 3345 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3346 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), |
| 3347 | "%s Analog", codec->chip_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3348 | info->name = spec->stream_name_analog; |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3349 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3350 | if (spec->stream_analog_playback) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3351 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
| 3352 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3353 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 3354 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 3355 | } |
| 3356 | if (spec->stream_analog_capture) { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 3357 | if (snd_BUG_ON(!spec->adc_nids)) |
| 3358 | return -EINVAL; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3359 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 3360 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 3361 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3362 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3363 | if (spec->channel_mode) { |
| 3364 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 3365 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 3366 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 3367 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 3368 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3369 | } |
| 3370 | } |
| 3371 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3372 | skip_analog: |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3373 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3374 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 3375 | snprintf(spec->stream_name_digital, |
| 3376 | sizeof(spec->stream_name_digital), |
| 3377 | "%s Digital", codec->chip_name); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3378 | codec->num_pcms = 2; |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 3379 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3380 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3381 | info->name = spec->stream_name_digital; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 3382 | if (spec->dig_out_type) |
| 3383 | info->pcm_type = spec->dig_out_type; |
| 3384 | else |
| 3385 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3386 | if (spec->multiout.dig_out_nid && |
| 3387 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3388 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 3389 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 3390 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3391 | if (spec->dig_in_nid && |
| 3392 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3393 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 3394 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 3395 | } |
Takashi Iwai | 963f803 | 2008-08-11 10:04:40 +0200 | [diff] [blame] | 3396 | /* FIXME: do we need this for all Realtek codec models? */ |
| 3397 | codec->spdif_status_reset = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3398 | } |
| 3399 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 3400 | if (spec->no_analog) |
| 3401 | return 0; |
| 3402 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3403 | /* If the use of more than one ADC is requested for the current |
| 3404 | * model, configure a second analog capture-only PCM. |
| 3405 | */ |
| 3406 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3407 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 3408 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3409 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 3410 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3411 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3412 | if (spec->alt_dac_nid) { |
| 3413 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3414 | *spec->stream_analog_alt_playback; |
| 3415 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 3416 | spec->alt_dac_nid; |
| 3417 | } else { |
| 3418 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 3419 | alc_pcm_null_stream; |
| 3420 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 3421 | } |
| 3422 | if (spec->num_adc_nids > 1) { |
| 3423 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3424 | *spec->stream_analog_alt_capture; |
| 3425 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 3426 | spec->adc_nids[1]; |
| 3427 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 3428 | spec->num_adc_nids - 1; |
| 3429 | } else { |
| 3430 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 3431 | alc_pcm_null_stream; |
| 3432 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3436 | return 0; |
| 3437 | } |
| 3438 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3439 | static void alc_free_kctls(struct hda_codec *codec) |
| 3440 | { |
| 3441 | struct alc_spec *spec = codec->spec; |
| 3442 | |
| 3443 | if (spec->kctls.list) { |
| 3444 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3445 | int i; |
| 3446 | for (i = 0; i < spec->kctls.used; i++) |
| 3447 | kfree(kctl[i].name); |
| 3448 | } |
| 3449 | snd_array_free(&spec->kctls); |
| 3450 | } |
| 3451 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3452 | static void alc_free(struct hda_codec *codec) |
| 3453 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3455 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3456 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | return; |
| 3458 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3459 | alc_free_kctls(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | kfree(spec); |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 3461 | snd_hda_detach_beep_device(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3462 | } |
| 3463 | |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3464 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3465 | static int alc_resume(struct hda_codec *codec) |
| 3466 | { |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3467 | codec->patch_ops.init(codec); |
| 3468 | snd_hda_codec_resume_amp(codec); |
| 3469 | snd_hda_codec_resume_cache(codec); |
| 3470 | return 0; |
| 3471 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3472 | #endif |
| 3473 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3474 | /* |
| 3475 | */ |
| 3476 | static struct hda_codec_ops alc_patch_ops = { |
| 3477 | .build_controls = alc_build_controls, |
| 3478 | .build_pcms = alc_build_pcms, |
| 3479 | .init = alc_init, |
| 3480 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3481 | .unsol_event = alc_unsol_event, |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 3482 | #ifdef SND_HDA_NEEDS_RESUME |
| 3483 | .resume = alc_resume, |
| 3484 | #endif |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3485 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3486 | .check_power_status = alc_check_power_status, |
| 3487 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3488 | }; |
| 3489 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3490 | |
| 3491 | /* |
| 3492 | * Test configuration for debugging |
| 3493 | * |
| 3494 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 3495 | * enum controls. |
| 3496 | */ |
| 3497 | #ifdef CONFIG_SND_DEBUG |
| 3498 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 3499 | 0x02, 0x03, 0x04, 0x05 |
| 3500 | }; |
| 3501 | |
| 3502 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3503 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3504 | .items = { |
| 3505 | { "In-1", 0x0 }, |
| 3506 | { "In-2", 0x1 }, |
| 3507 | { "In-3", 0x2 }, |
| 3508 | { "In-4", 0x3 }, |
| 3509 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3510 | { "Front", 0x5 }, |
| 3511 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3512 | }, |
| 3513 | }; |
| 3514 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3515 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3516 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3517 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3518 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 3519 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3520 | }; |
| 3521 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3522 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 3523 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3524 | { |
| 3525 | static char *texts[] = { |
| 3526 | "N/A", "Line Out", "HP Out", |
| 3527 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 3528 | }; |
| 3529 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3530 | uinfo->count = 1; |
| 3531 | uinfo->value.enumerated.items = 8; |
| 3532 | if (uinfo->value.enumerated.item >= 8) |
| 3533 | uinfo->value.enumerated.item = 7; |
| 3534 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3535 | return 0; |
| 3536 | } |
| 3537 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3538 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 3539 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3540 | { |
| 3541 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3542 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3543 | unsigned int pin_ctl, item = 0; |
| 3544 | |
| 3545 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3546 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3547 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 3548 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 3549 | item = 2; |
| 3550 | else |
| 3551 | item = 1; |
| 3552 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 3553 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 3554 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 3555 | case AC_PINCTL_VREF_50: item = 4; break; |
| 3556 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 3557 | case AC_PINCTL_VREF_80: item = 6; break; |
| 3558 | case AC_PINCTL_VREF_100: item = 7; break; |
| 3559 | } |
| 3560 | } |
| 3561 | ucontrol->value.enumerated.item[0] = item; |
| 3562 | return 0; |
| 3563 | } |
| 3564 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3565 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 3566 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3567 | { |
| 3568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3569 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3570 | static unsigned int ctls[] = { |
| 3571 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 3572 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 3573 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 3574 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 3575 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 3576 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 3577 | }; |
| 3578 | unsigned int old_ctl, new_ctl; |
| 3579 | |
| 3580 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 3581 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3582 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 3583 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3584 | int val; |
| 3585 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3586 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3587 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 3588 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 3589 | HDA_AMP_MUTE : 0; |
| 3590 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 3591 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3592 | return 1; |
| 3593 | } |
| 3594 | return 0; |
| 3595 | } |
| 3596 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3597 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 3598 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3599 | { |
| 3600 | static char *texts[] = { |
| 3601 | "Front", "Surround", "CLFE", "Side" |
| 3602 | }; |
| 3603 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 3604 | uinfo->count = 1; |
| 3605 | uinfo->value.enumerated.items = 4; |
| 3606 | if (uinfo->value.enumerated.item >= 4) |
| 3607 | uinfo->value.enumerated.item = 3; |
| 3608 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 3609 | return 0; |
| 3610 | } |
| 3611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3612 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 3613 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3614 | { |
| 3615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3616 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3617 | unsigned int sel; |
| 3618 | |
| 3619 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 3620 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 3621 | return 0; |
| 3622 | } |
| 3623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3624 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 3625 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3626 | { |
| 3627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3628 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 3629 | unsigned int sel; |
| 3630 | |
| 3631 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 3632 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 3633 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3634 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3635 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3636 | return 1; |
| 3637 | } |
| 3638 | return 0; |
| 3639 | } |
| 3640 | |
| 3641 | #define PIN_CTL_TEST(xname,nid) { \ |
| 3642 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3643 | .name = xname, \ |
| 3644 | .info = alc_test_pin_ctl_info, \ |
| 3645 | .get = alc_test_pin_ctl_get, \ |
| 3646 | .put = alc_test_pin_ctl_put, \ |
| 3647 | .private_value = nid \ |
| 3648 | } |
| 3649 | |
| 3650 | #define PIN_SRC_TEST(xname,nid) { \ |
| 3651 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 3652 | .name = xname, \ |
| 3653 | .info = alc_test_pin_src_info, \ |
| 3654 | .get = alc_test_pin_src_get, \ |
| 3655 | .put = alc_test_pin_src_put, \ |
| 3656 | .private_value = nid \ |
| 3657 | } |
| 3658 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3659 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3660 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 3661 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 3662 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 3663 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3664 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 3665 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 3666 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 3667 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3668 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 3669 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 3670 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 3671 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 3672 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 3673 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 3674 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 3675 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 3676 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 3677 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 3678 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 3679 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 3680 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 3681 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 3682 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 3683 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 3684 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 3685 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 3686 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 3687 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 3688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 3689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3690 | { |
| 3691 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3692 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3693 | .info = alc_ch_mode_info, |
| 3694 | .get = alc_ch_mode_get, |
| 3695 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3696 | }, |
| 3697 | { } /* end */ |
| 3698 | }; |
| 3699 | |
| 3700 | static struct hda_verb alc880_test_init_verbs[] = { |
| 3701 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3702 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3703 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3704 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3705 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3706 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3707 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 3708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 3709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3710 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3711 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3712 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3713 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 3714 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3715 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3716 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3717 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3718 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 3719 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3720 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3721 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3722 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3723 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 3724 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3725 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3726 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 3727 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 3730 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3731 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3733 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3734 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 3735 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3736 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3737 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3738 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3739 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3740 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3741 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 3742 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3743 | /* Analog input/passthru */ |
| 3744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 3745 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 3746 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 3747 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 3748 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3749 | { } |
| 3750 | }; |
| 3751 | #endif |
| 3752 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3753 | /* |
| 3754 | */ |
| 3755 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3756 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3757 | [ALC880_3ST] = "3stack", |
| 3758 | [ALC880_TCL_S700] = "tcl", |
| 3759 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3760 | [ALC880_CLEVO] = "clevo", |
| 3761 | [ALC880_5ST] = "5stack", |
| 3762 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3763 | [ALC880_W810] = "w810", |
| 3764 | [ALC880_Z71V] = "z71v", |
| 3765 | [ALC880_6ST] = "6stack", |
| 3766 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3767 | [ALC880_ASUS] = "asus", |
| 3768 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3769 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3770 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3771 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3772 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3773 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3774 | [ALC880_F1734] = "F1734", |
| 3775 | [ALC880_LG] = "lg", |
| 3776 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3777 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3778 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3779 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3780 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3781 | [ALC880_AUTO] = "auto", |
| 3782 | }; |
| 3783 | |
| 3784 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3785 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3786 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3787 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3788 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3789 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3790 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3791 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3792 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3793 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3794 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3795 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3796 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3797 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3798 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3799 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3800 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3801 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3802 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3803 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3804 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3805 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3806 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3807 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3808 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3809 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3810 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3811 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3812 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3813 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3814 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3815 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3816 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3817 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3818 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3819 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3820 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3821 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3822 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3823 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3824 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3825 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3826 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3827 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3828 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3829 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3830 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3831 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3832 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3833 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3834 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3835 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3836 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3837 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3838 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3839 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3840 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3841 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3842 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3843 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3844 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3845 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3846 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3847 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3848 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3849 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3850 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3851 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3852 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 3853 | /* default Intel */ |
| 3854 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3855 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3856 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3857 | {} |
| 3858 | }; |
| 3859 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3860 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3861 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3862 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3863 | static struct alc_config_preset alc880_presets[] = { |
| 3864 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3865 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3866 | .init_verbs = { alc880_volume_init_verbs, |
| 3867 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3868 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3869 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3870 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3871 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3872 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3873 | .input_mux = &alc880_capture_source, |
| 3874 | }, |
| 3875 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3876 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3877 | .init_verbs = { alc880_volume_init_verbs, |
| 3878 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3879 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3880 | .dac_nids = alc880_dac_nids, |
| 3881 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3882 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3883 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3884 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3885 | .input_mux = &alc880_capture_source, |
| 3886 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3887 | [ALC880_TCL_S700] = { |
| 3888 | .mixers = { alc880_tcl_s700_mixer }, |
| 3889 | .init_verbs = { alc880_volume_init_verbs, |
| 3890 | alc880_pin_tcl_S700_init_verbs, |
| 3891 | alc880_gpio2_init_verbs }, |
| 3892 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3893 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 3894 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ |
| 3895 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3896 | .hp_nid = 0x03, |
| 3897 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3898 | .channel_mode = alc880_2_jack_modes, |
| 3899 | .input_mux = &alc880_capture_source, |
| 3900 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3901 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3902 | .mixers = { alc880_three_stack_mixer, |
| 3903 | alc880_five_stack_mixer}, |
| 3904 | .init_verbs = { alc880_volume_init_verbs, |
| 3905 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3906 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3907 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3908 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3909 | .channel_mode = alc880_fivestack_modes, |
| 3910 | .input_mux = &alc880_capture_source, |
| 3911 | }, |
| 3912 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3913 | .mixers = { alc880_three_stack_mixer, |
| 3914 | alc880_five_stack_mixer }, |
| 3915 | .init_verbs = { alc880_volume_init_verbs, |
| 3916 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3917 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3918 | .dac_nids = alc880_dac_nids, |
| 3919 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3920 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3921 | .channel_mode = alc880_fivestack_modes, |
| 3922 | .input_mux = &alc880_capture_source, |
| 3923 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3924 | [ALC880_6ST] = { |
| 3925 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3926 | .init_verbs = { alc880_volume_init_verbs, |
| 3927 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3928 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3929 | .dac_nids = alc880_6st_dac_nids, |
| 3930 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3931 | .channel_mode = alc880_sixstack_modes, |
| 3932 | .input_mux = &alc880_6stack_capture_source, |
| 3933 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3934 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3935 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3936 | .init_verbs = { alc880_volume_init_verbs, |
| 3937 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3938 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3939 | .dac_nids = alc880_6st_dac_nids, |
| 3940 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3941 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3942 | .channel_mode = alc880_sixstack_modes, |
| 3943 | .input_mux = &alc880_6stack_capture_source, |
| 3944 | }, |
| 3945 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3946 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3947 | .init_verbs = { alc880_volume_init_verbs, |
| 3948 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3949 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3950 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3951 | .dac_nids = alc880_w810_dac_nids, |
| 3952 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3953 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3954 | .channel_mode = alc880_w810_modes, |
| 3955 | .input_mux = &alc880_capture_source, |
| 3956 | }, |
| 3957 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3958 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3959 | .init_verbs = { alc880_volume_init_verbs, |
| 3960 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3961 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3962 | .dac_nids = alc880_z71v_dac_nids, |
| 3963 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3964 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3965 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3966 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3967 | .input_mux = &alc880_capture_source, |
| 3968 | }, |
| 3969 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3970 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3971 | .init_verbs = { alc880_volume_init_verbs, |
| 3972 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3973 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3974 | .dac_nids = alc880_f1734_dac_nids, |
| 3975 | .hp_nid = 0x02, |
| 3976 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3977 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3978 | .input_mux = &alc880_f1734_capture_source, |
| 3979 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 3980 | .init_hook = alc880_uniwill_p53_init_hook, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3981 | }, |
| 3982 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3983 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3984 | .init_verbs = { alc880_volume_init_verbs, |
| 3985 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3986 | alc880_gpio1_init_verbs }, |
| 3987 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3988 | .dac_nids = alc880_asus_dac_nids, |
| 3989 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3990 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3991 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3992 | .input_mux = &alc880_capture_source, |
| 3993 | }, |
| 3994 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3995 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3996 | .init_verbs = { alc880_volume_init_verbs, |
| 3997 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3998 | alc880_gpio1_init_verbs }, |
| 3999 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4000 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4001 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4002 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4003 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4004 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4005 | .input_mux = &alc880_capture_source, |
| 4006 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4007 | [ALC880_ASUS_DIG2] = { |
| 4008 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4009 | .init_verbs = { alc880_volume_init_verbs, |
| 4010 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 4012 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4013 | .dac_nids = alc880_asus_dac_nids, |
| 4014 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4015 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4016 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4017 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4018 | .input_mux = &alc880_capture_source, |
| 4019 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4020 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4021 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4022 | .init_verbs = { alc880_volume_init_verbs, |
| 4023 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4024 | alc880_gpio1_init_verbs }, |
| 4025 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4026 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4027 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4028 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4029 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4030 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4031 | .input_mux = &alc880_capture_source, |
| 4032 | }, |
| 4033 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4034 | .mixers = { alc880_asus_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4035 | .init_verbs = { alc880_volume_init_verbs, |
| 4036 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4037 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4038 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4039 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4040 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 4041 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4042 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4043 | .input_mux = &alc880_capture_source, |
| 4044 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4045 | [ALC880_UNIWILL] = { |
| 4046 | .mixers = { alc880_uniwill_mixer }, |
| 4047 | .init_verbs = { alc880_volume_init_verbs, |
| 4048 | alc880_uniwill_init_verbs }, |
| 4049 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4050 | .dac_nids = alc880_asus_dac_nids, |
| 4051 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4052 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4053 | .channel_mode = alc880_threestack_modes, |
| 4054 | .need_dac_fix = 1, |
| 4055 | .input_mux = &alc880_capture_source, |
| 4056 | .unsol_event = alc880_uniwill_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4057 | .init_hook = alc880_uniwill_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4058 | }, |
| 4059 | [ALC880_UNIWILL_P53] = { |
| 4060 | .mixers = { alc880_uniwill_p53_mixer }, |
| 4061 | .init_verbs = { alc880_volume_init_verbs, |
| 4062 | alc880_uniwill_p53_init_verbs }, |
| 4063 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 4064 | .dac_nids = alc880_asus_dac_nids, |
| 4065 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4066 | .channel_mode = alc880_threestack_modes, |
| 4067 | .input_mux = &alc880_capture_source, |
| 4068 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4069 | .init_hook = alc880_uniwill_p53_init_hook, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4070 | }, |
| 4071 | [ALC880_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4072 | .mixers = { alc880_fujitsu_mixer }, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4073 | .init_verbs = { alc880_volume_init_verbs, |
| 4074 | alc880_uniwill_p53_init_verbs, |
| 4075 | alc880_beep_init_verbs }, |
| 4076 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4077 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 4078 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 4079 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4080 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4081 | .input_mux = &alc880_capture_source, |
| 4082 | .unsol_event = alc880_uniwill_p53_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4083 | .init_hook = alc880_uniwill_p53_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 4084 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4085 | [ALC880_CLEVO] = { |
| 4086 | .mixers = { alc880_three_stack_mixer }, |
| 4087 | .init_verbs = { alc880_volume_init_verbs, |
| 4088 | alc880_pin_clevo_init_verbs }, |
| 4089 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4090 | .dac_nids = alc880_dac_nids, |
| 4091 | .hp_nid = 0x03, |
| 4092 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 4093 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4094 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4095 | .input_mux = &alc880_capture_source, |
| 4096 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4097 | [ALC880_LG] = { |
| 4098 | .mixers = { alc880_lg_mixer }, |
| 4099 | .init_verbs = { alc880_volume_init_verbs, |
| 4100 | alc880_lg_init_verbs }, |
| 4101 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 4102 | .dac_nids = alc880_lg_dac_nids, |
| 4103 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4104 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 4105 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 4106 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4107 | .input_mux = &alc880_lg_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4108 | .unsol_event = alc_automute_amp_unsol_event, |
| 4109 | .init_hook = alc880_lg_init_hook, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4110 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4111 | .loopbacks = alc880_lg_loopbacks, |
| 4112 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4113 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4114 | [ALC880_LG_LW] = { |
| 4115 | .mixers = { alc880_lg_lw_mixer }, |
| 4116 | .init_verbs = { alc880_volume_init_verbs, |
| 4117 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4118 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4119 | .dac_nids = alc880_dac_nids, |
| 4120 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 4121 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 4122 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4123 | .input_mux = &alc880_lg_lw_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4124 | .unsol_event = alc_automute_amp_unsol_event, |
| 4125 | .init_hook = alc880_lg_lw_init_hook, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 4126 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4127 | [ALC880_MEDION_RIM] = { |
| 4128 | .mixers = { alc880_medion_rim_mixer }, |
| 4129 | .init_verbs = { alc880_volume_init_verbs, |
| 4130 | alc880_medion_rim_init_verbs, |
| 4131 | alc_gpio2_init_verbs }, |
| 4132 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 4133 | .dac_nids = alc880_dac_nids, |
| 4134 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 4135 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 4136 | .channel_mode = alc880_2_jack_modes, |
| 4137 | .input_mux = &alc880_medion_rim_capture_source, |
| 4138 | .unsol_event = alc880_medion_rim_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 4139 | .init_hook = alc880_medion_rim_init_hook, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 4140 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4141 | #ifdef CONFIG_SND_DEBUG |
| 4142 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4143 | .mixers = { alc880_test_mixer }, |
| 4144 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4145 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 4146 | .dac_nids = alc880_test_dac_nids, |
| 4147 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 4149 | .channel_mode = alc880_test_modes, |
| 4150 | .input_mux = &alc880_test_capture_source, |
| 4151 | }, |
| 4152 | #endif |
| 4153 | }; |
| 4154 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4155 | /* |
| 4156 | * Automatic parse of I/O pins from the BIOS configuration |
| 4157 | */ |
| 4158 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4159 | enum { |
| 4160 | ALC_CTL_WIDGET_VOL, |
| 4161 | ALC_CTL_WIDGET_MUTE, |
| 4162 | ALC_CTL_BIND_MUTE, |
| 4163 | }; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4164 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4165 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 4166 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4167 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4168 | }; |
| 4169 | |
| 4170 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4171 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 4172 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4173 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4174 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4175 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4176 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 4177 | knew = snd_array_new(&spec->kctls); |
| 4178 | if (!knew) |
| 4179 | return -ENOMEM; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4180 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 4181 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4182 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4183 | return -ENOMEM; |
| 4184 | knew->private_value = val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4185 | return 0; |
| 4186 | } |
| 4187 | |
| 4188 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 4189 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 4190 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 4191 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 4192 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 4193 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 4194 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 4195 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 4196 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 4197 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 4198 | #define ALC880_PIN_CD_NID 0x1c |
| 4199 | |
| 4200 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4201 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 4202 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4203 | { |
| 4204 | hda_nid_t nid; |
| 4205 | int assigned[4]; |
| 4206 | int i, j; |
| 4207 | |
| 4208 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 4209 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4210 | |
| 4211 | /* check the pins hardwired to audio widget */ |
| 4212 | for (i = 0; i < cfg->line_outs; i++) { |
| 4213 | nid = cfg->line_out_pins[i]; |
| 4214 | if (alc880_is_fixed_pin(nid)) { |
| 4215 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 4216 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4217 | assigned[idx] = 1; |
| 4218 | } |
| 4219 | } |
| 4220 | /* left pins can be connect to any audio widget */ |
| 4221 | for (i = 0; i < cfg->line_outs; i++) { |
| 4222 | nid = cfg->line_out_pins[i]; |
| 4223 | if (alc880_is_fixed_pin(nid)) |
| 4224 | continue; |
| 4225 | /* search for an empty channel */ |
| 4226 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4227 | if (!assigned[j]) { |
| 4228 | spec->multiout.dac_nids[i] = |
| 4229 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4230 | assigned[j] = 1; |
| 4231 | break; |
| 4232 | } |
| 4233 | } |
| 4234 | } |
| 4235 | spec->multiout.num_dacs = cfg->line_outs; |
| 4236 | return 0; |
| 4237 | } |
| 4238 | |
| 4239 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4240 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4241 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4242 | { |
| 4243 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4244 | static const char *chname[4] = { |
| 4245 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 4246 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4247 | hda_nid_t nid; |
| 4248 | int i, err; |
| 4249 | |
| 4250 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4251 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4252 | continue; |
| 4253 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 4254 | if (i == 2) { |
| 4255 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4256 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4257 | "Center Playback Volume", |
| 4258 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 4259 | HDA_OUTPUT)); |
| 4260 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4261 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4262 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 4263 | "LFE Playback Volume", |
| 4264 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 4265 | HDA_OUTPUT)); |
| 4266 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4267 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4268 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4269 | "Center Playback Switch", |
| 4270 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 4271 | HDA_INPUT)); |
| 4272 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4273 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4274 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 4275 | "LFE Playback Switch", |
| 4276 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 4277 | HDA_INPUT)); |
| 4278 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4279 | return err; |
| 4280 | } else { |
| 4281 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4283 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 4284 | HDA_OUTPUT)); |
| 4285 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4286 | return err; |
| 4287 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4288 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4289 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 4290 | HDA_INPUT)); |
| 4291 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4292 | return err; |
| 4293 | } |
| 4294 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4295 | return 0; |
| 4296 | } |
| 4297 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4298 | /* add playback controls for speaker and HP outputs */ |
| 4299 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 4300 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4301 | { |
| 4302 | hda_nid_t nid; |
| 4303 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4304 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4305 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4306 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4307 | return 0; |
| 4308 | |
| 4309 | if (alc880_is_fixed_pin(pin)) { |
| 4310 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4311 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4312 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4313 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4314 | else |
| 4315 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4316 | /* control HP volume/switch on the output mixer amp */ |
| 4317 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4318 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4320 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 4321 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4322 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4323 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4324 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 4325 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 4326 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4327 | return err; |
| 4328 | } else if (alc880_is_multi_pin(pin)) { |
| 4329 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4330 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4331 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4332 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4333 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 4334 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4335 | return err; |
| 4336 | } |
| 4337 | return 0; |
| 4338 | } |
| 4339 | |
| 4340 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4341 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 4342 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4343 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4344 | { |
| 4345 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4346 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4347 | |
| 4348 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4349 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 4350 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4351 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4352 | return err; |
| 4353 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4354 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 4355 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 4356 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4357 | return err; |
| 4358 | return 0; |
| 4359 | } |
| 4360 | |
| 4361 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4362 | static int alc880_auto_create_analog_input_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 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4365 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4366 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4367 | |
| 4368 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4369 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4370 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4371 | err = new_analog_input(spec, cfg->input_pins[i], |
| 4372 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4373 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4374 | if (err < 0) |
| 4375 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4376 | imux->items[imux->num_items].label = |
| 4377 | auto_pin_cfg_labels[i]; |
| 4378 | imux->items[imux->num_items].index = |
| 4379 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4380 | imux->num_items++; |
| 4381 | } |
| 4382 | } |
| 4383 | return 0; |
| 4384 | } |
| 4385 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4386 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 4387 | unsigned int pin_type) |
| 4388 | { |
| 4389 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4390 | pin_type); |
| 4391 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 4392 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4393 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4394 | } |
| 4395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4396 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4397 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4398 | int dac_idx) |
| 4399 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4400 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4401 | /* need the manual connection? */ |
| 4402 | if (alc880_is_multi_pin(nid)) { |
| 4403 | struct alc_spec *spec = codec->spec; |
| 4404 | int idx = alc880_multi_pin_idx(nid); |
| 4405 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 4406 | AC_VERB_SET_CONNECT_SEL, |
| 4407 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 4408 | } |
| 4409 | } |
| 4410 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4411 | static int get_pin_type(int line_out_type) |
| 4412 | { |
| 4413 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 4414 | return PIN_HP; |
| 4415 | else |
| 4416 | return PIN_OUT; |
| 4417 | } |
| 4418 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4419 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 4420 | { |
| 4421 | struct alc_spec *spec = codec->spec; |
| 4422 | int i; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 4423 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4424 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 4425 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4426 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4427 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4428 | } |
| 4429 | } |
| 4430 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4431 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4432 | { |
| 4433 | struct alc_spec *spec = codec->spec; |
| 4434 | hda_nid_t pin; |
| 4435 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4436 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4437 | if (pin) /* connect to front */ |
| 4438 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4439 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4440 | if (pin) /* connect to front */ |
| 4441 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 4442 | } |
| 4443 | |
| 4444 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 4445 | { |
| 4446 | struct alc_spec *spec = codec->spec; |
| 4447 | int i; |
| 4448 | |
| 4449 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4450 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4451 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 4452 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 4453 | if (nid != ALC880_PIN_CD_NID && |
| 4454 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4455 | snd_hda_codec_write(codec, nid, 0, |
| 4456 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4457 | AMP_OUT_MUTE); |
| 4458 | } |
| 4459 | } |
| 4460 | } |
| 4461 | |
| 4462 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4463 | /* return 1 if successful, 0 if the proper config is not found, |
| 4464 | * or a negative error code |
| 4465 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4466 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 4467 | { |
| 4468 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4469 | int i, err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4470 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4471 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4472 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4473 | alc880_ignore); |
| 4474 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4475 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4476 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4477 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4478 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4479 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 4480 | if (err < 0) |
| 4481 | return err; |
| 4482 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4483 | if (err < 0) |
| 4484 | return err; |
| 4485 | err = alc880_auto_create_extra_out(spec, |
| 4486 | spec->autocfg.speaker_pins[0], |
| 4487 | "Speaker"); |
| 4488 | if (err < 0) |
| 4489 | return err; |
| 4490 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 4491 | "Headphone"); |
| 4492 | if (err < 0) |
| 4493 | return err; |
| 4494 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4495 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4496 | return err; |
| 4497 | |
| 4498 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 4499 | |
Takashi Iwai | 6a05ac4 | 2009-02-13 11:19:09 +0100 | [diff] [blame] | 4500 | /* check multiple SPDIF-out (for recent codecs) */ |
| 4501 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
| 4502 | hda_nid_t dig_nid; |
| 4503 | err = snd_hda_get_connections(codec, |
| 4504 | spec->autocfg.dig_out_pins[i], |
| 4505 | &dig_nid, 1); |
| 4506 | if (err < 0) |
| 4507 | continue; |
| 4508 | if (!i) |
| 4509 | spec->multiout.dig_out_nid = dig_nid; |
| 4510 | else { |
| 4511 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
| 4512 | spec->slave_dig_outs[i - 1] = dig_nid; |
| 4513 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) |
| 4514 | break; |
| 4515 | } |
| 4516 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4517 | if (spec->autocfg.dig_in_pin) |
| 4518 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 4519 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4520 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4521 | add_mixer(spec, spec->kctls.list); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4522 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 4523 | add_verb(spec, alc880_volume_init_verbs); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4524 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4525 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 4526 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4527 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 4528 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 4529 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4530 | return 1; |
| 4531 | } |
| 4532 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4533 | /* additional initialization for auto-configuration model */ |
| 4534 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4535 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4536 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4537 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 4538 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4539 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4540 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 4541 | alc_inithook(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4542 | } |
| 4543 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4544 | static void set_capture_mixer(struct alc_spec *spec) |
| 4545 | { |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4546 | static struct snd_kcontrol_new *caps[2][3] = { |
| 4547 | { alc_capture_mixer_nosrc1, |
| 4548 | alc_capture_mixer_nosrc2, |
| 4549 | alc_capture_mixer_nosrc3 }, |
| 4550 | { alc_capture_mixer1, |
| 4551 | alc_capture_mixer2, |
| 4552 | alc_capture_mixer3 }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4553 | }; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 4554 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
| 4555 | int mux; |
| 4556 | if (spec->input_mux && spec->input_mux->num_items > 1) |
| 4557 | mux = 1; |
| 4558 | else |
| 4559 | mux = 0; |
| 4560 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; |
| 4561 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4562 | } |
| 4563 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4564 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 4565 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 4566 | |
| 4567 | /* |
| 4568 | * OK, here we have finally the patch for ALC880 |
| 4569 | */ |
| 4570 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4571 | static int patch_alc880(struct hda_codec *codec) |
| 4572 | { |
| 4573 | struct alc_spec *spec; |
| 4574 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4575 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4576 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4577 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4578 | if (spec == NULL) |
| 4579 | return -ENOMEM; |
| 4580 | |
| 4581 | codec->spec = spec; |
| 4582 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4583 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 4584 | alc880_models, |
| 4585 | alc880_cfg_tbl); |
| 4586 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 4587 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 4588 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4589 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4590 | } |
| 4591 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4592 | if (board_config == ALC880_AUTO) { |
| 4593 | /* automatic parse from the BIOS config */ |
| 4594 | err = alc880_parse_auto_config(codec); |
| 4595 | if (err < 0) { |
| 4596 | alc_free(codec); |
| 4597 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4598 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 4599 | printk(KERN_INFO |
| 4600 | "hda_codec: Cannot set up configuration " |
| 4601 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4602 | board_config = ALC880_3ST; |
| 4603 | } |
| 4604 | } |
| 4605 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 4606 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 4607 | if (err < 0) { |
| 4608 | alc_free(codec); |
| 4609 | return err; |
| 4610 | } |
| 4611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4612 | if (board_config != ALC880_AUTO) |
| 4613 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4614 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4615 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 4616 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4617 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4618 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4619 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 4620 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 4621 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4622 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4623 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 4624 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4625 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 4626 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4627 | if (wcap != AC_WID_AUD_IN) { |
| 4628 | spec->adc_nids = alc880_adc_nids_alt; |
| 4629 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4630 | } else { |
| 4631 | spec->adc_nids = alc880_adc_nids; |
| 4632 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4633 | } |
| 4634 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 4635 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 4636 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4637 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 4638 | spec->vmaster_nid = 0x0c; |
| 4639 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4640 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4641 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4642 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4643 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4644 | if (!spec->loopback.amplist) |
| 4645 | spec->loopback.amplist = alc880_loopbacks; |
| 4646 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 4647 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4648 | |
| 4649 | return 0; |
| 4650 | } |
| 4651 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4652 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4653 | /* |
| 4654 | * ALC260 support |
| 4655 | */ |
| 4656 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4657 | static hda_nid_t alc260_dac_nids[1] = { |
| 4658 | /* front */ |
| 4659 | 0x02, |
| 4660 | }; |
| 4661 | |
| 4662 | static hda_nid_t alc260_adc_nids[1] = { |
| 4663 | /* ADC0 */ |
| 4664 | 0x04, |
| 4665 | }; |
| 4666 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4667 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4668 | /* ADC1 */ |
| 4669 | 0x05, |
| 4670 | }; |
| 4671 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4672 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 4673 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 4674 | */ |
| 4675 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4676 | /* ADC0, ADC1 */ |
| 4677 | 0x04, 0x05 |
| 4678 | }; |
| 4679 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 4680 | #define ALC260_DIGOUT_NID 0x03 |
| 4681 | #define ALC260_DIGIN_NID 0x06 |
| 4682 | |
| 4683 | static struct hda_input_mux alc260_capture_source = { |
| 4684 | .num_items = 4, |
| 4685 | .items = { |
| 4686 | { "Mic", 0x0 }, |
| 4687 | { "Front Mic", 0x1 }, |
| 4688 | { "Line", 0x2 }, |
| 4689 | { "CD", 0x4 }, |
| 4690 | }, |
| 4691 | }; |
| 4692 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4693 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4694 | * headphone jack and the internal CD lines since these are the only pins at |
| 4695 | * which audio can appear. For flexibility, also allow the option of |
| 4696 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 4697 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4698 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4699 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 4700 | { |
| 4701 | .num_items = 3, |
| 4702 | .items = { |
| 4703 | { "Mic/Line", 0x0 }, |
| 4704 | { "CD", 0x4 }, |
| 4705 | { "Headphone", 0x2 }, |
| 4706 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4707 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4708 | { |
| 4709 | .num_items = 4, |
| 4710 | .items = { |
| 4711 | { "Mic/Line", 0x0 }, |
| 4712 | { "CD", 0x4 }, |
| 4713 | { "Headphone", 0x2 }, |
| 4714 | { "Mixer", 0x5 }, |
| 4715 | }, |
| 4716 | }, |
| 4717 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4718 | }; |
| 4719 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4720 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 4721 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4722 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4723 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 4724 | { |
| 4725 | .num_items = 4, |
| 4726 | .items = { |
| 4727 | { "Mic", 0x0 }, |
| 4728 | { "Line", 0x2 }, |
| 4729 | { "CD", 0x4 }, |
| 4730 | { "Headphone", 0x5 }, |
| 4731 | }, |
| 4732 | }, |
| 4733 | { |
| 4734 | .num_items = 5, |
| 4735 | .items = { |
| 4736 | { "Mic", 0x0 }, |
| 4737 | { "Line", 0x2 }, |
| 4738 | { "CD", 0x4 }, |
| 4739 | { "Headphone", 0x6 }, |
| 4740 | { "Mixer", 0x5 }, |
| 4741 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4742 | }, |
| 4743 | }; |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 4744 | |
| 4745 | /* Maxdata Favorit 100XS */ |
| 4746 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { |
| 4747 | { |
| 4748 | .num_items = 2, |
| 4749 | .items = { |
| 4750 | { "Line/Mic", 0x0 }, |
| 4751 | { "CD", 0x4 }, |
| 4752 | }, |
| 4753 | }, |
| 4754 | { |
| 4755 | .num_items = 3, |
| 4756 | .items = { |
| 4757 | { "Line/Mic", 0x0 }, |
| 4758 | { "CD", 0x4 }, |
| 4759 | { "Mixer", 0x5 }, |
| 4760 | }, |
| 4761 | }, |
| 4762 | }; |
| 4763 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4764 | /* |
| 4765 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 4766 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 4767 | * element which allows changing the channel mode, so the verb list is |
| 4768 | * never used. |
| 4769 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 4770 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4771 | { 2, NULL }, |
| 4772 | }; |
| 4773 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4774 | |
| 4775 | /* Mixer combinations |
| 4776 | * |
| 4777 | * basic: base_output + input + pc_beep + capture |
| 4778 | * HP: base_output + input + capture_alt |
| 4779 | * HP_3013: hp_3013 + input + capture |
| 4780 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4781 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4782 | */ |
| 4783 | |
| 4784 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4785 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4786 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4787 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4788 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4789 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4790 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4791 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4793 | |
| 4794 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4796 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4797 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4798 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4799 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4800 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4801 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4802 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4803 | { } /* end */ |
| 4804 | }; |
| 4805 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4806 | /* update HP, line and mono out pins according to the master switch */ |
| 4807 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4808 | hda_nid_t hp, hda_nid_t line, |
| 4809 | hda_nid_t mono) |
| 4810 | { |
| 4811 | struct alc_spec *spec = codec->spec; |
| 4812 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4813 | /* change HP and line-out pins */ |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4814 | 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] | 4815 | val); |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4816 | 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] | 4817 | val); |
| 4818 | /* mono (speaker) depending on the HP jack sense */ |
| 4819 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4820 | 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] | 4821 | val); |
| 4822 | } |
| 4823 | |
| 4824 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4825 | struct snd_ctl_elem_value *ucontrol) |
| 4826 | { |
| 4827 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4828 | struct alc_spec *spec = codec->spec; |
| 4829 | *ucontrol->value.integer.value = spec->master_sw; |
| 4830 | return 0; |
| 4831 | } |
| 4832 | |
| 4833 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4834 | struct snd_ctl_elem_value *ucontrol) |
| 4835 | { |
| 4836 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4837 | struct alc_spec *spec = codec->spec; |
| 4838 | int val = !!*ucontrol->value.integer.value; |
| 4839 | hda_nid_t hp, line, mono; |
| 4840 | |
| 4841 | if (val == spec->master_sw) |
| 4842 | return 0; |
| 4843 | spec->master_sw = val; |
| 4844 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4845 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4846 | mono = kcontrol->private_value & 0xff; |
| 4847 | alc260_hp_master_update(codec, hp, line, mono); |
| 4848 | return 1; |
| 4849 | } |
| 4850 | |
| 4851 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4852 | { |
| 4853 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4854 | .name = "Master Playback Switch", |
| 4855 | .info = snd_ctl_boolean_mono_info, |
| 4856 | .get = alc260_hp_master_sw_get, |
| 4857 | .put = alc260_hp_master_sw_put, |
| 4858 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4859 | }, |
| 4860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4861 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4862 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4863 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4864 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4865 | HDA_OUTPUT), |
| 4866 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4867 | { } /* end */ |
| 4868 | }; |
| 4869 | |
| 4870 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4871 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4872 | {}, |
| 4873 | }; |
| 4874 | |
| 4875 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4876 | { |
| 4877 | struct alc_spec *spec = codec->spec; |
| 4878 | unsigned int present; |
| 4879 | |
| 4880 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4881 | AC_VERB_GET_PIN_SENSE, 0); |
| 4882 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4883 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4884 | } |
| 4885 | |
| 4886 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4887 | { |
| 4888 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4889 | alc260_hp_automute(codec); |
| 4890 | } |
| 4891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4892 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4893 | { |
| 4894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4895 | .name = "Master Playback Switch", |
| 4896 | .info = snd_ctl_boolean_mono_info, |
| 4897 | .get = alc260_hp_master_sw_get, |
| 4898 | .put = alc260_hp_master_sw_put, |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4899 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4900 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4902 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4903 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4904 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4905 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4906 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4907 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4908 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4909 | { } /* end */ |
| 4910 | }; |
| 4911 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4912 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { |
| 4913 | .ops = &snd_hda_bind_vol, |
| 4914 | .values = { |
| 4915 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), |
| 4916 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 4917 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), |
| 4918 | 0 |
| 4919 | }, |
| 4920 | }; |
| 4921 | |
| 4922 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { |
| 4923 | .ops = &snd_hda_bind_sw, |
| 4924 | .values = { |
| 4925 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
| 4926 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 4927 | 0 |
| 4928 | }, |
| 4929 | }; |
| 4930 | |
| 4931 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { |
| 4932 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), |
| 4933 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), |
| 4934 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), |
| 4935 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4936 | { } /* end */ |
| 4937 | }; |
| 4938 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4939 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4940 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4941 | {}, |
| 4942 | }; |
| 4943 | |
| 4944 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4945 | { |
| 4946 | struct alc_spec *spec = codec->spec; |
| 4947 | unsigned int present; |
| 4948 | |
| 4949 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4950 | AC_VERB_GET_PIN_SENSE, 0); |
| 4951 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Takashi Iwai | 30cde0a | 2008-11-07 14:49:28 +0100 | [diff] [blame] | 4952 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4953 | } |
| 4954 | |
| 4955 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4956 | unsigned int res) |
| 4957 | { |
| 4958 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4959 | alc260_hp_3013_automute(codec); |
| 4960 | } |
| 4961 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 4962 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
| 4963 | { |
| 4964 | unsigned int present, bits; |
| 4965 | |
| 4966 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4967 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 4968 | |
| 4969 | bits = present ? 0 : PIN_OUT; |
| 4970 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4971 | bits); |
| 4972 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4973 | bits); |
| 4974 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4975 | bits); |
| 4976 | } |
| 4977 | |
| 4978 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, |
| 4979 | unsigned int res) |
| 4980 | { |
| 4981 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4982 | alc260_hp_3012_automute(codec); |
| 4983 | } |
| 4984 | |
| 4985 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4986 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4987 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4988 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4989 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4990 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4991 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4992 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4993 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4994 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4995 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4996 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4997 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4998 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4999 | { } /* end */ |
| 5000 | }; |
| 5001 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5002 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 5003 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 5004 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 5005 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 5006 | * whether this behaviour is intentional or is a hardware bug in chip |
| 5007 | * revisions available in early 2006. Therefore for now allow the |
| 5008 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 5009 | * that the lack of mic bias for this NID is intentional we could change the |
| 5010 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5011 | * |
| 5012 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 5013 | * don't appear to make the mic bias available from the "line" jack, even |
| 5014 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 5015 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 5016 | * and the output jack. If this turns out to be the case for all such |
| 5017 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 5018 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5019 | * |
| 5020 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 5021 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 5022 | * controls for such models. On models without a "mono speaker" the control |
| 5023 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5024 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5025 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 5026 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5027 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5028 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5029 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5030 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 5031 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5032 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5033 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5034 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 5035 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5036 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5037 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5039 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5040 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5041 | { } /* end */ |
| 5042 | }; |
| 5043 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5044 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack |
| 5045 | */ |
| 5046 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { |
| 5047 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5048 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
| 5049 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5050 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5051 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5052 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5053 | { } /* end */ |
| 5054 | }; |
| 5055 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5056 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 5057 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 5058 | */ |
| 5059 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 5060 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5061 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5062 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5063 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5064 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5065 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5066 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5067 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5068 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5069 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5070 | { } /* end */ |
| 5071 | }; |
| 5072 | |
| 5073 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 5074 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 5075 | */ |
| 5076 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 5077 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5078 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 5079 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 5080 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 5081 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 5082 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 5083 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 5084 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5085 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5086 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5087 | { } /* end */ |
| 5088 | }; |
| 5089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5090 | /* |
| 5091 | * initialization verbs |
| 5092 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5093 | static struct hda_verb alc260_init_verbs[] = { |
| 5094 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5096 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5098 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5099 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5100 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5101 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5102 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5103 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5104 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 5105 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5106 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5107 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5108 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5109 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5110 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5111 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5112 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5114 | /* set connection select to line in (default select for this ADC) */ |
| 5115 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5116 | /* mute capture amp left and right */ |
| 5117 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5118 | /* set connection select to line in (default select for this ADC) */ |
| 5119 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5120 | /* set vol=0 Line-Out mixer amp left and right */ |
| 5121 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5122 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5123 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5124 | /* set vol=0 HP mixer amp left and right */ |
| 5125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5126 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5127 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5128 | /* set vol=0 Mono mixer amp left and right */ |
| 5129 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5130 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 5131 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5132 | /* unmute LINE-2 out pin */ |
| 5133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5134 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5135 | * Line In 2 = 0x03 |
| 5136 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5137 | /* mute analog inputs */ |
| 5138 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5139 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5140 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5142 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5143 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5144 | /* mute Front out path */ |
| 5145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5146 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5147 | /* mute Headphone out path */ |
| 5148 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5149 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5150 | /* mute Mono out path */ |
| 5151 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5152 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5153 | { } |
| 5154 | }; |
| 5155 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5156 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5157 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 5158 | /* Headphone and output */ |
| 5159 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5160 | /* mono output */ |
| 5161 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5162 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5163 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5164 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5166 | /* Line In pin widget for input */ |
| 5167 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5168 | /* Line-2 pin widget for output */ |
| 5169 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5170 | /* CD pin widget for input */ |
| 5171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5172 | /* unmute amp left and right */ |
| 5173 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5174 | /* set connection select to line in (default select for this ADC) */ |
| 5175 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5176 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5177 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5178 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5179 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5180 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5181 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5182 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5183 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5184 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5185 | * Line In 2 = 0x03 |
| 5186 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5187 | /* mute analog inputs */ |
| 5188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5189 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5191 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5192 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5194 | /* Unmute Front out path */ |
| 5195 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5197 | /* Unmute Headphone out path */ |
| 5198 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5199 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5200 | /* Unmute Mono out path */ |
| 5201 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5202 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5203 | { } |
| 5204 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 5205 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5206 | |
| 5207 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 5208 | /* Line out and output */ |
| 5209 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5210 | /* mono output */ |
| 5211 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 5212 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 5213 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5214 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 5215 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 5216 | /* Line In pin widget for input */ |
| 5217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5218 | /* Headphone pin widget for output */ |
| 5219 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 5220 | /* CD pin widget for input */ |
| 5221 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 5222 | /* unmute amp left and right */ |
| 5223 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 5224 | /* set connection select to line in (default select for this ADC) */ |
| 5225 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 5226 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 5227 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5228 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5229 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 5230 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 5231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 5232 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 5233 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5234 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 5235 | * Line In 2 = 0x03 |
| 5236 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5237 | /* mute analog inputs */ |
| 5238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5239 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5240 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5241 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5242 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5243 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 5244 | /* Unmute Front out path */ |
| 5245 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5246 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5247 | /* Unmute Headphone out path */ |
| 5248 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5249 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5250 | /* Unmute Mono out path */ |
| 5251 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5252 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 5253 | { } |
| 5254 | }; |
| 5255 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5256 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5257 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 5258 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5259 | */ |
| 5260 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 5261 | /* Disable all GPIOs */ |
| 5262 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 5263 | /* Internal speaker is connected to headphone pin */ |
| 5264 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5265 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 5266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5267 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 5268 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5269 | /* Ensure all other unused pins are disabled and muted. */ |
| 5270 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5271 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5272 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5273 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5274 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5275 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5276 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5277 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5278 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5279 | /* Disable digital (SPDIF) pins */ |
| 5280 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5281 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5282 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5283 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5284 | * when acting as an output. |
| 5285 | */ |
| 5286 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5287 | |
| 5288 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 5289 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5290 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5291 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5292 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5293 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5295 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5296 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5297 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5298 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5299 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 5300 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5301 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 5302 | * If the pin mode is changed by the user the pin mode control will |
| 5303 | * take care of enabling the pin's input/output buffers as needed. |
| 5304 | * Therefore there's no need to enable the input buffer at this |
| 5305 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5306 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5307 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5308 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5309 | * mixer ctrl) |
| 5310 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5311 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5312 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5313 | /* Mute capture amp left and right */ |
| 5314 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5315 | /* Set ADC connection select to match default mixer setting - line |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5316 | * in (on mic1 pin) |
| 5317 | */ |
| 5318 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5319 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5320 | /* Do the same for the second ADC: mute capture input amp and |
| 5321 | * set ADC connection to line in (on mic1 pin) |
| 5322 | */ |
| 5323 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5324 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 5325 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5326 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5327 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5328 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5329 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5330 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5331 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5334 | {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] | 5335 | |
| 5336 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 5337 | }; |
| 5338 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5339 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 5340 | * similar laptops (adapted from Fujitsu init verbs). |
| 5341 | */ |
| 5342 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 5343 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 5344 | * the headphone jack. Turn this on and rely on the standard mute |
| 5345 | * methods whenever the user wants to turn these outputs off. |
| 5346 | */ |
| 5347 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5348 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5349 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5350 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 5351 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5352 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 5353 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5354 | /* Line In jack is connected to Line1 pin */ |
| 5355 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5356 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 5357 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5358 | /* Ensure all other unused pins are disabled and muted. */ |
| 5359 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5361 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5362 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5364 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5365 | /* Disable digital (SPDIF) pins */ |
| 5366 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5367 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5368 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5369 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5370 | * bus when acting as outputs. |
| 5371 | */ |
| 5372 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5373 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5374 | |
| 5375 | /* Start with output sum widgets muted and their output gains at min */ |
| 5376 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5378 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5379 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5380 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5381 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5382 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5383 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5384 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5385 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5386 | /* Unmute Line-out pin widget amp left and right |
| 5387 | * (no equiv mixer ctrl) |
| 5388 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5389 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5390 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 5391 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5392 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5393 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5394 | * will take care of enabling the pin's input/output buffers as needed. |
| 5395 | * Therefore there's no need to enable the input buffer at this |
| 5396 | * stage. |
| 5397 | */ |
| 5398 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5399 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5400 | |
| 5401 | /* Mute capture amp left and right */ |
| 5402 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5403 | /* Set ADC connection select to match default mixer setting - mic |
| 5404 | * (on mic1 pin) |
| 5405 | */ |
| 5406 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5407 | |
| 5408 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5409 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5410 | */ |
| 5411 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5412 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5413 | |
| 5414 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5415 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5416 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5417 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5418 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5419 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5421 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5422 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5423 | |
| 5424 | { } |
| 5425 | }; |
| 5426 | |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 5427 | /* Initialisation sequence for Maxdata Favorit 100XS |
| 5428 | * (adapted from Acer init verbs). |
| 5429 | */ |
| 5430 | static struct hda_verb alc260_favorit100_init_verbs[] = { |
| 5431 | /* GPIO 0 enables the output jack. |
| 5432 | * Turn this on and rely on the standard mute |
| 5433 | * methods whenever the user wants to turn these outputs off. |
| 5434 | */ |
| 5435 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5436 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5437 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 5438 | /* Line/Mic input jack is connected to Mic1 pin */ |
| 5439 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 5440 | /* Ensure all other unused pins are disabled and muted. */ |
| 5441 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5442 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5443 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5444 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5445 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5446 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5447 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5448 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5449 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 5450 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5451 | /* Disable digital (SPDIF) pins */ |
| 5452 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5453 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5454 | |
| 5455 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 5456 | * bus when acting as outputs. |
| 5457 | */ |
| 5458 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5459 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5460 | |
| 5461 | /* Start with output sum widgets muted and their output gains at min */ |
| 5462 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5463 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5464 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5465 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5466 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5467 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5468 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5469 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5470 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5471 | |
| 5472 | /* Unmute Line-out pin widget amp left and right |
| 5473 | * (no equiv mixer ctrl) |
| 5474 | */ |
| 5475 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5476 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 5477 | * inputs. If the pin mode is changed by the user the pin mode control |
| 5478 | * will take care of enabling the pin's input/output buffers as needed. |
| 5479 | * Therefore there's no need to enable the input buffer at this |
| 5480 | * stage. |
| 5481 | */ |
| 5482 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5483 | |
| 5484 | /* Mute capture amp left and right */ |
| 5485 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5486 | /* Set ADC connection select to match default mixer setting - mic |
| 5487 | * (on mic1 pin) |
| 5488 | */ |
| 5489 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5490 | |
| 5491 | /* Do similar with the second ADC: mute capture input amp and |
| 5492 | * set ADC connection to mic to match ALSA's default state. |
| 5493 | */ |
| 5494 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5495 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5496 | |
| 5497 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5498 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5499 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5500 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5501 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5502 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5503 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5504 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5505 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5506 | |
| 5507 | { } |
| 5508 | }; |
| 5509 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5510 | static struct hda_verb alc260_will_verbs[] = { |
| 5511 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5512 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5513 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5514 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5515 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5516 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 5517 | {} |
| 5518 | }; |
| 5519 | |
| 5520 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 5521 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 5522 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 5523 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 5524 | |
| 5525 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 5526 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 5527 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5528 | |
| 5529 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5530 | {} |
| 5531 | }; |
| 5532 | |
| 5533 | /* toggle speaker-output according to the hp-jack state */ |
| 5534 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 5535 | { |
| 5536 | unsigned int present; |
| 5537 | |
| 5538 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 5539 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 5540 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5541 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5542 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5543 | AC_VERB_SET_GPIO_DATA, 1); |
| 5544 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5545 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5546 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5547 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5548 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 5549 | AC_VERB_SET_GPIO_DATA, 0); |
| 5550 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 5551 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5552 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5553 | } |
| 5554 | } |
| 5555 | |
| 5556 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 5557 | unsigned int res) |
| 5558 | { |
| 5559 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5560 | alc260_replacer_672v_automute(codec); |
| 5561 | } |
| 5562 | |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 5563 | static struct hda_verb alc260_hp_dc7600_verbs[] = { |
| 5564 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5565 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5566 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5567 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5568 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5569 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5570 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5571 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5572 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5573 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 5574 | {} |
| 5575 | }; |
| 5576 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5577 | /* Test configuration for debugging, modelled after the ALC880 test |
| 5578 | * configuration. |
| 5579 | */ |
| 5580 | #ifdef CONFIG_SND_DEBUG |
| 5581 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 5582 | 0x02, |
| 5583 | }; |
| 5584 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 5585 | 0x04, 0x05, |
| 5586 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5587 | /* For testing the ALC260, each input MUX needs its own definition since |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5588 | * the signal assignments are different. This assumes that the first ADC |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5589 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 5590 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5591 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 5592 | { |
| 5593 | .num_items = 7, |
| 5594 | .items = { |
| 5595 | { "MIC1 pin", 0x0 }, |
| 5596 | { "MIC2 pin", 0x1 }, |
| 5597 | { "LINE1 pin", 0x2 }, |
| 5598 | { "LINE2 pin", 0x3 }, |
| 5599 | { "CD pin", 0x4 }, |
| 5600 | { "LINE-OUT pin", 0x5 }, |
| 5601 | { "HP-OUT pin", 0x6 }, |
| 5602 | }, |
| 5603 | }, |
| 5604 | { |
| 5605 | .num_items = 8, |
| 5606 | .items = { |
| 5607 | { "MIC1 pin", 0x0 }, |
| 5608 | { "MIC2 pin", 0x1 }, |
| 5609 | { "LINE1 pin", 0x2 }, |
| 5610 | { "LINE2 pin", 0x3 }, |
| 5611 | { "CD pin", 0x4 }, |
| 5612 | { "Mixer", 0x5 }, |
| 5613 | { "LINE-OUT pin", 0x6 }, |
| 5614 | { "HP-OUT pin", 0x7 }, |
| 5615 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5616 | }, |
| 5617 | }; |
| 5618 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 5619 | /* Output driver widgets */ |
| 5620 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 5621 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 5622 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 5623 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 5624 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 5625 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 5626 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5627 | /* Modes for retasking pin widgets |
| 5628 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 5629 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 5630 | * mention this restriction. At this stage it's not clear whether |
| 5631 | * this behaviour is intentional or is a hardware bug in chip |
| 5632 | * revisions available at least up until early 2006. Therefore for |
| 5633 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 5634 | * choices, but if it turns out that the lack of mic bias for these |
| 5635 | * NIDs is intentional we could change their modes from |
| 5636 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 5637 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5638 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 5639 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 5640 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 5641 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 5642 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 5643 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 5644 | |
| 5645 | /* Loopback mixer controls */ |
| 5646 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 5647 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 5648 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 5649 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 5650 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 5651 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 5652 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 5653 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 5654 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 5655 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5656 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 5657 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 5658 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 5659 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5660 | |
| 5661 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 5662 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 5663 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 5664 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 5665 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 5666 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5667 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 5668 | * is ambigious as to which NID is which; testing on laptops which |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5669 | * make this output available should provide clarification. |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5670 | */ |
| 5671 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 5672 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 5673 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 5674 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 5675 | * this output to turn on an external amplifier. |
| 5676 | */ |
| 5677 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 5678 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 5679 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5680 | { } /* end */ |
| 5681 | }; |
| 5682 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 5683 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 5684 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 5685 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 5686 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 5687 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5688 | /* Enable retasking pins as output, initially without power amp */ |
| 5689 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5690 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5692 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5693 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5694 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5695 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 5696 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 5697 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 5698 | * payload also sets the generation to 0, output to be in "consumer" |
| 5699 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 5700 | * control. |
| 5701 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5702 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5703 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 5704 | |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5705 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5706 | * OUT1 sum bus when acting as an output. |
| 5707 | */ |
| 5708 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5709 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5710 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5711 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 5712 | |
| 5713 | /* Start with output sum widgets muted and their output gains at min */ |
| 5714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5715 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5717 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5720 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5721 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5722 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5723 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 5724 | /* Unmute retasking pin widget output buffers since the default |
| 5725 | * state appears to be output. As the pin mode is changed by the |
| 5726 | * user the pin mode control will take care of enabling the pin's |
| 5727 | * input/output buffers as needed. |
| 5728 | */ |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5729 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5730 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5731 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5732 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5733 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5734 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5735 | /* Also unmute the mono-out pin widget */ |
| 5736 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5737 | |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5738 | /* Mute capture amp left and right */ |
| 5739 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5740 | /* Set ADC connection select to match default mixer setting (mic1 |
| 5741 | * pin) |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5742 | */ |
| 5743 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5744 | |
| 5745 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 5746 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5747 | */ |
| 5748 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5749 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5750 | |
| 5751 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 5752 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 5753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 5754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 5755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 5756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 5757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 5758 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 5759 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 5760 | |
| 5761 | { } |
| 5762 | }; |
| 5763 | #endif |
| 5764 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 5765 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 5766 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5767 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5768 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 5769 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 5770 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5771 | /* |
| 5772 | * for BIOS auto-configuration |
| 5773 | */ |
| 5774 | |
| 5775 | 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] | 5776 | const char *pfx, int *vol_bits) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5777 | { |
| 5778 | hda_nid_t nid_vol; |
| 5779 | unsigned long vol_val, sw_val; |
| 5780 | char name[32]; |
| 5781 | int err; |
| 5782 | |
| 5783 | if (nid >= 0x0f && nid < 0x11) { |
| 5784 | nid_vol = nid - 0x7; |
| 5785 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5786 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5787 | } else if (nid == 0x11) { |
| 5788 | nid_vol = nid - 0x7; |
| 5789 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 5790 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 5791 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 5792 | nid_vol = 0x08; |
| 5793 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 5794 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 5795 | } else |
| 5796 | return 0; /* N/A */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5797 | |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5798 | if (!(*vol_bits & (1 << nid_vol))) { |
| 5799 | /* first control for the volume widget */ |
| 5800 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
| 5801 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 5802 | if (err < 0) |
| 5803 | return err; |
| 5804 | *vol_bits |= (1 << nid_vol); |
| 5805 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5806 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5807 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 5808 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5809 | return err; |
| 5810 | return 1; |
| 5811 | } |
| 5812 | |
| 5813 | /* add playback controls from the parsed DAC table */ |
| 5814 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 5815 | const struct auto_pin_cfg *cfg) |
| 5816 | { |
| 5817 | hda_nid_t nid; |
| 5818 | int err; |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5819 | int vols = 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5820 | |
| 5821 | spec->multiout.num_dacs = 1; |
| 5822 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 5823 | spec->multiout.dac_nids[0] = 0x02; |
| 5824 | |
| 5825 | nid = cfg->line_out_pins[0]; |
| 5826 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5827 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5828 | if (err < 0) |
| 5829 | return err; |
| 5830 | } |
| 5831 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5832 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5833 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5834 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5835 | if (err < 0) |
| 5836 | return err; |
| 5837 | } |
| 5838 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5839 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5840 | if (nid) { |
Takashi Iwai | 863b451 | 2008-10-21 17:01:47 +0200 | [diff] [blame] | 5841 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
| 5842 | &vols); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5843 | if (err < 0) |
| 5844 | return err; |
| 5845 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5846 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5847 | } |
| 5848 | |
| 5849 | /* create playback/capture controls for input pins */ |
| 5850 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 5851 | const struct auto_pin_cfg *cfg) |
| 5852 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 5853 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5854 | int i, err, idx; |
| 5855 | |
| 5856 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5857 | if (cfg->input_pins[i] >= 0x12) { |
| 5858 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5859 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5860 | auto_pin_cfg_labels[i], idx, |
| 5861 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5862 | if (err < 0) |
| 5863 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5864 | imux->items[imux->num_items].label = |
| 5865 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5866 | imux->items[imux->num_items].index = idx; |
| 5867 | imux->num_items++; |
| 5868 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5869 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5870 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5871 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5872 | auto_pin_cfg_labels[i], idx, |
| 5873 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5874 | if (err < 0) |
| 5875 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5876 | imux->items[imux->num_items].label = |
| 5877 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5878 | imux->items[imux->num_items].index = idx; |
| 5879 | imux->num_items++; |
| 5880 | } |
| 5881 | } |
| 5882 | return 0; |
| 5883 | } |
| 5884 | |
| 5885 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 5886 | hda_nid_t nid, int pin_type, |
| 5887 | int sel_idx) |
| 5888 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5889 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | /* need the manual connection? */ |
| 5891 | if (nid >= 0x12) { |
| 5892 | int idx = nid - 0x12; |
| 5893 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 5894 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 5899 | { |
| 5900 | struct alc_spec *spec = codec->spec; |
| 5901 | hda_nid_t nid; |
| 5902 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5903 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5904 | if (nid) { |
| 5905 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5906 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5907 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5908 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5909 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5910 | if (nid) |
| 5911 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5912 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5913 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5914 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5915 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5916 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5917 | |
| 5918 | #define ALC260_PIN_CD_NID 0x16 |
| 5919 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5920 | { |
| 5921 | struct alc_spec *spec = codec->spec; |
| 5922 | int i; |
| 5923 | |
| 5924 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5925 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5926 | if (nid >= 0x12) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 5927 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 5928 | if (nid != ALC260_PIN_CD_NID && |
| 5929 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5930 | snd_hda_codec_write(codec, nid, 0, |
| 5931 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5932 | AMP_OUT_MUTE); |
| 5933 | } |
| 5934 | } |
| 5935 | } |
| 5936 | |
| 5937 | /* |
| 5938 | * generic initialization of ADC, input mixers and output mixers |
| 5939 | */ |
| 5940 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5941 | /* |
| 5942 | * Unmute ADC0-1 and set the default input to mic-in |
| 5943 | */ |
| 5944 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5945 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5946 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5947 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5948 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5949 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5950 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5951 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5952 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5953 | */ |
| 5954 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5955 | /* mute analog inputs */ |
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5961 | |
| 5962 | /* |
| 5963 | * Set up output mixers (0x08 - 0x0a) |
| 5964 | */ |
| 5965 | /* set vol=0 to output mixers */ |
| 5966 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5967 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5968 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5969 | /* set up input amps for analog loopback */ |
| 5970 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5971 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5972 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5973 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5974 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5975 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5976 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 5977 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5978 | { } |
| 5979 | }; |
| 5980 | |
| 5981 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5982 | { |
| 5983 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | int err; |
| 5985 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5986 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5987 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5988 | alc260_ignore); |
| 5989 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5991 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5992 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5993 | return err; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 5994 | if (!spec->kctls.list) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5995 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5996 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5997 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5998 | return err; |
| 5999 | |
| 6000 | spec->multiout.max_channels = 2; |
| 6001 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 6002 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6003 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 6004 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6005 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6006 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 6007 | add_verb(spec, alc260_volume_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6009 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 6010 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6011 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 6012 | alc_ssid_check(codec, 0x10, 0x15, 0x0f); |
| 6013 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6014 | return 1; |
| 6015 | } |
| 6016 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6017 | /* additional initialization for auto-configuration model */ |
| 6018 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6020 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6021 | alc260_auto_init_multi_out(codec); |
| 6022 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6023 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 6024 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6025 | } |
| 6026 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6027 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6028 | static struct hda_amp_list alc260_loopbacks[] = { |
| 6029 | { 0x07, HDA_INPUT, 0 }, |
| 6030 | { 0x07, HDA_INPUT, 1 }, |
| 6031 | { 0x07, HDA_INPUT, 2 }, |
| 6032 | { 0x07, HDA_INPUT, 3 }, |
| 6033 | { 0x07, HDA_INPUT, 4 }, |
| 6034 | { } /* end */ |
| 6035 | }; |
| 6036 | #endif |
| 6037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6038 | /* |
| 6039 | * ALC260 configurations |
| 6040 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6041 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 6042 | [ALC260_BASIC] = "basic", |
| 6043 | [ALC260_HP] = "hp", |
| 6044 | [ALC260_HP_3013] = "hp-3013", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 6045 | [ALC260_HP_DC7600] = "hp-dc7600", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6046 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 6047 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6048 | [ALC260_WILL] = "will", |
| 6049 | [ALC260_REPLACER_672V] = "replacer", |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6050 | [ALC260_FAVORIT100] = "favorit100", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6051 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6052 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6053 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6054 | [ALC260_AUTO] = "auto", |
| 6055 | }; |
| 6056 | |
| 6057 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 6058 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6059 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6060 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 6061 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 6062 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6063 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
Jaroslav Kysela | 34ec8a0 | 2008-07-10 14:49:19 +0200 | [diff] [blame] | 6064 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6065 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6066 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 6067 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 6068 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 6069 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 6070 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 6071 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 6072 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 6073 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 6074 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6075 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6076 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6077 | {} |
| 6078 | }; |
| 6079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6080 | static struct alc_config_preset alc260_presets[] = { |
| 6081 | [ALC260_BASIC] = { |
| 6082 | .mixers = { alc260_base_output_mixer, |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6083 | alc260_input_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | .init_verbs = { alc260_init_verbs }, |
| 6085 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6086 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6087 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6088 | .adc_nids = alc260_adc_nids, |
| 6089 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6090 | .channel_mode = alc260_modes, |
| 6091 | .input_mux = &alc260_capture_source, |
| 6092 | }, |
| 6093 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6094 | .mixers = { alc260_hp_output_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6095 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6096 | .init_verbs = { alc260_init_verbs, |
| 6097 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6099 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6100 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6101 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6102 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6103 | .channel_mode = alc260_modes, |
| 6104 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6105 | .unsol_event = alc260_hp_unsol_event, |
| 6106 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6107 | }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6108 | [ALC260_HP_DC7600] = { |
| 6109 | .mixers = { alc260_hp_dc7600_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6110 | alc260_input_mixer }, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6111 | .init_verbs = { alc260_init_verbs, |
| 6112 | alc260_hp_dc7600_verbs }, |
| 6113 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6114 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6115 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6116 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | 3f87830 | 2008-08-26 13:02:23 +0200 | [diff] [blame] | 6117 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6118 | .channel_mode = alc260_modes, |
| 6119 | .input_mux = &alc260_capture_source, |
| 6120 | .unsol_event = alc260_hp_3012_unsol_event, |
| 6121 | .init_hook = alc260_hp_3012_automute, |
| 6122 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6123 | [ALC260_HP_3013] = { |
| 6124 | .mixers = { alc260_hp_3013_mixer, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6125 | alc260_input_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6126 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 6127 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6128 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6129 | .dac_nids = alc260_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6130 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), |
| 6131 | .adc_nids = alc260_adc_nids_alt, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6132 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6133 | .channel_mode = alc260_modes, |
| 6134 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 6135 | .unsol_event = alc260_hp_3013_unsol_event, |
| 6136 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6137 | }, |
| 6138 | [ALC260_FUJITSU_S702X] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6139 | .mixers = { alc260_fujitsu_mixer }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6140 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 6141 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6142 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 6143 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6144 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6146 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6147 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 6148 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6150 | [ALC260_ACER] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6151 | .mixers = { alc260_acer_mixer }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6152 | .init_verbs = { alc260_acer_init_verbs }, |
| 6153 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6154 | .dac_nids = alc260_dac_nids, |
| 6155 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6156 | .adc_nids = alc260_dual_adc_nids, |
| 6157 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6158 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6159 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 6160 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 6161 | }, |
Michael Schwingen | cc95948 | 2009-02-22 18:58:45 +0100 | [diff] [blame] | 6162 | [ALC260_FAVORIT100] = { |
| 6163 | .mixers = { alc260_favorit100_mixer }, |
| 6164 | .init_verbs = { alc260_favorit100_init_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6166 | .dac_nids = alc260_dac_nids, |
| 6167 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 6168 | .adc_nids = alc260_dual_adc_nids, |
| 6169 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6170 | .channel_mode = alc260_modes, |
| 6171 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), |
| 6172 | .input_mux = alc260_favorit100_capture_sources, |
| 6173 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6174 | [ALC260_WILL] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6175 | .mixers = { alc260_will_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6176 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 6177 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6178 | .dac_nids = alc260_dac_nids, |
| 6179 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6180 | .adc_nids = alc260_adc_nids, |
| 6181 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6182 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6183 | .channel_mode = alc260_modes, |
| 6184 | .input_mux = &alc260_capture_source, |
| 6185 | }, |
| 6186 | [ALC260_REPLACER_672V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6187 | .mixers = { alc260_replacer_672v_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6188 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 6189 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 6190 | .dac_nids = alc260_dac_nids, |
| 6191 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 6192 | .adc_nids = alc260_adc_nids, |
| 6193 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 6194 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6195 | .channel_mode = alc260_modes, |
| 6196 | .input_mux = &alc260_capture_source, |
| 6197 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 6198 | .init_hook = alc260_replacer_672v_automute, |
| 6199 | }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6200 | #ifdef CONFIG_SND_DEBUG |
| 6201 | [ALC260_TEST] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6202 | .mixers = { alc260_test_mixer }, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6203 | .init_verbs = { alc260_test_init_verbs }, |
| 6204 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 6205 | .dac_nids = alc260_test_dac_nids, |
| 6206 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 6207 | .adc_nids = alc260_test_adc_nids, |
| 6208 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 6209 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 6210 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 6211 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e4 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 6212 | }, |
| 6213 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6214 | }; |
| 6215 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6216 | static int patch_alc260(struct hda_codec *codec) |
| 6217 | { |
| 6218 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6219 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6220 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6221 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6222 | if (spec == NULL) |
| 6223 | return -ENOMEM; |
| 6224 | |
| 6225 | codec->spec = spec; |
| 6226 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6227 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 6228 | alc260_models, |
| 6229 | alc260_cfg_tbl); |
| 6230 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 6231 | snd_printd(KERN_INFO "hda_codec: Unknown model for %s, " |
| 6232 | "trying auto-probe from BIOS...\n", |
| 6233 | codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6234 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6235 | } |
| 6236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6237 | if (board_config == ALC260_AUTO) { |
| 6238 | /* automatic parse from the BIOS config */ |
| 6239 | err = alc260_parse_auto_config(codec); |
| 6240 | if (err < 0) { |
| 6241 | alc_free(codec); |
| 6242 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6243 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6244 | printk(KERN_INFO |
| 6245 | "hda_codec: Cannot set up configuration " |
| 6246 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6247 | board_config = ALC260_BASIC; |
| 6248 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6249 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6250 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 6251 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 6252 | if (err < 0) { |
| 6253 | alc_free(codec); |
| 6254 | return err; |
| 6255 | } |
| 6256 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6257 | if (board_config != ALC260_AUTO) |
| 6258 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6260 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 6261 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 6262 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 6263 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 6264 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 6265 | |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6266 | if (!spec->adc_nids && spec->input_mux) { |
| 6267 | /* check whether NID 0x04 is valid */ |
| 6268 | unsigned int wcap = get_wcaps(codec, 0x04); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 6269 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4ef0ef1 | 2008-11-03 17:47:49 +0100 | [diff] [blame] | 6270 | /* get type */ |
| 6271 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 6272 | spec->adc_nids = alc260_adc_nids_alt; |
| 6273 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 6274 | } else { |
| 6275 | spec->adc_nids = alc260_adc_nids; |
| 6276 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 6277 | } |
| 6278 | } |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6279 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 6280 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 6281 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6282 | spec->vmaster_nid = 0x08; |
| 6283 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6284 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6285 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6286 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6287 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6288 | if (!spec->loopback.amplist) |
| 6289 | spec->loopback.amplist = alc260_loopbacks; |
| 6290 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 6291 | codec->proc_widget_hook = print_realtek_coef; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6292 | |
| 6293 | return 0; |
| 6294 | } |
| 6295 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6297 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6298 | * ALC882/883/885/888/889 support |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6299 | * |
| 6300 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 6301 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6302 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6303 | * 6-channel independent captures. |
| 6304 | * |
| 6305 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6306 | * driver yet). |
| 6307 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6308 | #define ALC882_DIGOUT_NID 0x06 |
| 6309 | #define ALC882_DIGIN_NID 0x0a |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6310 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID |
| 6311 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID |
| 6312 | #define ALC1200_DIGOUT_NID 0x10 |
| 6313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6314 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 6315 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6316 | { 8, NULL } |
| 6317 | }; |
| 6318 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6319 | /* DACs */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6320 | static hda_nid_t alc882_dac_nids[4] = { |
| 6321 | /* front, rear, clfe, rear_surr */ |
| 6322 | 0x02, 0x03, 0x04, 0x05 |
| 6323 | }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6324 | #define alc883_dac_nids alc882_dac_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6325 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6326 | /* ADCs */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6327 | #define alc882_adc_nids alc880_adc_nids |
| 6328 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6329 | #define alc883_adc_nids alc882_adc_nids_alt |
| 6330 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; |
| 6331 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; |
| 6332 | #define alc889_adc_nids alc880_adc_nids |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6333 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6334 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 6335 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6336 | #define alc883_capsrc_nids alc882_capsrc_nids_alt |
| 6337 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
| 6338 | #define alc889_capsrc_nids alc882_capsrc_nids |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6339 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6340 | /* input MUX */ |
| 6341 | /* FIXME: should be a matrix-type input source selection */ |
| 6342 | |
| 6343 | static struct hda_input_mux alc882_capture_source = { |
| 6344 | .num_items = 4, |
| 6345 | .items = { |
| 6346 | { "Mic", 0x0 }, |
| 6347 | { "Front Mic", 0x1 }, |
| 6348 | { "Line", 0x2 }, |
| 6349 | { "CD", 0x4 }, |
| 6350 | }, |
| 6351 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6352 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6353 | #define alc883_capture_source alc882_capture_source |
| 6354 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6355 | static struct hda_input_mux alc889_capture_source = { |
| 6356 | .num_items = 3, |
| 6357 | .items = { |
| 6358 | { "Front Mic", 0x0 }, |
| 6359 | { "Mic", 0x3 }, |
| 6360 | { "Line", 0x2 }, |
| 6361 | }, |
| 6362 | }; |
| 6363 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6364 | static struct hda_input_mux mb5_capture_source = { |
| 6365 | .num_items = 3, |
| 6366 | .items = { |
| 6367 | { "Mic", 0x1 }, |
| 6368 | { "Line", 0x2 }, |
| 6369 | { "CD", 0x4 }, |
| 6370 | }, |
| 6371 | }; |
| 6372 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6373 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6374 | .num_items = 4, |
| 6375 | .items = { |
| 6376 | { "Mic", 0x1 }, |
| 6377 | { "Front Mic", 0x0 }, |
| 6378 | { "Line", 0x2 }, |
| 6379 | { "CD", 0x4 }, |
| 6380 | }, |
| 6381 | }; |
| 6382 | |
| 6383 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6384 | .num_items = 2, |
| 6385 | .items = { |
| 6386 | { "Mic", 0x1 }, |
| 6387 | { "Line", 0x2 }, |
| 6388 | }, |
| 6389 | }; |
| 6390 | |
| 6391 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6392 | .num_items = 4, |
| 6393 | .items = { |
| 6394 | { "Mic", 0x0 }, |
| 6395 | { "iMic", 0x1 }, |
| 6396 | { "Line", 0x2 }, |
| 6397 | { "CD", 0x4 }, |
| 6398 | }, |
| 6399 | }; |
| 6400 | |
| 6401 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6402 | .num_items = 2, |
| 6403 | .items = { |
| 6404 | { "Mic", 0x0 }, |
| 6405 | { "Int Mic", 0x1 }, |
| 6406 | }, |
| 6407 | }; |
| 6408 | |
| 6409 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { |
| 6410 | .num_items = 3, |
| 6411 | .items = { |
| 6412 | { "Mic", 0x0 }, |
| 6413 | { "Front Mic", 0x1 }, |
| 6414 | { "Line", 0x4 }, |
| 6415 | }, |
| 6416 | }; |
| 6417 | |
| 6418 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { |
| 6419 | .num_items = 2, |
| 6420 | .items = { |
| 6421 | { "Mic", 0x0 }, |
| 6422 | { "Line", 0x2 }, |
| 6423 | }, |
| 6424 | }; |
| 6425 | |
| 6426 | static struct hda_input_mux alc889A_mb31_capture_source = { |
| 6427 | .num_items = 2, |
| 6428 | .items = { |
| 6429 | { "Mic", 0x0 }, |
| 6430 | /* Front Mic (0x01) unused */ |
| 6431 | { "Line", 0x2 }, |
| 6432 | /* Line 2 (0x03) unused */ |
| 6433 | /* CD (0x04) unsused? */ |
| 6434 | }, |
| 6435 | }; |
| 6436 | |
| 6437 | /* |
| 6438 | * 2ch mode |
| 6439 | */ |
| 6440 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6441 | { 2, NULL } |
| 6442 | }; |
| 6443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6444 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6445 | * 2ch mode |
| 6446 | */ |
| 6447 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 6448 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6449 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6450 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6451 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6452 | { } /* end */ |
| 6453 | }; |
| 6454 | |
| 6455 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6456 | * 4ch mode |
| 6457 | */ |
| 6458 | static struct hda_verb alc882_3ST_ch4_init[] = { |
| 6459 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6460 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6461 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6462 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6463 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6464 | { } /* end */ |
| 6465 | }; |
| 6466 | |
| 6467 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6468 | * 6ch mode |
| 6469 | */ |
| 6470 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 6471 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6472 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6473 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6474 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6475 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6476 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6477 | { } /* end */ |
| 6478 | }; |
| 6479 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6480 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6481 | { 2, alc882_3ST_ch2_init }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6482 | { 4, alc882_3ST_ch4_init }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6483 | { 6, alc882_3ST_ch6_init }, |
| 6484 | }; |
| 6485 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6486 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes |
| 6487 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6488 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6489 | * 6ch mode |
| 6490 | */ |
| 6491 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 6492 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6493 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6494 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6495 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6496 | { } /* end */ |
| 6497 | }; |
| 6498 | |
| 6499 | /* |
| 6500 | * 8ch mode |
| 6501 | */ |
| 6502 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 6503 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6504 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6505 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6506 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6507 | { } /* end */ |
| 6508 | }; |
| 6509 | |
| 6510 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 6511 | { 6, alc882_sixstack_ch6_init }, |
| 6512 | { 8, alc882_sixstack_ch8_init }, |
| 6513 | }; |
| 6514 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6515 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 6516 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6517 | */ |
| 6518 | |
| 6519 | /* |
| 6520 | * 2ch mode |
| 6521 | */ |
| 6522 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 6523 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6524 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6525 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6526 | { } /* end */ |
| 6527 | }; |
| 6528 | |
| 6529 | /* |
| 6530 | * 6ch mode |
| 6531 | */ |
| 6532 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 6533 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6534 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6535 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6536 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6537 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6538 | { } /* end */ |
| 6539 | }; |
| 6540 | |
| 6541 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 6542 | { 2, alc885_mbp_ch2_init }, |
| 6543 | { 6, alc885_mbp_ch6_init }, |
| 6544 | }; |
| 6545 | |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6546 | /* |
| 6547 | * 2ch |
| 6548 | * Speakers/Woofer/HP = Front |
| 6549 | * LineIn = Input |
| 6550 | */ |
| 6551 | static struct hda_verb alc885_mb5_ch2_init[] = { |
| 6552 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6553 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6554 | { } /* end */ |
| 6555 | }; |
| 6556 | |
| 6557 | /* |
| 6558 | * 6ch mode |
| 6559 | * Speakers/HP = Front |
| 6560 | * Woofer = LFE |
| 6561 | * LineIn = Surround |
| 6562 | */ |
| 6563 | static struct hda_verb alc885_mb5_ch6_init[] = { |
| 6564 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6565 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6566 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6567 | { } /* end */ |
| 6568 | }; |
| 6569 | |
| 6570 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { |
| 6571 | { 2, alc885_mb5_ch2_init }, |
| 6572 | { 6, alc885_mb5_ch6_init }, |
| 6573 | }; |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6574 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6575 | |
| 6576 | /* |
| 6577 | * 2ch mode |
| 6578 | */ |
| 6579 | static struct hda_verb alc883_4ST_ch2_init[] = { |
| 6580 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6581 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6582 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6583 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6584 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6585 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6586 | { } /* end */ |
| 6587 | }; |
| 6588 | |
| 6589 | /* |
| 6590 | * 4ch mode |
| 6591 | */ |
| 6592 | static struct hda_verb alc883_4ST_ch4_init[] = { |
| 6593 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6594 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6595 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6596 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6597 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6598 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6599 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6600 | { } /* end */ |
| 6601 | }; |
| 6602 | |
| 6603 | /* |
| 6604 | * 6ch mode |
| 6605 | */ |
| 6606 | static struct hda_verb alc883_4ST_ch6_init[] = { |
| 6607 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6608 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6609 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6610 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6611 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6612 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6613 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6614 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6615 | { } /* end */ |
| 6616 | }; |
| 6617 | |
| 6618 | /* |
| 6619 | * 8ch mode |
| 6620 | */ |
| 6621 | static struct hda_verb alc883_4ST_ch8_init[] = { |
| 6622 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6623 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6624 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6625 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6626 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6627 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6628 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6629 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6630 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6631 | { } /* end */ |
| 6632 | }; |
| 6633 | |
| 6634 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { |
| 6635 | { 2, alc883_4ST_ch2_init }, |
| 6636 | { 4, alc883_4ST_ch4_init }, |
| 6637 | { 6, alc883_4ST_ch6_init }, |
| 6638 | { 8, alc883_4ST_ch8_init }, |
| 6639 | }; |
| 6640 | |
| 6641 | |
| 6642 | /* |
| 6643 | * 2ch mode |
| 6644 | */ |
| 6645 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6646 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6647 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6648 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6649 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6650 | { } /* end */ |
| 6651 | }; |
| 6652 | |
| 6653 | /* |
| 6654 | * 4ch mode |
| 6655 | */ |
| 6656 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6657 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6658 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6659 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6660 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6661 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6662 | { } /* end */ |
| 6663 | }; |
| 6664 | |
| 6665 | /* |
| 6666 | * 6ch mode |
| 6667 | */ |
| 6668 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6669 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6670 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6671 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6672 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6673 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6674 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6675 | { } /* end */ |
| 6676 | }; |
| 6677 | |
| 6678 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6679 | { 2, alc883_3ST_ch2_intel_init }, |
| 6680 | { 4, alc883_3ST_ch4_intel_init }, |
| 6681 | { 6, alc883_3ST_ch6_intel_init }, |
| 6682 | }; |
| 6683 | |
| 6684 | /* |
| 6685 | * 6ch mode |
| 6686 | */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6687 | static struct hda_verb alc889_ch6_intel_init[] = { |
| 6688 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6689 | { 0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6690 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6691 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6692 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6693 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6694 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6695 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6696 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6697 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6698 | { } /* end */ |
| 6699 | }; |
| 6700 | |
| 6701 | /* |
| 6702 | * 8ch mode |
| 6703 | */ |
| 6704 | static struct hda_verb alc889_ch8_intel_init[] = { |
| 6705 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6706 | { 0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6707 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6708 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6709 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6710 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6711 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6712 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6713 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6714 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6715 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, |
| 6716 | { } /* end */ |
| 6717 | }; |
| 6718 | |
| 6719 | static struct hda_channel_mode alc889_8ch_intel_modes[2] = { |
| 6720 | { 6, alc889_ch6_intel_init }, |
| 6721 | { 8, alc889_ch8_intel_init }, |
| 6722 | }; |
| 6723 | |
| 6724 | /* |
| 6725 | * 6ch mode |
| 6726 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6727 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6728 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6729 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6730 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6731 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6732 | { } /* end */ |
| 6733 | }; |
| 6734 | |
| 6735 | /* |
| 6736 | * 8ch mode |
| 6737 | */ |
| 6738 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6739 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6740 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6741 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6742 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6743 | { } /* end */ |
| 6744 | }; |
| 6745 | |
| 6746 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6747 | { 6, alc883_sixstack_ch6_init }, |
| 6748 | { 8, alc883_sixstack_ch8_init }, |
| 6749 | }; |
| 6750 | |
| 6751 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6752 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6753 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6754 | */ |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 6755 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6756 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6757 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6759 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6761 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6762 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6763 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6764 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 6765 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6766 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6767 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6768 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6770 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6772 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6773 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6775 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6776 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6777 | { } /* end */ |
| 6778 | }; |
| 6779 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6780 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6781 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6782 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6783 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 6784 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6785 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6786 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6787 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 6788 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6789 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6790 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 6791 | { } /* end */ |
| 6792 | }; |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6793 | |
| 6794 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6795 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 6796 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 6797 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 6798 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), |
| 6800 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), |
| 6802 | HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 6803 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6804 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6805 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 6806 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 6807 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), |
| 6808 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), |
| 6809 | { } /* end */ |
| 6810 | }; |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 6811 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6812 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 6813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6814 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6815 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6816 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6817 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6818 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6819 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6820 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6821 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6822 | { } /* end */ |
| 6823 | }; |
| 6824 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6825 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 6826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6827 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6828 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6829 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6830 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6831 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6832 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6835 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6836 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6837 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6838 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6839 | { } /* end */ |
| 6840 | }; |
| 6841 | |
| 6842 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 6843 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 6844 | */ |
| 6845 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 6846 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6847 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6848 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6849 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 6850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6853 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6854 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 6855 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 6856 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6857 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 6858 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6859 | { } /* end */ |
| 6860 | }; |
| 6861 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6862 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 6863 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6864 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6866 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6867 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6868 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6869 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6870 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6871 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6872 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6873 | { } /* end */ |
| 6874 | }; |
| 6875 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6876 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 6877 | { |
| 6878 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6879 | .name = "Channel Mode", |
| 6880 | .info = alc_ch_mode_info, |
| 6881 | .get = alc_ch_mode_get, |
| 6882 | .put = alc_ch_mode_put, |
| 6883 | }, |
| 6884 | { } /* end */ |
| 6885 | }; |
| 6886 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6887 | static struct hda_verb alc882_base_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6888 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6889 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6892 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6893 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6894 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6895 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6896 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6897 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6898 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6899 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6900 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6901 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6903 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6904 | |
Takashi Iwai | cb63812 | 2009-07-03 10:56:10 +0200 | [diff] [blame] | 6905 | /* mute analog input loopbacks */ |
| 6906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6911 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6912 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6913 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6915 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6916 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6917 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6918 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6919 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6920 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6921 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6922 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6923 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6924 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6925 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6926 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6927 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6928 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6931 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 6932 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6933 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6934 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6936 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6937 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6938 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6940 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6941 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6942 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6943 | |
| 6944 | /* FIXME: use matrix-type input source selection */ |
| 6945 | /* 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] | 6946 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6949 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6950 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6951 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6954 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6955 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6956 | /* ADC2: mute amp left and right */ |
| 6957 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6958 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 6959 | /* ADC3: mute amp left and right */ |
| 6960 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 6961 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6962 | |
| 6963 | { } |
| 6964 | }; |
| 6965 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 6966 | static struct hda_verb alc882_adc1_init_verbs[] = { |
| 6967 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6968 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6969 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6970 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 6972 | /* ADC1: mute amp left and right */ |
| 6973 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6974 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6975 | { } |
| 6976 | }; |
| 6977 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6978 | static struct hda_verb alc882_eapd_verbs[] = { |
| 6979 | /* change to EAPD mode */ |
| 6980 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6981 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6982 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6983 | }; |
| 6984 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 6985 | static struct hda_verb alc889_eapd_verbs[] = { |
| 6986 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 6987 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 6988 | { } |
| 6989 | }; |
| 6990 | |
| 6991 | |
| 6992 | static struct hda_verb alc885_init_verbs[] = { |
| 6993 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6994 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6995 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6996 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6997 | /* Rear mixer */ |
| 6998 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6999 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7000 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7001 | /* CLFE mixer */ |
| 7002 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7003 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7004 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7005 | /* Side mixer */ |
| 7006 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7007 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7008 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7009 | |
| 7010 | /* mute analog input loopbacks */ |
| 7011 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7012 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7013 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7014 | |
| 7015 | /* Front HP Pin: output 0 (0x0c) */ |
| 7016 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7017 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7018 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7019 | /* Front Pin: output 0 (0x0c) */ |
| 7020 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7021 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7022 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7023 | /* Rear Pin: output 1 (0x0d) */ |
| 7024 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7025 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7026 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7027 | /* CLFE Pin: output 2 (0x0e) */ |
| 7028 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7029 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7030 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7031 | /* Side Pin: output 3 (0x0f) */ |
| 7032 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7033 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7034 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7035 | /* Mic (rear) pin: input vref at 80% */ |
| 7036 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7037 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7038 | /* Front Mic pin: input vref at 80% */ |
| 7039 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7040 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7041 | /* Line In pin: input */ |
| 7042 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7043 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7044 | |
| 7045 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ |
| 7046 | /* Input mixer1 */ |
| 7047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7050 | /* Input mixer2 */ |
| 7051 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7054 | /* Input mixer3 */ |
| 7055 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7056 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7058 | /* ADC2: mute amp left and right */ |
| 7059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7060 | /* ADC3: mute amp left and right */ |
| 7061 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7062 | |
| 7063 | { } |
| 7064 | }; |
| 7065 | |
| 7066 | static struct hda_verb alc885_init_input_verbs[] = { |
| 7067 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7068 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
| 7070 | { } |
| 7071 | }; |
| 7072 | |
| 7073 | |
| 7074 | /* Unmute Selector 24h and set the default input to front mic */ |
| 7075 | static struct hda_verb alc889_init_input_verbs[] = { |
| 7076 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7077 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7078 | { } |
| 7079 | }; |
| 7080 | |
| 7081 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7082 | #define alc883_init_verbs alc882_base_init_verbs |
| 7083 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7084 | /* Mac Pro test */ |
| 7085 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 7086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7087 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7088 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 7089 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7090 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7091 | /* FIXME: this looks suspicious... |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7092 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7093 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 7094 | */ |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7095 | { } /* end */ |
| 7096 | }; |
| 7097 | |
| 7098 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 7099 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7100 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7103 | /* Front Pin: output 0 (0x0c) */ |
| 7104 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7105 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7106 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7107 | /* Front Mic pin: input vref at 80% */ |
| 7108 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7109 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7110 | /* Speaker: output */ |
| 7111 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7112 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7113 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 7114 | /* Headphone output (output 0 - 0x0c) */ |
| 7115 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7116 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7117 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7118 | |
| 7119 | /* FIXME: use matrix-type input source selection */ |
| 7120 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7121 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7123 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7124 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7125 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7126 | /* Input mixer2 */ |
| 7127 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7128 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7129 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7130 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7131 | /* Input mixer3 */ |
| 7132 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7133 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7134 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7135 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7136 | /* ADC1: mute amp left and right */ |
| 7137 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7138 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7139 | /* ADC2: mute amp left and right */ |
| 7140 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7141 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7142 | /* ADC3: mute amp left and right */ |
| 7143 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7144 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7145 | |
| 7146 | { } |
| 7147 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7148 | |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7149 | /* Macbook 5,1 */ |
| 7150 | static struct hda_verb alc885_mb5_init_verbs[] = { |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7151 | /* DACs */ |
| 7152 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7153 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7154 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7155 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7156 | /* Front mixer */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7157 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7158 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7159 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7160 | /* Surround mixer */ |
| 7161 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7162 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7163 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7164 | /* LFE mixer */ |
| 7165 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7166 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7167 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7168 | /* HP mixer */ |
| 7169 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7170 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7171 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7172 | /* Front Pin (0x0c) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7173 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7174 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7175 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7176 | /* LFE Pin (0x0e) */ |
| 7177 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, |
| 7178 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7179 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7180 | /* HP Pin (0x0f) */ |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7181 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7182 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kacper Szczesniak | 92b9de8 | 2009-06-02 00:55:19 +0200 | [diff] [blame] | 7183 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Kacper Szczesniak | 41d5545 | 2009-05-07 12:47:43 +0200 | [diff] [blame] | 7184 | /* Front Mic pin: input vref at 80% */ |
| 7185 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7186 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7187 | /* Line In pin */ |
| 7188 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7189 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7190 | |
| 7191 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7195 | { } |
| 7196 | }; |
| 7197 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7198 | /* Macbook Pro rev3 */ |
| 7199 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 7200 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7201 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7202 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7203 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7204 | /* Rear mixer */ |
| 7205 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7206 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7207 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7208 | /* Front Pin: output 0 (0x0c) */ |
| 7209 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7210 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7211 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7212 | /* HP Pin: output 0 (0x0d) */ |
| 7213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 7214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7215 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7216 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7217 | /* Mic (rear) pin: input vref at 80% */ |
| 7218 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7219 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7220 | /* Front Mic pin: input vref at 80% */ |
| 7221 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7222 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7223 | /* Line In pin: use output 1 when in LineOut mode */ |
| 7224 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7225 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7226 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7227 | |
| 7228 | /* FIXME: use matrix-type input source selection */ |
| 7229 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7230 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 7231 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7232 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7233 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7234 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7235 | /* Input mixer2 */ |
| 7236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7238 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7239 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7240 | /* Input mixer3 */ |
| 7241 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7242 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7243 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7244 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 7245 | /* ADC1: mute amp left and right */ |
| 7246 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7247 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7248 | /* ADC2: mute amp left and right */ |
| 7249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7250 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7251 | /* ADC3: mute amp left and right */ |
| 7252 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7253 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7254 | |
| 7255 | { } |
| 7256 | }; |
| 7257 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7258 | /* iMac 24 mixer. */ |
| 7259 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 7260 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7261 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 7262 | { } /* end */ |
| 7263 | }; |
| 7264 | |
| 7265 | /* iMac 24 init verbs. */ |
| 7266 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 7267 | /* Internal speakers: output 0 (0x0c) */ |
| 7268 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7269 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7270 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7271 | /* Internal speakers: output 0 (0x0c) */ |
| 7272 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7273 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7274 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7275 | /* Headphone: output 0 (0x0c) */ |
| 7276 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7277 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7278 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7279 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7280 | /* Front Mic: input vref at 80% */ |
| 7281 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7283 | { } |
| 7284 | }; |
| 7285 | |
| 7286 | /* Toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7287 | static void alc885_imac24_automute_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7288 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7289 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7290 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7291 | spec->autocfg.hp_pins[0] = 0x14; |
| 7292 | spec->autocfg.speaker_pins[0] = 0x18; |
| 7293 | spec->autocfg.speaker_pins[1] = 0x1a; |
| 7294 | alc_automute_amp(codec); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7295 | } |
| 7296 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7297 | static void alc885_mbp3_init_hook(struct hda_codec *codec) |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7298 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7299 | struct alc_spec *spec = codec->spec; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 7300 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7301 | spec->autocfg.hp_pins[0] = 0x15; |
| 7302 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7303 | alc_automute_amp(codec); |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 7304 | } |
| 7305 | |
| 7306 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7307 | static struct hda_verb alc882_targa_verbs[] = { |
| 7308 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7309 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7310 | |
| 7311 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7312 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7313 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7314 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7315 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7316 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7317 | |
| 7318 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7319 | { } /* end */ |
| 7320 | }; |
| 7321 | |
| 7322 | /* toggle speaker-output according to the hp-jack state */ |
| 7323 | static void alc882_targa_automute(struct hda_codec *codec) |
| 7324 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7325 | struct alc_spec *spec = codec->spec; |
| 7326 | alc_automute_amp(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7327 | 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] | 7328 | spec->jack_present ? 1 : 3); |
| 7329 | } |
| 7330 | |
| 7331 | static void alc882_targa_init_hook(struct hda_codec *codec) |
| 7332 | { |
| 7333 | struct alc_spec *spec = codec->spec; |
| 7334 | |
| 7335 | spec->autocfg.hp_pins[0] = 0x14; |
| 7336 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 7337 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7338 | } |
| 7339 | |
| 7340 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7341 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7342 | if ((res >> 26) == ALC880_HP_EVENT) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7343 | alc882_targa_automute(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7344 | } |
| 7345 | |
| 7346 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 7347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7348 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7349 | |
| 7350 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7351 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7352 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7353 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7354 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7355 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7356 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7357 | |
| 7358 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7359 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7360 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7361 | { } /* end */ |
| 7362 | }; |
| 7363 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7364 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 7365 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7366 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7367 | |
| 7368 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7369 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7370 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7371 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 7372 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7373 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7374 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 7375 | |
| 7376 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7377 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7378 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7379 | { } /* end */ |
| 7380 | }; |
| 7381 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 7382 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 7383 | { |
| 7384 | unsigned int gpiostate, gpiomask, gpiodir; |
| 7385 | |
| 7386 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 7387 | AC_VERB_GET_GPIO_DATA, 0); |
| 7388 | |
| 7389 | if (!muted) |
| 7390 | gpiostate |= (1 << pin); |
| 7391 | else |
| 7392 | gpiostate &= ~(1 << pin); |
| 7393 | |
| 7394 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 7395 | AC_VERB_GET_GPIO_MASK, 0); |
| 7396 | gpiomask |= (1 << pin); |
| 7397 | |
| 7398 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 7399 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 7400 | gpiodir |= (1 << pin); |
| 7401 | |
| 7402 | |
| 7403 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7404 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 7405 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7406 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 7407 | |
| 7408 | msleep(1); |
| 7409 | |
| 7410 | snd_hda_codec_write(codec, codec->afg, 0, |
| 7411 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 7412 | } |
| 7413 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7414 | /* set up GPIO at initialization */ |
| 7415 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 7416 | { |
| 7417 | alc882_gpio_mute(codec, 0, 0); |
| 7418 | alc882_gpio_mute(codec, 1, 0); |
| 7419 | } |
| 7420 | |
| 7421 | /* set up GPIO and update auto-muting at initialization */ |
| 7422 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 7423 | { |
| 7424 | alc885_macpro_init_hook(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7425 | alc885_imac24_automute_init_hook(codec); |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 7426 | } |
| 7427 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7428 | /* |
| 7429 | * generic initialization of ADC, input mixers and output mixers |
| 7430 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7431 | static struct hda_verb alc883_auto_init_verbs[] = { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7432 | /* |
| 7433 | * Unmute ADC0-2 and set the default input to mic-in |
| 7434 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7435 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7436 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7437 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7438 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7439 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7440 | /* 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] | 7441 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7442 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7443 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7444 | */ |
| 7445 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7446 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7447 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7448 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7451 | |
| 7452 | /* |
| 7453 | * Set up output mixers (0x0c - 0x0f) |
| 7454 | */ |
| 7455 | /* set vol=0 to output mixers */ |
| 7456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7458 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7459 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7460 | /* set up input amps for analog loopback */ |
| 7461 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7462 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7464 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7465 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7466 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7467 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7468 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7469 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7470 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7471 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7472 | |
| 7473 | /* FIXME: use matrix-type input source selection */ |
| 7474 | /* 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] | 7475 | /* Input mixer2 */ |
| 7476 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7477 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7478 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7479 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7480 | /* Input mixer3 */ |
| 7481 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 7482 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 7483 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 7484 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 7485 | |
| 7486 | { } |
| 7487 | }; |
| 7488 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7489 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ |
| 7490 | static struct hda_verb alc889A_mb31_ch2_init[] = { |
| 7491 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7492 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7493 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7494 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7495 | { } /* end */ |
| 7496 | }; |
| 7497 | |
| 7498 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ |
| 7499 | static struct hda_verb alc889A_mb31_ch4_init[] = { |
| 7500 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ |
| 7501 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7502 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7503 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7504 | { } /* end */ |
| 7505 | }; |
| 7506 | |
| 7507 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ |
| 7508 | static struct hda_verb alc889A_mb31_ch5_init[] = { |
| 7509 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ |
| 7510 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ |
| 7511 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ |
| 7512 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ |
| 7513 | { } /* end */ |
| 7514 | }; |
| 7515 | |
| 7516 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ |
| 7517 | static struct hda_verb alc889A_mb31_ch6_init[] = { |
| 7518 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ |
| 7519 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ |
| 7520 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ |
| 7521 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ |
| 7522 | { } /* end */ |
| 7523 | }; |
| 7524 | |
| 7525 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { |
| 7526 | { 2, alc889A_mb31_ch2_init }, |
| 7527 | { 4, alc889A_mb31_ch4_init }, |
| 7528 | { 5, alc889A_mb31_ch5_init }, |
| 7529 | { 6, alc889A_mb31_ch6_init }, |
| 7530 | }; |
| 7531 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7532 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 7533 | /* eanable EAPD on medion laptop */ |
| 7534 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7535 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 7536 | { } |
| 7537 | }; |
| 7538 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 7539 | #define alc883_base_mixer alc882_base_mixer |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7540 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7541 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 7542 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7543 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7544 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7545 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7546 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7547 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7548 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7549 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7550 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7551 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7552 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7553 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7554 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7555 | { } /* end */ |
| 7556 | }; |
| 7557 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7558 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7559 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7560 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7561 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7562 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7563 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7564 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7565 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7566 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7567 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7568 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7569 | { } /* end */ |
| 7570 | }; |
| 7571 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7572 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 7573 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7574 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7575 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7576 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7578 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7579 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7580 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7581 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7582 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7583 | { } /* end */ |
| 7584 | }; |
| 7585 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7586 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 7587 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7588 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7589 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7590 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7591 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7592 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7593 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7594 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7595 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7596 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7597 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7598 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7599 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7600 | { } /* end */ |
| 7601 | }; |
| 7602 | |
| 7603 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 7604 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7605 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7606 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7607 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7608 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7609 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7610 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7611 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7613 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7614 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7615 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7616 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7617 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7618 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7620 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7621 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7622 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7623 | { } /* end */ |
| 7624 | }; |
| 7625 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7626 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7627 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7628 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7629 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7630 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7631 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7632 | HDA_OUTPUT), |
| 7633 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7634 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7635 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7637 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7638 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7639 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7640 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7642 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7644 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7645 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7647 | { } /* end */ |
| 7648 | }; |
| 7649 | |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 7650 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { |
| 7651 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7652 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7653 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7654 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7655 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7656 | HDA_OUTPUT), |
| 7657 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7658 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7659 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7660 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7661 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), |
| 7662 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7663 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7664 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7665 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 7666 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), |
| 7667 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 7668 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7669 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7670 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7671 | { } /* end */ |
| 7672 | }; |
| 7673 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7674 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7675 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7676 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7677 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7678 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7679 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7680 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame] | 7681 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7682 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7683 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7684 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7685 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7686 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7687 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7688 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7689 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7690 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7691 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7692 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7693 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7694 | { } /* end */ |
| 7695 | }; |
| 7696 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7697 | static struct snd_kcontrol_new alc883_targa_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7698 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7700 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7701 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7702 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7703 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7704 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7705 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7706 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7707 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7708 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7709 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7710 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7711 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7713 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7714 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7715 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7716 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7717 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7719 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7720 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7721 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7722 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7723 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7724 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7725 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7726 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7727 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7728 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7729 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7730 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7731 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7732 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7733 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7734 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7735 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7736 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7739 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7741 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7742 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7743 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7744 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7745 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7746 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7747 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7748 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7749 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7752 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7753 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7754 | { } /* end */ |
| 7755 | }; |
| 7756 | |
| 7757 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7758 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7759 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7760 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7761 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7762 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7763 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7764 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7765 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7766 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7767 | { } /* end */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7768 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7769 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7770 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7771 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7772 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7773 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7774 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7775 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7777 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7778 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7779 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7780 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7781 | |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7782 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { |
| 7783 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7784 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7785 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7786 | HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT), |
Tony Vroon | 684a884 | 2009-06-26 09:27:50 +0100 | [diff] [blame] | 7787 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7788 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 7789 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7790 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7791 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7792 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7793 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7794 | { } /* end */ |
| 7795 | }; |
| 7796 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7797 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { |
| 7798 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7799 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7800 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 7801 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 7802 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", |
| 7803 | 0x0d, 1, 0x0, HDA_OUTPUT), |
| 7804 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 7805 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 7806 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 7807 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 7808 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7809 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7810 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7811 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7812 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7813 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7814 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7815 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7816 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7817 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 7818 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7819 | { } /* end */ |
| 7820 | }; |
| 7821 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 7822 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { |
| 7823 | /* Output mixers */ |
| 7824 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 7825 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 7826 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 7827 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), |
| 7828 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, |
| 7829 | HDA_OUTPUT), |
| 7830 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), |
| 7831 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), |
| 7832 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), |
| 7833 | /* Output switches */ |
| 7834 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), |
| 7835 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), |
| 7836 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), |
| 7837 | /* Boost mixers */ |
| 7838 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 7839 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
| 7840 | /* Input mixers */ |
| 7841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 7842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
| 7843 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7844 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7845 | { } /* end */ |
| 7846 | }; |
| 7847 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 7848 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { |
| 7849 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7850 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7851 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7853 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7854 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7855 | { } /* end */ |
| 7856 | }; |
| 7857 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7858 | static struct hda_bind_ctls alc883_bind_cap_vol = { |
| 7859 | .ops = &snd_hda_bind_vol, |
| 7860 | .values = { |
| 7861 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7862 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7863 | 0 |
| 7864 | }, |
| 7865 | }; |
| 7866 | |
| 7867 | static struct hda_bind_ctls alc883_bind_cap_switch = { |
| 7868 | .ops = &snd_hda_bind_sw, |
| 7869 | .values = { |
| 7870 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), |
| 7871 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 7872 | 0 |
| 7873 | }, |
| 7874 | }; |
| 7875 | |
| 7876 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { |
| 7877 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7878 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7879 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7880 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7881 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7882 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7883 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7884 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 7885 | { } /* end */ |
| 7886 | }; |
| 7887 | |
| 7888 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7889 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), |
| 7890 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), |
| 7891 | { |
| 7892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7893 | /* .name = "Capture Source", */ |
| 7894 | .name = "Input Source", |
| 7895 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 7896 | .info = alc_mux_enum_info, |
| 7897 | .get = alc_mux_enum_get, |
| 7898 | .put = alc_mux_enum_put, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 7899 | }, |
| 7900 | { } /* end */ |
| 7901 | }; |
| 7902 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7903 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7904 | { |
| 7905 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7906 | .name = "Channel Mode", |
| 7907 | .info = alc_ch_mode_info, |
| 7908 | .get = alc_ch_mode_get, |
| 7909 | .put = alc_ch_mode_put, |
| 7910 | }, |
| 7911 | { } /* end */ |
| 7912 | }; |
| 7913 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7914 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7915 | static void alc883_mitac_init_hook(struct hda_codec *codec) |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7916 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7917 | struct alc_spec *spec = codec->spec; |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7918 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 7919 | spec->autocfg.hp_pins[0] = 0x15; |
| 7920 | spec->autocfg.speaker_pins[0] = 0x14; |
| 7921 | spec->autocfg.speaker_pins[1] = 0x17; |
| 7922 | alc_automute_amp(codec); |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7923 | } |
| 7924 | |
| 7925 | /* auto-toggle front mic */ |
| 7926 | /* |
| 7927 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7928 | { |
| 7929 | unsigned int present; |
| 7930 | unsigned char bits; |
| 7931 | |
| 7932 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7933 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7934 | bits = present ? HDA_AMP_MUTE : 0; |
| 7935 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7936 | } |
| 7937 | */ |
| 7938 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7939 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7940 | /* HP */ |
| 7941 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7942 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7943 | /* Subwoofer */ |
| 7944 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7945 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7946 | |
| 7947 | /* enable unsolicited event */ |
| 7948 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7949 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7950 | |
| 7951 | { } /* end */ |
| 7952 | }; |
| 7953 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7954 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7955 | /* HP */ |
| 7956 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7957 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7958 | /* Int speaker */ |
| 7959 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7961 | |
| 7962 | /* enable unsolicited event */ |
| 7963 | {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] | 7964 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7965 | |
| 7966 | { } /* end */ |
| 7967 | }; |
| 7968 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7969 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7970 | /* HP */ |
| 7971 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7972 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7973 | /* Subwoofer */ |
| 7974 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7976 | |
| 7977 | /* enable unsolicited event */ |
| 7978 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7979 | |
| 7980 | { } /* end */ |
| 7981 | }; |
| 7982 | |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 7983 | static struct hda_verb alc883_targa_verbs[] = { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7984 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7985 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7986 | |
| 7987 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7988 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 7989 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 7990 | /* Connect Line-Out side jack (SPDIF) to Side */ |
| 7991 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7992 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7993 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7994 | /* Connect Mic jack to CLFE */ |
| 7995 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7996 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7997 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7998 | /* Connect Line-in jack to Surround */ |
| 7999 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8000 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8001 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8002 | /* Connect HP out jack to Front */ |
| 8003 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8004 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8005 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8006 | |
| 8007 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8008 | |
| 8009 | { } /* end */ |
| 8010 | }; |
| 8011 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8012 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 8013 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8014 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 8015 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 8016 | { } /* end */ |
| 8017 | }; |
| 8018 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8019 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 8020 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8021 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8022 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8023 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8024 | { } /* end */ |
| 8025 | }; |
| 8026 | |
| 8027 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 8028 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8029 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8030 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8031 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 8032 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8033 | { } /* end */ |
| 8034 | }; |
| 8035 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8036 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 8037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8039 | |
| 8040 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8041 | |
| 8042 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8043 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8044 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8045 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8046 | { } /* end */ |
| 8047 | }; |
| 8048 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8049 | static struct hda_verb alc888_lenovo_sky_verbs[] = { |
| 8050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8052 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8053 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8054 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8055 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8056 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8057 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8058 | { } /* end */ |
| 8059 | }; |
| 8060 | |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8061 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 8062 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8063 | { } |
| 8064 | }; |
| 8065 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8066 | static struct hda_verb alc883_vaiott_verbs[] = { |
| 8067 | /* HP */ |
| 8068 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8069 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8070 | |
| 8071 | /* enable unsolicited event */ |
| 8072 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8073 | |
| 8074 | { } /* end */ |
| 8075 | }; |
| 8076 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8077 | static void alc888_3st_hp_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8078 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8079 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8080 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8081 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8082 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8083 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8084 | spec->autocfg.speaker_pins[2] = 0x18; |
| 8085 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 8718b70 | 2009-03-04 14:22:51 -0300 | [diff] [blame] | 8086 | } |
| 8087 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8088 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8089 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 8090 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 8091 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8092 | {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] | 8093 | { } /* end */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8094 | }; |
| 8095 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8096 | /* |
| 8097 | * 2ch mode |
| 8098 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8099 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8100 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8101 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8102 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 8103 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8104 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8105 | }; |
| 8106 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8107 | /* |
| 8108 | * 4ch mode |
| 8109 | */ |
| 8110 | static struct hda_verb alc888_3st_hp_4ch_init[] = { |
| 8111 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 8112 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 8113 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8114 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8115 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8116 | { } /* end */ |
| 8117 | }; |
| 8118 | |
| 8119 | /* |
| 8120 | * 6ch mode |
| 8121 | */ |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8122 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8123 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8124 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8125 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8126 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8127 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8128 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 8129 | { } /* end */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8130 | }; |
| 8131 | |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8132 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8133 | { 2, alc888_3st_hp_2ch_init }, |
Herton Ronaldo Krzesinski | 3ea0d7c | 2009-03-04 14:22:50 -0300 | [diff] [blame] | 8134 | { 4, alc888_3st_hp_4ch_init }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8135 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8136 | }; |
| 8137 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8138 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 8139 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 8140 | { |
| 8141 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8142 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8143 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8144 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8145 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8146 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8147 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8148 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8149 | } |
| 8150 | |
| 8151 | /* toggle RCA according to the front-jack state */ |
| 8152 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 8153 | { |
| 8154 | unsigned int present; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8155 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8156 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8157 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8158 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8159 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8160 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8161 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8162 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 8163 | unsigned int res) |
| 8164 | { |
| 8165 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8166 | alc888_lenovo_ms7195_front_automute(codec); |
| 8167 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8168 | alc888_lenovo_ms7195_rca_automute(codec); |
| 8169 | } |
| 8170 | |
| 8171 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 8172 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8174 | |
| 8175 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8176 | |
| 8177 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8178 | { } /* end */ |
| 8179 | }; |
| 8180 | |
| 8181 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8182 | static void alc883_medion_md2_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8183 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8184 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8185 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8186 | spec->autocfg.hp_pins[0] = 0x14; |
| 8187 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8188 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8189 | } |
| 8190 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8191 | /* toggle speaker-output according to the hp-jack state */ |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8192 | #define alc883_targa_init_hook alc882_targa_init_hook |
| 8193 | #define alc883_targa_unsol_event alc882_targa_unsol_event |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8194 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8195 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 8196 | { |
| 8197 | unsigned int present; |
| 8198 | |
| 8199 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8200 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8201 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 8202 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8203 | } |
| 8204 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8205 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8206 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8207 | struct alc_spec *spec = codec->spec; |
| 8208 | |
| 8209 | spec->autocfg.hp_pins[0] = 0x15; |
| 8210 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8211 | alc_automute_amp(codec); |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8212 | alc883_clevo_m720_mic_automute(codec); |
| 8213 | } |
| 8214 | |
| 8215 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8216 | unsigned int res) |
| 8217 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8218 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8219 | case ALC880_MIC_EVENT: |
| 8220 | alc883_clevo_m720_mic_automute(codec); |
| 8221 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8222 | default: |
| 8223 | alc_automute_amp_unsol_event(codec, res); |
| 8224 | break; |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8225 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8226 | } |
| 8227 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8228 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8229 | static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8230 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8231 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8232 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8233 | spec->autocfg.hp_pins[0] = 0x14; |
| 8234 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8235 | alc_automute_amp(codec); |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8236 | } |
| 8237 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8238 | static void alc883_haier_w66_init_hook(struct hda_codec *codec) |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8239 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8240 | struct alc_spec *spec = codec->spec; |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8241 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8242 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8243 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8244 | alc_automute_amp(codec); |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8245 | } |
| 8246 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8247 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 8248 | { |
| 8249 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8250 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8251 | |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8252 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 8253 | & AC_PINSENSE_PRESENCE; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8254 | bits = present ? HDA_AMP_MUTE : 0; |
| 8255 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8256 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8257 | } |
| 8258 | |
| 8259 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 8260 | { |
| 8261 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8262 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8263 | |
| 8264 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8265 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8266 | bits = present ? HDA_AMP_MUTE : 0; |
| 8267 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8268 | HDA_AMP_MUTE, bits); |
| 8269 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8270 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8271 | } |
| 8272 | |
| 8273 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 8274 | unsigned int res) |
| 8275 | { |
| 8276 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8277 | alc883_lenovo_101e_all_automute(codec); |
| 8278 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 8279 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 8280 | } |
| 8281 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8282 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8283 | static void alc883_acer_aspire_init_hook(struct hda_codec *codec) |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8284 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8285 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8286 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8287 | spec->autocfg.hp_pins[0] = 0x14; |
| 8288 | spec->autocfg.speaker_pins[0] = 0x15; |
| 8289 | spec->autocfg.speaker_pins[1] = 0x16; |
| 8290 | alc_automute_amp(codec); |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8291 | } |
| 8292 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8293 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 8294 | /* HP Pin: output 0 (0x0c) */ |
| 8295 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8296 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8297 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8298 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8299 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8300 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8301 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8302 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8303 | /* eanable EAPD on medion laptop */ |
| 8304 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8305 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8306 | /* enable unsolicited event */ |
| 8307 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8308 | { } |
| 8309 | }; |
| 8310 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8311 | static void alc888_6st_dell_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8312 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8313 | struct alc_spec *spec = codec->spec; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 8314 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8315 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8316 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8317 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8318 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8319 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8320 | alc_automute_amp(codec); |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8321 | } |
| 8322 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8323 | static void alc888_lenovo_sky_init_hook(struct hda_codec *codec) |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8324 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8325 | struct alc_spec *spec = codec->spec; |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [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] = 0x15; |
| 8330 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8331 | spec->autocfg.speaker_pins[3] = 0x17; |
| 8332 | spec->autocfg.speaker_pins[4] = 0x1a; |
| 8333 | alc_automute_amp(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8334 | } |
| 8335 | |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8336 | static void alc883_vaiott_init_hook(struct hda_codec *codec) |
| 8337 | { |
| 8338 | struct alc_spec *spec = codec->spec; |
| 8339 | |
| 8340 | spec->autocfg.hp_pins[0] = 0x15; |
| 8341 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8342 | spec->autocfg.speaker_pins[1] = 0x17; |
| 8343 | alc_automute_amp(codec); |
| 8344 | } |
| 8345 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8346 | static struct hda_verb alc888_asus_m90v_verbs[] = { |
| 8347 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8348 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8349 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8350 | /* enable unsolicited event */ |
| 8351 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8352 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 8353 | { } /* end */ |
| 8354 | }; |
| 8355 | |
| 8356 | static void alc883_nb_mic_automute(struct hda_codec *codec) |
| 8357 | { |
| 8358 | unsigned int present; |
| 8359 | |
| 8360 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 8361 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 8362 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8363 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 8364 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 8365 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 8366 | } |
| 8367 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8368 | static void alc883_M90V_init_hook(struct hda_codec *codec) |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8369 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8370 | struct alc_spec *spec = codec->spec; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8371 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8372 | spec->autocfg.hp_pins[0] = 0x1b; |
| 8373 | spec->autocfg.speaker_pins[0] = 0x14; |
| 8374 | spec->autocfg.speaker_pins[1] = 0x15; |
| 8375 | spec->autocfg.speaker_pins[2] = 0x16; |
| 8376 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8377 | } |
| 8378 | |
| 8379 | static void alc883_mode2_unsol_event(struct hda_codec *codec, |
| 8380 | unsigned int res) |
| 8381 | { |
| 8382 | switch (res >> 26) { |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8383 | case ALC880_MIC_EVENT: |
| 8384 | alc883_nb_mic_automute(codec); |
| 8385 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8386 | default: |
| 8387 | alc_sku_unsol_event(codec, res); |
| 8388 | break; |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8389 | } |
| 8390 | } |
| 8391 | |
| 8392 | static void alc883_mode2_inithook(struct hda_codec *codec) |
| 8393 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8394 | alc883_M90V_init_hook(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8395 | alc883_nb_mic_automute(codec); |
| 8396 | } |
| 8397 | |
| 8398 | static struct hda_verb alc888_asus_eee1601_verbs[] = { |
| 8399 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8400 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8402 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8403 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8404 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, |
| 8405 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, |
| 8406 | /* enable unsolicited event */ |
| 8407 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8408 | { } /* end */ |
| 8409 | }; |
| 8410 | |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8411 | static void alc883_eee1601_inithook(struct hda_codec *codec) |
| 8412 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8413 | struct alc_spec *spec = codec->spec; |
| 8414 | |
| 8415 | spec->autocfg.hp_pins[0] = 0x14; |
| 8416 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 8417 | alc_automute_pin(codec); |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8418 | } |
| 8419 | |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8420 | static struct hda_verb alc889A_mb31_verbs[] = { |
| 8421 | /* Init rear pin (used as headphone output) */ |
| 8422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ |
| 8423 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ |
| 8424 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8425 | /* Init line pin (used as output in 4ch and 6ch mode) */ |
| 8426 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ |
| 8427 | /* Init line 2 pin (used as headphone out by default) */ |
| 8428 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ |
| 8429 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ |
| 8430 | { } /* end */ |
| 8431 | }; |
| 8432 | |
| 8433 | /* Mute speakers according to the headphone jack state */ |
| 8434 | static void alc889A_mb31_automute(struct hda_codec *codec) |
| 8435 | { |
| 8436 | unsigned int present; |
| 8437 | |
| 8438 | /* Mute only in 2ch or 4ch mode */ |
| 8439 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) |
| 8440 | == 0x00) { |
| 8441 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8442 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; |
| 8443 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8444 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8445 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8446 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 8447 | } |
| 8448 | } |
| 8449 | |
| 8450 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8451 | { |
| 8452 | if ((res >> 26) == ALC880_HP_EVENT) |
| 8453 | alc889A_mb31_automute(codec); |
| 8454 | } |
| 8455 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8456 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8457 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8458 | #define alc882_loopbacks alc880_loopbacks |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8459 | #endif |
| 8460 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 8461 | /* pcm configuration: identical with ALC880 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8462 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 8463 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 8464 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 8465 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 8466 | |
| 8467 | static hda_nid_t alc883_slave_dig_outs[] = { |
| 8468 | ALC1200_DIGOUT_NID, 0, |
| 8469 | }; |
| 8470 | |
| 8471 | static hda_nid_t alc1200_slave_dig_outs[] = { |
| 8472 | ALC883_DIGOUT_NID, 0, |
| 8473 | }; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8474 | |
| 8475 | /* |
| 8476 | * configuration and preset |
| 8477 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8478 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 8479 | [ALC882_3ST_DIG] = "3stack-dig", |
| 8480 | [ALC882_6ST_DIG] = "6stack-dig", |
| 8481 | [ALC882_ARIMA] = "arima", |
| 8482 | [ALC882_W2JC] = "w2jc", |
| 8483 | [ALC882_TARGA] = "targa", |
| 8484 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 8485 | [ALC882_ASUS_A7M] = "asus-a7m", |
| 8486 | [ALC885_MACPRO] = "macpro", |
| 8487 | [ALC885_MB5] = "mb5", |
| 8488 | [ALC885_MBP3] = "mbp3", |
| 8489 | [ALC885_IMAC24] = "imac24", |
| 8490 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8491 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 8492 | [ALC883_3ST_6ch] = "3stack-6ch", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8493 | [ALC883_6ST_DIG] = "alc883-6stack-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8494 | [ALC883_TARGA_DIG] = "targa-dig", |
| 8495 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8496 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8497 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8498 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8499 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", |
Takashi Iwai | b1a9146 | 2009-06-21 10:56:44 +0200 | [diff] [blame] | 8500 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8501 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8502 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8503 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8504 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8505 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8506 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 8507 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8508 | [ALC888_LENOVO_SKY] = "lenovo-sky", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8509 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8510 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8511 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8512 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8513 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8514 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8515 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8516 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8517 | [ALC889A_INTEL] = "intel-alc889a", |
| 8518 | [ALC889_INTEL] = "intel-x58", |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8519 | [ALC1200_ASUS_P5Q] = "asus-p5q", |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 8520 | [ALC889A_MB31] = "mb31", |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 8521 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8522 | [ALC882_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8523 | }; |
| 8524 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8525 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 8526 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
| 8527 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8528 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
Takashi Iwai | 69e5028 | 2008-11-03 10:07:43 +0100 | [diff] [blame] | 8529 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
Takashi Iwai | 9b6682f | 2009-03-23 22:50:52 +0100 | [diff] [blame] | 8530 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8531 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 8532 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
Jaroslav Kysela | 0b18cb1 | 2008-07-28 17:07:07 +0200 | [diff] [blame] | 8533 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8534 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 8535 | ALC888_ACER_ASPIRE_4930G), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8536 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 8537 | ALC888_ACER_ASPIRE_4930G), |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 8538 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 8539 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | e46b0c8 | 2009-06-13 10:16:43 +0200 | [diff] [blame] | 8540 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 8541 | ALC888_ACER_ASPIRE_8930G), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8542 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), |
| 8543 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), |
Lukasz Wojnilowicz | a8e4f9d | 2009-01-08 12:00:49 +0100 | [diff] [blame] | 8544 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
Takashi Iwai | dde6535 | 2009-06-25 08:25:35 +0200 | [diff] [blame] | 8545 | ALC888_ACER_ASPIRE_6530G), |
Juan Jesus Garcia de Soria | cc374c4 | 2009-02-23 08:11:59 +0100 | [diff] [blame] | 8546 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8547 | ALC888_ACER_ASPIRE_6530G), |
Takashi Iwai | 22b530e | 2009-05-13 11:32:52 +0200 | [diff] [blame] | 8548 | /* default Acer -- disabled as it causes more problems. |
| 8549 | * model=auto should work fine now |
| 8550 | */ |
| 8551 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8552 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8553 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8554 | |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 8555 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8556 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 8557 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 8558 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Chris Bagwell | 06bf3e1 | 2009-01-01 10:32:08 +0100 | [diff] [blame] | 8559 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 7ec30f0 | 2009-03-04 14:22:52 -0300 | [diff] [blame] | 8560 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8561 | |
| 8562 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
| 8563 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
| 8564 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Kailang Yang | a01c30c | 2008-10-15 11:14:58 +0200 | [diff] [blame] | 8565 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8566 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
| 8567 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
| 8568 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8569 | 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] | 8570 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 8571 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8572 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8573 | |
| 8574 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 8575 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8576 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8577 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8578 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 8579 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8580 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8581 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8582 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
| 8583 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8584 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 8585 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 8586 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8587 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 8588 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8589 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8590 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 8591 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8592 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 8593 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 8594 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 8595 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 8596 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 8597 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8598 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8599 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 8600 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 8601 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8602 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8603 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 8604 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 8605 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ee09543 | 2008-11-25 15:03:38 +0100 | [diff] [blame] | 8606 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 8607 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 8608 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 8609 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Sasha Alexandr | df01b8a | 2009-06-16 14:46:17 -0400 | [diff] [blame] | 8610 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8611 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
William Weston | b1e4422 | 2009-07-08 01:10:05 -0700 | [diff] [blame] | 8612 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8613 | |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8614 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8615 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 8616 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 8617 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 8618 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8619 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8620 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8621 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", |
Takashi Iwai | f67d817 | 2009-02-04 23:30:19 +0100 | [diff] [blame] | 8622 | ALC883_FUJITSU_PI2515), |
Takashi Iwai | bfb5303 | 2009-04-14 14:51:04 +0200 | [diff] [blame] | 8623 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8624 | ALC888_FUJITSU_XA3530), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8625 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8626 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8627 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 8628 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 8629 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8630 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Takashi Iwai | 959973b | 2008-11-05 11:30:56 +0100 | [diff] [blame] | 8631 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 8632 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8633 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8634 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8635 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 8636 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Luke Yelavich | 2de686d | 2009-01-16 15:08:02 +1100 | [diff] [blame] | 8637 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8638 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), |
| 8639 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), |
| 8640 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8641 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8642 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8643 | {} |
| 8644 | }; |
| 8645 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8646 | /* codec SSID table for Intel Mac */ |
| 8647 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { |
| 8648 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), |
| 8649 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), |
| 8650 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), |
| 8651 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), |
| 8652 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), |
| 8653 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), |
| 8654 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), |
| 8655 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), |
| 8656 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), |
| 8657 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), |
| 8658 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), |
| 8659 | /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently |
| 8660 | * no perfect solution yet |
| 8661 | */ |
| 8662 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), |
| 8663 | {} /* terminator */ |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8664 | }; |
| 8665 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8666 | static struct alc_config_preset alc882_presets[] = { |
| 8667 | [ALC882_3ST_DIG] = { |
| 8668 | .mixers = { alc882_base_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8669 | .init_verbs = { alc882_base_init_verbs, |
| 8670 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8671 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8672 | .dac_nids = alc882_dac_nids, |
| 8673 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8674 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8675 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8676 | .channel_mode = alc882_ch_modes, |
| 8677 | .need_dac_fix = 1, |
| 8678 | .input_mux = &alc882_capture_source, |
| 8679 | }, |
| 8680 | [ALC882_6ST_DIG] = { |
| 8681 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8682 | .init_verbs = { alc882_base_init_verbs, |
| 8683 | alc882_adc1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8684 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8685 | .dac_nids = alc882_dac_nids, |
| 8686 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8687 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8688 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8689 | .channel_mode = alc882_sixstack_modes, |
| 8690 | .input_mux = &alc882_capture_source, |
| 8691 | }, |
| 8692 | [ALC882_ARIMA] = { |
| 8693 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8694 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8695 | alc882_eapd_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8696 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8697 | .dac_nids = alc882_dac_nids, |
| 8698 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 8699 | .channel_mode = alc882_sixstack_modes, |
| 8700 | .input_mux = &alc882_capture_source, |
| 8701 | }, |
| 8702 | [ALC882_W2JC] = { |
| 8703 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8704 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8705 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8706 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8707 | .dac_nids = alc882_dac_nids, |
| 8708 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8709 | .channel_mode = alc880_threestack_modes, |
| 8710 | .need_dac_fix = 1, |
| 8711 | .input_mux = &alc882_capture_source, |
| 8712 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8713 | }, |
| 8714 | [ALC885_MBP3] = { |
| 8715 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 8716 | .init_verbs = { alc885_mbp3_init_verbs, |
| 8717 | alc880_gpio1_init_verbs }, |
| 8718 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8719 | .dac_nids = alc882_dac_nids, |
| 8720 | .channel_mode = alc885_mbp_6ch_modes, |
| 8721 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 8722 | .input_mux = &alc882_capture_source, |
| 8723 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8724 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8725 | .unsol_event = alc_automute_amp_unsol_event, |
| 8726 | .init_hook = alc885_mbp3_init_hook, |
| 8727 | }, |
| 8728 | [ALC885_MB5] = { |
| 8729 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, |
| 8730 | .init_verbs = { alc885_mb5_init_verbs, |
| 8731 | alc880_gpio1_init_verbs }, |
| 8732 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8733 | .dac_nids = alc882_dac_nids, |
| 8734 | .channel_mode = alc885_mb5_6ch_modes, |
| 8735 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), |
| 8736 | .input_mux = &mb5_capture_source, |
| 8737 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8738 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8739 | }, |
| 8740 | [ALC885_MACPRO] = { |
| 8741 | .mixers = { alc882_macpro_mixer }, |
| 8742 | .init_verbs = { alc882_macpro_init_verbs }, |
| 8743 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8744 | .dac_nids = alc882_dac_nids, |
| 8745 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8746 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8747 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8748 | .channel_mode = alc882_ch_modes, |
| 8749 | .input_mux = &alc882_capture_source, |
| 8750 | .init_hook = alc885_macpro_init_hook, |
| 8751 | }, |
| 8752 | [ALC885_IMAC24] = { |
| 8753 | .mixers = { alc885_imac24_mixer }, |
| 8754 | .init_verbs = { alc885_imac24_init_verbs }, |
| 8755 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8756 | .dac_nids = alc882_dac_nids, |
| 8757 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8758 | .dig_in_nid = ALC882_DIGIN_NID, |
| 8759 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 8760 | .channel_mode = alc882_ch_modes, |
| 8761 | .input_mux = &alc882_capture_source, |
| 8762 | .unsol_event = alc_automute_amp_unsol_event, |
| 8763 | .init_hook = alc885_imac24_init_hook, |
| 8764 | }, |
| 8765 | [ALC882_TARGA] = { |
| 8766 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8767 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
Takashi Iwai | 31909b8 | 2009-07-10 12:33:48 +0200 | [diff] [blame] | 8768 | alc880_gpio3_init_verbs, alc882_targa_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8769 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8770 | .dac_nids = alc882_dac_nids, |
| 8771 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8772 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8773 | .adc_nids = alc882_adc_nids, |
| 8774 | .capsrc_nids = alc882_capsrc_nids, |
| 8775 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8776 | .channel_mode = alc882_3ST_6ch_modes, |
| 8777 | .need_dac_fix = 1, |
| 8778 | .input_mux = &alc882_capture_source, |
| 8779 | .unsol_event = alc882_targa_unsol_event, |
| 8780 | .init_hook = alc882_targa_init_hook, |
| 8781 | }, |
| 8782 | [ALC882_ASUS_A7J] = { |
| 8783 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8784 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8785 | alc882_asus_a7j_verbs}, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8786 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8787 | .dac_nids = alc882_dac_nids, |
| 8788 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8789 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 8790 | .adc_nids = alc882_adc_nids, |
| 8791 | .capsrc_nids = alc882_capsrc_nids, |
| 8792 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 8793 | .channel_mode = alc882_3ST_6ch_modes, |
| 8794 | .need_dac_fix = 1, |
| 8795 | .input_mux = &alc882_capture_source, |
| 8796 | }, |
| 8797 | [ALC882_ASUS_A7M] = { |
| 8798 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
Takashi Iwai | 8ab9e0a | 2009-07-03 10:58:12 +0200 | [diff] [blame] | 8799 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, |
| 8800 | alc882_eapd_verbs, alc880_gpio1_init_verbs, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 8801 | alc882_asus_a7m_verbs }, |
| 8802 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 8803 | .dac_nids = alc882_dac_nids, |
| 8804 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 8805 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 8806 | .channel_mode = alc880_threestack_modes, |
| 8807 | .need_dac_fix = 1, |
| 8808 | .input_mux = &alc882_capture_source, |
| 8809 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8810 | [ALC883_3ST_2ch_DIG] = { |
| 8811 | .mixers = { alc883_3ST_2ch_mixer }, |
| 8812 | .init_verbs = { alc883_init_verbs }, |
| 8813 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8814 | .dac_nids = alc883_dac_nids, |
| 8815 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8816 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8817 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8818 | .channel_mode = alc883_3ST_2ch_modes, |
| 8819 | .input_mux = &alc883_capture_source, |
| 8820 | }, |
| 8821 | [ALC883_3ST_6ch_DIG] = { |
| 8822 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8823 | .init_verbs = { alc883_init_verbs }, |
| 8824 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8825 | .dac_nids = alc883_dac_nids, |
| 8826 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8827 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8828 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8829 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8830 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8831 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8832 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8833 | [ALC883_3ST_6ch] = { |
| 8834 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8835 | .init_verbs = { alc883_init_verbs }, |
| 8836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8837 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8838 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8839 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 8840 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8841 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8842 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8843 | [ALC883_3ST_6ch_INTEL] = { |
| 8844 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 8845 | .init_verbs = { alc883_init_verbs }, |
| 8846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8847 | .dac_nids = alc883_dac_nids, |
| 8848 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8849 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | f3cd3f5 | 2009-04-02 19:44:18 +0800 | [diff] [blame] | 8850 | .slave_dig_outs = alc883_slave_dig_outs, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 8851 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8852 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8853 | .need_dac_fix = 1, |
| 8854 | .input_mux = &alc883_3stack_6ch_intel, |
| 8855 | }, |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 8856 | [ALC889A_INTEL] = { |
| 8857 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 8858 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs }, |
| 8859 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8860 | .dac_nids = alc883_dac_nids, |
| 8861 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8862 | .adc_nids = alc889_adc_nids, |
| 8863 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8864 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8865 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8866 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8867 | .channel_mode = alc889_8ch_intel_modes, |
| 8868 | .capsrc_nids = alc889_capsrc_nids, |
| 8869 | .input_mux = &alc889_capture_source, |
| 8870 | .need_dac_fix = 1, |
| 8871 | }, |
| 8872 | [ALC889_INTEL] = { |
| 8873 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, |
| 8874 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, |
| 8875 | alc889_eapd_verbs }, |
| 8876 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8877 | .dac_nids = alc883_dac_nids, |
| 8878 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 8879 | .adc_nids = alc889_adc_nids, |
| 8880 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8881 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8882 | .slave_dig_outs = alc883_slave_dig_outs, |
| 8883 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), |
| 8884 | .channel_mode = alc889_8ch_intel_modes, |
| 8885 | .capsrc_nids = alc889_capsrc_nids, |
| 8886 | .input_mux = &alc889_capture_source, |
| 8887 | .init_hook = alc889_coef_init, |
| 8888 | .need_dac_fix = 1, |
| 8889 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8890 | [ALC883_6ST_DIG] = { |
| 8891 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8892 | .init_verbs = { alc883_init_verbs }, |
| 8893 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8894 | .dac_nids = alc883_dac_nids, |
| 8895 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8896 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8897 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8898 | .channel_mode = alc883_sixstack_modes, |
| 8899 | .input_mux = &alc883_capture_source, |
| 8900 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8901 | [ALC883_TARGA_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8902 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8903 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8904 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8905 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8906 | .dac_nids = alc883_dac_nids, |
| 8907 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8908 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8909 | .channel_mode = alc883_3ST_6ch_modes, |
| 8910 | .need_dac_fix = 1, |
| 8911 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8912 | .unsol_event = alc883_targa_unsol_event, |
| 8913 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8914 | }, |
| 8915 | [ALC883_TARGA_2ch_DIG] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8916 | .mixers = { alc883_targa_2ch_mixer}, |
David Heidelberger | 005b107 | 2009-07-09 18:45:46 +0200 | [diff] [blame] | 8917 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
| 8918 | alc883_targa_verbs}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8919 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8920 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 8921 | .adc_nids = alc883_adc_nids_alt, |
| 8922 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8923 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8924 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8925 | .channel_mode = alc883_3ST_2ch_modes, |
| 8926 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8927 | .unsol_event = alc883_targa_unsol_event, |
| 8928 | .init_hook = alc883_targa_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8929 | }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8930 | [ALC883_TARGA_8ch_DIG] = { |
| 8931 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8932 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8933 | alc883_targa_verbs }, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8934 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8935 | .dac_nids = alc883_dac_nids, |
| 8936 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8937 | .adc_nids = alc883_adc_nids_rev, |
| 8938 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8939 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8940 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8941 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), |
| 8942 | .channel_mode = alc883_4ST_8ch_modes, |
| 8943 | .need_dac_fix = 1, |
| 8944 | .input_mux = &alc883_capture_source, |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 8945 | .unsol_event = alc883_targa_unsol_event, |
| 8946 | .init_hook = alc883_targa_init_hook, |
David Heidelberger | 64a8be7 | 2009-06-08 16:15:18 +0200 | [diff] [blame] | 8947 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8948 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8949 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8950 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8951 | * and the headphone jack. Turn this on and rely on the |
| 8952 | * standard mute methods whenever the user wants to turn |
| 8953 | * these outputs off. |
| 8954 | */ |
| 8955 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8956 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8957 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8958 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8959 | .channel_mode = alc883_3ST_2ch_modes, |
| 8960 | .input_mux = &alc883_capture_source, |
| 8961 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8962 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8963 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8964 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8965 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8966 | .dac_nids = alc883_dac_nids, |
| 8967 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8968 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8969 | .channel_mode = alc883_3ST_2ch_modes, |
| 8970 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8971 | .unsol_event = alc_automute_amp_unsol_event, |
| 8972 | .init_hook = alc883_acer_aspire_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8973 | }, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8974 | [ALC888_ACER_ASPIRE_4930G] = { |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8975 | .mixers = { alc888_base_mixer, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8976 | alc883_chmode_mixer }, |
| 8977 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8978 | alc888_acer_aspire_4930g_verbs }, |
| 8979 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8980 | .dac_nids = alc883_dac_nids, |
| 8981 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 8982 | .adc_nids = alc883_adc_nids_rev, |
| 8983 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 8984 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8985 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8986 | .channel_mode = alc883_3ST_6ch_modes, |
| 8987 | .need_dac_fix = 1, |
| 8988 | .num_mux_defs = |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 8989 | ARRAY_SIZE(alc888_2_capture_sources), |
| 8990 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 8991 | .unsol_event = alc_automute_amp_unsol_event, |
| 8992 | .init_hook = alc888_acer_aspire_4930g_init_hook, |
Vincent Petry | 5b2d1ec | 2008-11-18 22:21:57 +0800 | [diff] [blame] | 8993 | }, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 8994 | [ALC888_ACER_ASPIRE_6530G] = { |
| 8995 | .mixers = { alc888_acer_aspire_6530_mixer }, |
| 8996 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
| 8997 | alc888_acer_aspire_6530g_verbs }, |
| 8998 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8999 | .dac_nids = alc883_dac_nids, |
| 9000 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9001 | .adc_nids = alc883_adc_nids_rev, |
| 9002 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9003 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9004 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9005 | .channel_mode = alc883_3ST_2ch_modes, |
| 9006 | .num_mux_defs = |
| 9007 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9008 | .input_mux = alc888_acer_aspire_6530_sources, |
| 9009 | .unsol_event = alc_automute_amp_unsol_event, |
Emilio López | 320d592 | 2009-06-25 08:18:44 +0200 | [diff] [blame] | 9010 | .init_hook = alc888_acer_aspire_6530g_init_hook, |
Tony Vroon | d2fd4b0 | 2009-06-21 00:40:10 +0100 | [diff] [blame] | 9011 | }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9012 | [ALC888_ACER_ASPIRE_8930G] = { |
| 9013 | .mixers = { alc888_base_mixer, |
| 9014 | alc883_chmode_mixer }, |
| 9015 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9016 | alc889_acer_aspire_8930g_verbs }, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9017 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9018 | .dac_nids = alc883_dac_nids, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9019 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
| 9020 | .adc_nids = alc889_adc_nids, |
| 9021 | .capsrc_nids = alc889_capsrc_nids, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9022 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9023 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9024 | .channel_mode = alc883_3ST_6ch_modes, |
| 9025 | .need_dac_fix = 1, |
| 9026 | .const_channel_count = 6, |
| 9027 | .num_mux_defs = |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9028 | ARRAY_SIZE(alc889_capture_sources), |
| 9029 | .input_mux = alc889_capture_sources, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9030 | .unsol_event = alc_automute_amp_unsol_event, |
Hector Martin | 018df41 | 2009-06-04 00:13:40 +0200 | [diff] [blame] | 9031 | .init_hook = alc889_acer_aspire_8930g_init_hook, |
Hector Martin | 3b315d7 | 2009-06-02 10:54:19 +0200 | [diff] [blame] | 9032 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9033 | [ALC883_MEDION] = { |
| 9034 | .mixers = { alc883_fivestack_mixer, |
| 9035 | alc883_chmode_mixer }, |
| 9036 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9037 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9038 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9039 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9040 | .adc_nids = alc883_adc_nids_alt, |
| 9041 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 9042 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9043 | .channel_mode = alc883_sixstack_modes, |
| 9044 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9045 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9046 | [ALC883_MEDION_MD2] = { |
| 9047 | .mixers = { alc883_medion_md2_mixer}, |
| 9048 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 9049 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9050 | .dac_nids = alc883_dac_nids, |
| 9051 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9052 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9053 | .channel_mode = alc883_3ST_2ch_modes, |
| 9054 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9055 | .unsol_event = alc_automute_amp_unsol_event, |
| 9056 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 9057 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9058 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 9059 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9060 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 9061 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9062 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 9063 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9064 | .channel_mode = alc883_3ST_2ch_modes, |
| 9065 | .input_mux = &alc883_capture_source, |
| 9066 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9067 | [ALC883_CLEVO_M720] = { |
| 9068 | .mixers = { alc883_clevo_m720_mixer }, |
| 9069 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9070 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9071 | .dac_nids = alc883_dac_nids, |
| 9072 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9073 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9074 | .channel_mode = alc883_3ST_2ch_modes, |
| 9075 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 9076 | .unsol_event = alc883_clevo_m720_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9077 | .init_hook = alc883_clevo_m720_init_hook, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 9078 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9079 | [ALC883_LENOVO_101E_2ch] = { |
| 9080 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 9081 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 9082 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9083 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9084 | .adc_nids = alc883_adc_nids_alt, |
| 9085 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 9086 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9087 | .channel_mode = alc883_3ST_2ch_modes, |
| 9088 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 9089 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 9090 | .init_hook = alc883_lenovo_101e_all_automute, |
| 9091 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9092 | [ALC883_LENOVO_NB0763] = { |
| 9093 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 9094 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 9095 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9096 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9097 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9098 | .channel_mode = alc883_3ST_2ch_modes, |
| 9099 | .need_dac_fix = 1, |
| 9100 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9101 | .unsol_event = alc_automute_amp_unsol_event, |
| 9102 | .init_hook = alc883_medion_md2_init_hook, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9103 | }, |
| 9104 | [ALC888_LENOVO_MS7195_DIG] = { |
| 9105 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9106 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 9107 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9108 | .dac_nids = alc883_dac_nids, |
| 9109 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9110 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9111 | .channel_mode = alc883_3ST_6ch_modes, |
| 9112 | .need_dac_fix = 1, |
| 9113 | .input_mux = &alc883_capture_source, |
| 9114 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 9115 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9116 | }, |
| 9117 | [ALC883_HAIER_W66] = { |
Sasha Alexandr | c259249 | 2009-06-16 14:52:54 -0400 | [diff] [blame] | 9118 | .mixers = { alc883_targa_2ch_mixer}, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9119 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 9120 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9121 | .dac_nids = alc883_dac_nids, |
| 9122 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 9123 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9124 | .channel_mode = alc883_3ST_2ch_modes, |
| 9125 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9126 | .unsol_event = alc_automute_amp_unsol_event, |
| 9127 | .init_hook = alc883_haier_w66_init_hook, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9128 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9129 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 9130 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9131 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9132 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9133 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 9134 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 9135 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9136 | .need_dac_fix = 1, |
| 9137 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9138 | .unsol_event = alc_automute_amp_unsol_event, |
| 9139 | .init_hook = alc888_3st_hp_init_hook, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 9140 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9141 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 9142 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9143 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 9144 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9145 | .dac_nids = alc883_dac_nids, |
| 9146 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9147 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9148 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9149 | .channel_mode = alc883_sixstack_modes, |
| 9150 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9151 | .unsol_event = alc_automute_amp_unsol_event, |
| 9152 | .init_hook = alc888_6st_dell_init_hook, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 9153 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9154 | [ALC883_MITAC] = { |
| 9155 | .mixers = { alc883_mitac_mixer }, |
| 9156 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 9157 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9158 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9159 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9160 | .channel_mode = alc883_3ST_2ch_modes, |
| 9161 | .input_mux = &alc883_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9162 | .unsol_event = alc_automute_amp_unsol_event, |
| 9163 | .init_hook = alc883_mitac_init_hook, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 9164 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9165 | [ALC883_FUJITSU_PI2515] = { |
| 9166 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 9167 | .init_verbs = { alc883_init_verbs, |
| 9168 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 9169 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9170 | .dac_nids = alc883_dac_nids, |
| 9171 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9172 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9173 | .channel_mode = alc883_3ST_2ch_modes, |
| 9174 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9175 | .unsol_event = alc_automute_amp_unsol_event, |
| 9176 | .init_hook = alc883_2ch_fujitsu_pi2515_init_hook, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 9177 | }, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9178 | [ALC888_FUJITSU_XA3530] = { |
| 9179 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, |
| 9180 | .init_verbs = { alc883_init_verbs, |
| 9181 | alc888_fujitsu_xa3530_verbs }, |
| 9182 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9183 | .dac_nids = alc883_dac_nids, |
| 9184 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), |
| 9185 | .adc_nids = alc883_adc_nids_rev, |
| 9186 | .capsrc_nids = alc883_capsrc_nids_rev, |
| 9187 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9188 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), |
| 9189 | .channel_mode = alc888_4ST_8ch_intel_modes, |
| 9190 | .num_mux_defs = |
| 9191 | ARRAY_SIZE(alc888_2_capture_sources), |
| 9192 | .input_mux = alc888_2_capture_sources, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9193 | .unsol_event = alc_automute_amp_unsol_event, |
| 9194 | .init_hook = alc888_fujitsu_xa3530_init_hook, |
Vincent Petry | ef8ef5f | 2008-11-23 11:31:41 +0800 | [diff] [blame] | 9195 | }, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9196 | [ALC888_LENOVO_SKY] = { |
| 9197 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, |
| 9198 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, |
| 9199 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9200 | .dac_nids = alc883_dac_nids, |
| 9201 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9202 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9203 | .channel_mode = alc883_sixstack_modes, |
| 9204 | .need_dac_fix = 1, |
| 9205 | .input_mux = &alc883_lenovo_sky_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9206 | .unsol_event = alc_automute_amp_unsol_event, |
| 9207 | .init_hook = alc888_lenovo_sky_init_hook, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9208 | }, |
| 9209 | [ALC888_ASUS_M90V] = { |
| 9210 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 9211 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, |
| 9212 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9213 | .dac_nids = alc883_dac_nids, |
| 9214 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9215 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9216 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 9217 | .channel_mode = alc883_3ST_6ch_modes, |
| 9218 | .need_dac_fix = 1, |
| 9219 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 9220 | .unsol_event = alc883_mode2_unsol_event, |
| 9221 | .init_hook = alc883_mode2_inithook, |
| 9222 | }, |
| 9223 | [ALC888_ASUS_EEE1601] = { |
| 9224 | .mixers = { alc883_asus_eee1601_mixer }, |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 9225 | .cap_mixer = alc883_asus_eee1601_cap_mixer, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9226 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, |
| 9227 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9228 | .dac_nids = alc883_dac_nids, |
| 9229 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9230 | .dig_in_nid = ALC883_DIGIN_NID, |
| 9231 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9232 | .channel_mode = alc883_3ST_2ch_modes, |
| 9233 | .need_dac_fix = 1, |
| 9234 | .input_mux = &alc883_asus_eee1601_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9235 | .unsol_event = alc_sku_unsol_event, |
Kailang Yang | e2757d5 | 2008-08-26 13:17:46 +0200 | [diff] [blame] | 9236 | .init_hook = alc883_eee1601_inithook, |
| 9237 | }, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9238 | [ALC1200_ASUS_P5Q] = { |
| 9239 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 9240 | .init_verbs = { alc883_init_verbs }, |
| 9241 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9242 | .dac_nids = alc883_dac_nids, |
| 9243 | .dig_out_nid = ALC1200_DIGOUT_NID, |
| 9244 | .dig_in_nid = ALC883_DIGIN_NID, |
Wu Fengguang | b25c9da | 2009-02-06 15:02:27 +0800 | [diff] [blame] | 9245 | .slave_dig_outs = alc1200_slave_dig_outs, |
Wu Fengguang | 3ab9093 | 2008-11-17 09:51:09 +0100 | [diff] [blame] | 9246 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 9247 | .channel_mode = alc883_sixstack_modes, |
| 9248 | .input_mux = &alc883_capture_source, |
| 9249 | }, |
Torben Schulz | eb4c41d | 2009-05-18 15:02:35 +0200 | [diff] [blame] | 9250 | [ALC889A_MB31] = { |
| 9251 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, |
| 9252 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, |
| 9253 | alc880_gpio1_init_verbs }, |
| 9254 | .adc_nids = alc883_adc_nids, |
| 9255 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 9256 | .dac_nids = alc883_dac_nids, |
| 9257 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9258 | .channel_mode = alc889A_mb31_6ch_modes, |
| 9259 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), |
| 9260 | .input_mux = &alc889A_mb31_capture_source, |
| 9261 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 9262 | .unsol_event = alc889A_mb31_unsol_event, |
| 9263 | .init_hook = alc889A_mb31_automute, |
| 9264 | }, |
Guido Günther | 3e1647c | 2009-06-05 00:47:26 +0200 | [diff] [blame] | 9265 | [ALC883_SONY_VAIO_TT] = { |
| 9266 | .mixers = { alc883_vaiott_mixer }, |
| 9267 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, |
| 9268 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 9269 | .dac_nids = alc883_dac_nids, |
| 9270 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 9271 | .channel_mode = alc883_3ST_2ch_modes, |
| 9272 | .input_mux = &alc883_capture_source, |
| 9273 | .unsol_event = alc_automute_amp_unsol_event, |
| 9274 | .init_hook = alc883_vaiott_init_hook, |
| 9275 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9276 | }; |
| 9277 | |
| 9278 | |
| 9279 | /* |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9280 | * Pin config fixes |
| 9281 | */ |
| 9282 | enum { |
| 9283 | PINFIX_ABIT_AW9D_MAX |
| 9284 | }; |
| 9285 | |
| 9286 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 9287 | { 0x15, 0x01080104 }, /* side */ |
| 9288 | { 0x16, 0x01011012 }, /* rear */ |
| 9289 | { 0x17, 0x01016011 }, /* clfe */ |
| 9290 | { } |
| 9291 | }; |
| 9292 | |
| 9293 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 9294 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 9295 | }; |
| 9296 | |
| 9297 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 9298 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9299 | {} |
| 9300 | }; |
| 9301 | |
| 9302 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9303 | * BIOS auto configuration |
| 9304 | */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9305 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9306 | hda_nid_t nid, int pin_type, |
| 9307 | int dac_idx) |
| 9308 | { |
| 9309 | /* set as output */ |
| 9310 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9311 | int idx; |
| 9312 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9313 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9314 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 9315 | idx = 4; |
| 9316 | else |
| 9317 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9318 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 9319 | |
| 9320 | } |
| 9321 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9322 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9323 | { |
| 9324 | struct alc_spec *spec = codec->spec; |
| 9325 | int i; |
| 9326 | |
| 9327 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9328 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 9329 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9330 | if (nid) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9331 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9332 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9333 | } |
| 9334 | } |
| 9335 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9336 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9337 | { |
| 9338 | struct alc_spec *spec = codec->spec; |
| 9339 | hda_nid_t pin; |
| 9340 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9341 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9342 | if (pin) /* connect to front */ |
| 9343 | /* use dac 0 */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9344 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9345 | pin = spec->autocfg.speaker_pins[0]; |
| 9346 | if (pin) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9347 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9348 | } |
| 9349 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9350 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9351 | { |
| 9352 | struct alc_spec *spec = codec->spec; |
| 9353 | int i; |
| 9354 | |
| 9355 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9356 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9357 | if (!nid) |
| 9358 | continue; |
Takashi Iwai | 0d971c9 | 2009-06-30 16:11:11 +0200 | [diff] [blame] | 9359 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9360 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 9361 | snd_hda_codec_write(codec, nid, 0, |
| 9362 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9363 | AMP_OUT_MUTE); |
| 9364 | } |
| 9365 | } |
| 9366 | |
| 9367 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
| 9368 | { |
| 9369 | struct alc_spec *spec = codec->spec; |
| 9370 | int c; |
| 9371 | |
| 9372 | for (c = 0; c < spec->num_adc_nids; c++) { |
| 9373 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
| 9374 | hda_nid_t nid = spec->capsrc_nids[c]; |
| 9375 | unsigned int mux_idx; |
| 9376 | const struct hda_input_mux *imux; |
| 9377 | int conns, mute, idx, item; |
| 9378 | |
| 9379 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 9380 | ARRAY_SIZE(conn_list)); |
| 9381 | if (conns < 0) |
| 9382 | continue; |
| 9383 | mux_idx = c >= spec->num_mux_defs ? 0 : c; |
| 9384 | imux = &spec->input_mux[mux_idx]; |
| 9385 | for (idx = 0; idx < conns; idx++) { |
| 9386 | /* if the current connection is the selected one, |
| 9387 | * unmute it as default - otherwise mute it |
| 9388 | */ |
| 9389 | mute = AMP_IN_MUTE(idx); |
| 9390 | for (item = 0; item < imux->num_items; item++) { |
| 9391 | if (imux->items[item].index == idx) { |
| 9392 | if (spec->cur_mux[c] == item) |
| 9393 | mute = AMP_IN_UNMUTE(idx); |
| 9394 | break; |
| 9395 | } |
| 9396 | } |
| 9397 | /* check if we have a selector or mixer |
| 9398 | * we could check for the widget type instead, but |
| 9399 | * just check for Amp-In presence (in case of mixer |
| 9400 | * without amp-in there is something wrong, this |
| 9401 | * function shouldn't be used or capsrc nid is wrong) |
| 9402 | */ |
| 9403 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9404 | snd_hda_codec_write(codec, nid, 0, |
| 9405 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9406 | mute); |
| 9407 | else if (mute != AMP_IN_MUTE(idx)) |
| 9408 | snd_hda_codec_write(codec, nid, 0, |
| 9409 | AC_VERB_SET_CONNECT_SEL, |
| 9410 | idx); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9411 | } |
| 9412 | } |
| 9413 | } |
| 9414 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9415 | /* add mic boosts if needed */ |
| 9416 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9417 | { |
| 9418 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9419 | int err; |
| 9420 | hda_nid_t nid; |
| 9421 | |
| 9422 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
| 9423 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9424 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9425 | "Mic Boost", |
| 9426 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9427 | if (err < 0) |
| 9428 | return err; |
| 9429 | } |
| 9430 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
| 9431 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
| 9432 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9433 | "Front Mic Boost", |
| 9434 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9435 | if (err < 0) |
| 9436 | return err; |
| 9437 | } |
| 9438 | return 0; |
| 9439 | } |
| 9440 | |
| 9441 | /* almost identical with ALC880 parser... */ |
| 9442 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 9443 | { |
| 9444 | struct alc_spec *spec = codec->spec; |
| 9445 | struct auto_pin_cfg *autocfg = &spec->autocfg; |
| 9446 | unsigned int wcap; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9447 | int i; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9448 | int err = alc880_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9449 | |
| 9450 | if (err < 0) |
| 9451 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9452 | else if (!err) |
| 9453 | return 0; /* no config found */ |
| 9454 | |
| 9455 | err = alc_auto_add_mic_boost(codec); |
| 9456 | if (err < 0) |
| 9457 | return err; |
| 9458 | |
| 9459 | /* hack - override the init verbs */ |
| 9460 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9461 | /* if ADC 0x07 is available, initialize it, too */ |
| 9462 | wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 9463 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9464 | if (wcap == AC_WID_AUD_IN) |
| 9465 | add_verb(spec, alc882_adc1_init_verbs); |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9466 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9467 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 9468 | * because it's under 0x18 |
| 9469 | */ |
| 9470 | if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 9471 | autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 9472 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 9473 | for (i = 1; i < 3; i++) |
| 9474 | memcpy(&spec->private_imux[i], |
| 9475 | &spec->private_imux[0], |
| 9476 | sizeof(spec->private_imux[0])); |
| 9477 | imux->items[imux->num_items].label = "Int DMic"; |
| 9478 | imux->items[imux->num_items].index = 0x0b; |
| 9479 | imux->num_items++; |
| 9480 | spec->num_mux_defs = 3; |
| 9481 | spec->input_mux = spec->private_imux; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9482 | } |
| 9483 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9484 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9485 | } |
| 9486 | |
| 9487 | /* additional initialization for auto-configuration model */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9488 | static void alc882_auto_init(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9489 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9490 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9491 | alc882_auto_init_multi_out(codec); |
| 9492 | alc882_auto_init_hp_out(codec); |
| 9493 | alc882_auto_init_analog_input(codec); |
| 9494 | alc882_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9495 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 9496 | alc_inithook(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9497 | } |
| 9498 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9499 | static int patch_alc882(struct hda_codec *codec) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9500 | { |
| 9501 | struct alc_spec *spec; |
| 9502 | int err, board_config; |
| 9503 | |
| 9504 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 9505 | if (spec == NULL) |
| 9506 | return -ENOMEM; |
| 9507 | |
| 9508 | codec->spec = spec; |
| 9509 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9510 | switch (codec->vendor_id) { |
| 9511 | case 0x10ec0882: |
| 9512 | case 0x10ec0885: |
| 9513 | break; |
| 9514 | default: |
| 9515 | /* ALC883 and variants */ |
| 9516 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9517 | break; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9518 | } |
| 9519 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9520 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 9521 | alc882_models, |
| 9522 | alc882_cfg_tbl); |
| 9523 | |
| 9524 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) |
| 9525 | board_config = snd_hda_check_board_codec_sid_config(codec, |
| 9526 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); |
| 9527 | |
| 9528 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
| 9529 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 9530 | "trying auto-probe from BIOS...\n", |
| 9531 | codec->chip_name); |
| 9532 | board_config = ALC882_AUTO; |
| 9533 | } |
| 9534 | |
| 9535 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 9536 | |
| 9537 | if (board_config == ALC882_AUTO) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9538 | /* automatic parse from the BIOS config */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9539 | err = alc882_parse_auto_config(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9540 | if (err < 0) { |
| 9541 | alc_free(codec); |
| 9542 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9543 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9544 | printk(KERN_INFO |
| 9545 | "hda_codec: Cannot set up configuration " |
| 9546 | "from BIOS. Using base mode...\n"); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9547 | board_config = ALC882_3ST_DIG; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9548 | } |
| 9549 | } |
| 9550 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 9551 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 9552 | if (err < 0) { |
| 9553 | alc_free(codec); |
| 9554 | return err; |
| 9555 | } |
| 9556 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9557 | if (board_config != ALC882_AUTO) |
| 9558 | setup_preset(spec, &alc882_presets[board_config]); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9559 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9560 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 9561 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
| 9562 | /* FIXME: setup DAC5 */ |
| 9563 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 9564 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
| 9565 | |
| 9566 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 9567 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
| 9568 | |
| 9569 | if (codec->vendor_id == 0x10ec0888) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 9570 | spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */ |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9571 | |
| 9572 | if (!spec->adc_nids && spec->input_mux) { |
| 9573 | int i; |
| 9574 | spec->num_adc_nids = 0; |
| 9575 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { |
| 9576 | hda_nid_t cap; |
| 9577 | hda_nid_t nid = alc882_adc_nids[i]; |
| 9578 | unsigned int wcap = get_wcaps(codec, nid); |
| 9579 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 9580 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9581 | if (wcap != AC_WID_AUD_IN) |
| 9582 | continue; |
| 9583 | spec->private_adc_nids[spec->num_adc_nids] = nid; |
| 9584 | err = snd_hda_get_connections(codec, nid, &cap, 1); |
| 9585 | if (err < 0) |
| 9586 | continue; |
| 9587 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; |
| 9588 | spec->num_adc_nids++; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 9589 | } |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9590 | spec->adc_nids = spec->private_adc_nids; |
| 9591 | spec->capsrc_nids = spec->private_capsrc_nids; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 9592 | } |
| 9593 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9594 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 9595 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9596 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9597 | spec->vmaster_nid = 0x0c; |
| 9598 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9599 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9600 | if (board_config == ALC882_AUTO) |
| 9601 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9603 | if (!spec->loopback.amplist) |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9604 | spec->loopback.amplist = alc882_loopbacks; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9605 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 9606 | codec->proc_widget_hook = print_realtek_coef; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9607 | |
| 9608 | return 0; |
| 9609 | } |
| 9610 | |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 9611 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9612 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9613 | * ALC262 support |
| 9614 | */ |
| 9615 | |
| 9616 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 9617 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 9618 | |
| 9619 | #define alc262_dac_nids alc260_dac_nids |
| 9620 | #define alc262_adc_nids alc882_adc_nids |
| 9621 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9622 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 9623 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9624 | |
| 9625 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 9626 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9627 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 9628 | static hda_nid_t alc262_dmic_adc_nids[1] = { |
| 9629 | /* ADC0 */ |
| 9630 | 0x09 |
| 9631 | }; |
| 9632 | |
| 9633 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; |
| 9634 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9635 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 9636 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9637 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9638 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9639 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9640 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9641 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9642 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9643 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9644 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9647 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9648 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 9649 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9650 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 9651 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9652 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9653 | }; |
| 9654 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9655 | /* update HP, line and mono-out pins according to the master switch */ |
| 9656 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 9657 | { |
| 9658 | struct alc_spec *spec = codec->spec; |
| 9659 | int val = spec->master_sw; |
| 9660 | |
| 9661 | /* HP & line-out */ |
| 9662 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 9663 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9664 | val ? PIN_HP : 0); |
| 9665 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9666 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9667 | val ? PIN_HP : 0); |
| 9668 | /* mono (speaker) depending on the HP jack sense */ |
| 9669 | val = val && !spec->jack_present; |
| 9670 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 9671 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9672 | val ? PIN_OUT : 0); |
| 9673 | } |
| 9674 | |
| 9675 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 9676 | { |
| 9677 | struct alc_spec *spec = codec->spec; |
| 9678 | unsigned int presence; |
| 9679 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 9680 | AC_VERB_GET_PIN_SENSE, 0); |
| 9681 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9682 | alc262_hp_master_update(codec); |
| 9683 | } |
| 9684 | |
| 9685 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9686 | { |
| 9687 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9688 | return; |
| 9689 | alc262_hp_bpc_automute(codec); |
| 9690 | } |
| 9691 | |
| 9692 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 9693 | { |
| 9694 | struct alc_spec *spec = codec->spec; |
| 9695 | unsigned int presence; |
| 9696 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 9697 | AC_VERB_GET_PIN_SENSE, 0); |
| 9698 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 9699 | alc262_hp_master_update(codec); |
| 9700 | } |
| 9701 | |
| 9702 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 9703 | unsigned int res) |
| 9704 | { |
| 9705 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9706 | return; |
| 9707 | alc262_hp_wildwest_automute(codec); |
| 9708 | } |
| 9709 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9710 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9711 | |
| 9712 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9713 | struct snd_ctl_elem_value *ucontrol) |
| 9714 | { |
| 9715 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9716 | struct alc_spec *spec = codec->spec; |
| 9717 | int val = !!*ucontrol->value.integer.value; |
| 9718 | |
| 9719 | if (val == spec->master_sw) |
| 9720 | return 0; |
| 9721 | spec->master_sw = val; |
| 9722 | alc262_hp_master_update(codec); |
| 9723 | return 1; |
| 9724 | } |
| 9725 | |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9726 | #define ALC262_HP_MASTER_SWITCH \ |
| 9727 | { \ |
| 9728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9729 | .name = "Master Playback Switch", \ |
| 9730 | .info = snd_ctl_boolean_mono_info, \ |
| 9731 | .get = alc262_hp_master_sw_get, \ |
| 9732 | .put = alc262_hp_master_sw_put, \ |
| 9733 | } |
| 9734 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9735 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9736 | ALC262_HP_MASTER_SWITCH, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9738 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9739 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9740 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9741 | HDA_OUTPUT), |
| 9742 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9743 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9744 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9745 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9746 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9747 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9748 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9749 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9750 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9751 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9752 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9753 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9754 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9755 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9756 | { } /* end */ |
| 9757 | }; |
| 9758 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9759 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | b72519b | 2009-05-08 14:31:55 +0200 | [diff] [blame] | 9760 | ALC262_HP_MASTER_SWITCH, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9761 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9762 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 9763 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9764 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9765 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 9766 | HDA_OUTPUT), |
| 9767 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 9768 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9769 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9770 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9771 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9772 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9773 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9774 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9775 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9776 | { } /* end */ |
| 9777 | }; |
| 9778 | |
| 9779 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 9780 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9781 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 9782 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9783 | { } /* end */ |
| 9784 | }; |
| 9785 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9786 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9787 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9788 | { |
| 9789 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9790 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 9791 | spec->autocfg.hp_pins[0] = 0x15; |
| 9792 | spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */ |
| 9793 | alc_automute_amp(codec); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9794 | } |
| 9795 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9796 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9797 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9798 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9799 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9800 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9802 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9803 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9804 | { } /* end */ |
| 9805 | }; |
| 9806 | |
| 9807 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 9808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9810 | |
| 9811 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9812 | { } |
| 9813 | }; |
| 9814 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9815 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 9816 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 9818 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 9819 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9820 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9821 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9822 | { } /* end */ |
| 9823 | }; |
| 9824 | |
| 9825 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 9826 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9827 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9828 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9830 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 9831 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9832 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9833 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9834 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9835 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 9836 | {} |
| 9837 | }; |
| 9838 | |
| 9839 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 9840 | .num_items = 1, |
| 9841 | .items = { |
| 9842 | { "Line", 0x1 }, |
| 9843 | }, |
| 9844 | }; |
| 9845 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9846 | /* bind hp and internal speaker mute (with plug check) as master switch */ |
| 9847 | static void alc262_hippo_master_update(struct hda_codec *codec) |
| 9848 | { |
| 9849 | struct alc_spec *spec = codec->spec; |
| 9850 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9851 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9852 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9853 | unsigned int mute; |
| 9854 | |
| 9855 | /* HP */ |
| 9856 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; |
| 9857 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, |
| 9858 | HDA_AMP_MUTE, mute); |
| 9859 | /* mute internal speaker per jack sense */ |
| 9860 | if (spec->jack_present) |
| 9861 | mute = HDA_AMP_MUTE; |
| 9862 | if (line_nid) |
| 9863 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, |
| 9864 | HDA_AMP_MUTE, mute); |
| 9865 | if (speaker_nid && speaker_nid != line_nid) |
| 9866 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, |
| 9867 | HDA_AMP_MUTE, mute); |
| 9868 | } |
| 9869 | |
| 9870 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get |
| 9871 | |
| 9872 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9873 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9874 | { |
| 9875 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9876 | struct alc_spec *spec = codec->spec; |
| 9877 | int val = !!*ucontrol->value.integer.value; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9878 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9879 | if (val == spec->master_sw) |
| 9880 | return 0; |
| 9881 | spec->master_sw = val; |
| 9882 | alc262_hippo_master_update(codec); |
| 9883 | return 1; |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9884 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9885 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9886 | #define ALC262_HIPPO_MASTER_SWITCH \ |
| 9887 | { \ |
| 9888 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 9889 | .name = "Master Playback Switch", \ |
| 9890 | .info = snd_ctl_boolean_mono_info, \ |
| 9891 | .get = alc262_hippo_master_sw_get, \ |
| 9892 | .put = alc262_hippo_master_sw_put, \ |
| 9893 | } |
| 9894 | |
| 9895 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { |
| 9896 | ALC262_HIPPO_MASTER_SWITCH, |
| 9897 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9898 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9899 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9900 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9901 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9902 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9903 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9904 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9905 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9906 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9907 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9908 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 9909 | { } /* end */ |
| 9910 | }; |
| 9911 | |
| 9912 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 9913 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9914 | ALC262_HIPPO_MASTER_SWITCH, |
| 9915 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9916 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9917 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9918 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9919 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9920 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9922 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9923 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9924 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9925 | { } /* end */ |
| 9926 | }; |
| 9927 | |
| 9928 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9929 | static void alc262_hippo_automute(struct hda_codec *codec) |
| 9930 | { |
| 9931 | struct alc_spec *spec = codec->spec; |
| 9932 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9933 | unsigned int present; |
| 9934 | |
| 9935 | /* need to execute and sync at first */ |
| 9936 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9937 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 9938 | AC_VERB_GET_PIN_SENSE, 0); |
| 9939 | spec->jack_present = (present & 0x80000000) != 0; |
| 9940 | alc262_hippo_master_update(codec); |
| 9941 | } |
| 9942 | |
| 9943 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) |
| 9944 | { |
| 9945 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9946 | return; |
| 9947 | alc262_hippo_automute(codec); |
| 9948 | } |
| 9949 | |
| 9950 | static void alc262_hippo_init_hook(struct hda_codec *codec) |
| 9951 | { |
| 9952 | struct alc_spec *spec = codec->spec; |
| 9953 | |
| 9954 | spec->autocfg.hp_pins[0] = 0x15; |
| 9955 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9956 | alc262_hippo_automute(codec); |
| 9957 | } |
| 9958 | |
| 9959 | static void alc262_hippo1_init_hook(struct hda_codec *codec) |
| 9960 | { |
| 9961 | struct alc_spec *spec = codec->spec; |
| 9962 | |
| 9963 | spec->autocfg.hp_pins[0] = 0x1b; |
| 9964 | spec->autocfg.speaker_pins[0] = 0x14; |
| 9965 | alc262_hippo_automute(codec); |
| 9966 | } |
| 9967 | |
| 9968 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9969 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 9970 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9971 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9972 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9973 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9974 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9975 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9976 | { } /* end */ |
| 9977 | }; |
| 9978 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9979 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 9980 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9981 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9982 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9983 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9984 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9985 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9986 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9987 | { } /* end */ |
| 9988 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9989 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 9990 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { |
| 9991 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9992 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 9993 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 9994 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 9995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 9996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 9997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9999 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10000 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10001 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10002 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10003 | { } /* end */ |
| 10004 | }; |
| 10005 | |
| 10006 | static struct hda_verb alc262_tyan_verbs[] = { |
| 10007 | /* Headphone automute */ |
| 10008 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10009 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10010 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10011 | |
| 10012 | /* P11 AUX_IN, white 4-pin connector */ |
| 10013 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10014 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, |
| 10015 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, |
| 10016 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, |
| 10017 | |
| 10018 | {} |
| 10019 | }; |
| 10020 | |
| 10021 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10022 | static void alc262_tyan_init_hook(struct hda_codec *codec) |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10023 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10024 | struct alc_spec *spec = codec->spec; |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10025 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10026 | spec->autocfg.hp_pins[0] = 0x1b; |
| 10027 | spec->autocfg.speaker_pins[0] = 0x15; |
| 10028 | alc_automute_amp(codec); |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10029 | } |
| 10030 | |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 10031 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10032 | #define alc262_capture_mixer alc882_capture_mixer |
| 10033 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 10034 | |
| 10035 | /* |
| 10036 | * generic initialization of ADC, input mixers and output mixers |
| 10037 | */ |
| 10038 | static struct hda_verb alc262_init_verbs[] = { |
| 10039 | /* |
| 10040 | * Unmute ADC0-2 and set the default input to mic-in |
| 10041 | */ |
| 10042 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10043 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10044 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10045 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10046 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10047 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10048 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10049 | /* 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] | 10050 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10051 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10052 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10053 | */ |
| 10054 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10055 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10056 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10057 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10058 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10060 | |
| 10061 | /* |
| 10062 | * Set up output mixers (0x0c - 0x0e) |
| 10063 | */ |
| 10064 | /* set vol=0 to output mixers */ |
| 10065 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10066 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10067 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10068 | /* set up input amps for analog loopback */ |
| 10069 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10070 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10071 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10072 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10073 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10074 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10075 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10076 | |
| 10077 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10078 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10079 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10080 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10081 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10082 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10083 | |
| 10084 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10085 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10086 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10087 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10088 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10089 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10090 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10091 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10092 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10093 | /* FIXME: use matrix-type input source selection */ |
| 10094 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10095 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10096 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10097 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10098 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10099 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10100 | /* Input mixer2 */ |
| 10101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10102 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10103 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10105 | /* Input mixer3 */ |
| 10106 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10107 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10108 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10110 | |
| 10111 | { } |
| 10112 | }; |
| 10113 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10114 | static struct hda_verb alc262_eapd_verbs[] = { |
| 10115 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10116 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10117 | { } |
| 10118 | }; |
| 10119 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 10120 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 10121 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10122 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10123 | {} |
| 10124 | }; |
| 10125 | |
| 10126 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 10127 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10128 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10129 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 10130 | |
| 10131 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10132 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10133 | {} |
| 10134 | }; |
| 10135 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10136 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 10137 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10138 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10139 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 10140 | |
| 10141 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10142 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 10143 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 10144 | }; |
| 10145 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10146 | static struct hda_input_mux alc262_dmic_capture_source = { |
| 10147 | .num_items = 2, |
| 10148 | .items = { |
| 10149 | { "Int DMic", 0x9 }, |
| 10150 | { "Mic", 0x0 }, |
| 10151 | }, |
| 10152 | }; |
| 10153 | |
| 10154 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { |
| 10155 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10156 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10157 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10158 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10159 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10160 | { } /* end */ |
| 10161 | }; |
| 10162 | |
| 10163 | static struct hda_verb alc262_toshiba_s06_verbs[] = { |
| 10164 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10165 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10166 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10168 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, |
| 10169 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10170 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 10171 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10172 | {} |
| 10173 | }; |
| 10174 | |
| 10175 | static void alc262_dmic_automute(struct hda_codec *codec) |
| 10176 | { |
| 10177 | unsigned int present; |
| 10178 | |
| 10179 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10180 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10181 | snd_hda_codec_write(codec, 0x22, 0, |
| 10182 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); |
| 10183 | } |
| 10184 | |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10185 | |
| 10186 | /* unsolicited event for HP jack sensing */ |
| 10187 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, |
| 10188 | unsigned int res) |
| 10189 | { |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10190 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 10191 | alc262_dmic_automute(codec); |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10192 | else |
| 10193 | alc_sku_unsol_event(codec, res); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10194 | } |
| 10195 | |
| 10196 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) |
| 10197 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 10198 | struct alc_spec *spec = codec->spec; |
| 10199 | |
| 10200 | spec->autocfg.hp_pins[0] = 0x15; |
| 10201 | spec->autocfg.speaker_pins[0] = 0x14; |
| 10202 | alc_automute_pin(codec); |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 10203 | alc262_dmic_automute(codec); |
| 10204 | } |
| 10205 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10206 | /* |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 10207 | * nec model |
| 10208 | * 0x15 = headphone |
| 10209 | * 0x16 = internal speaker |
| 10210 | * 0x18 = external mic |
| 10211 | */ |
| 10212 | |
| 10213 | static struct snd_kcontrol_new alc262_nec_mixer[] = { |
| 10214 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 10215 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), |
| 10216 | |
| 10217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10219 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10220 | |
| 10221 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 10222 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10223 | { } /* end */ |
| 10224 | }; |
| 10225 | |
| 10226 | static struct hda_verb alc262_nec_verbs[] = { |
| 10227 | /* Unmute Speaker */ |
| 10228 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10229 | |
| 10230 | /* Headphone */ |
| 10231 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10233 | |
| 10234 | /* External mic to headphone */ |
| 10235 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10236 | /* External mic to speaker */ |
| 10237 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10238 | {} |
| 10239 | }; |
| 10240 | |
| 10241 | /* |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10242 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10243 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 10244 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10245 | */ |
| 10246 | |
| 10247 | #define ALC_HP_EVENT 0x37 |
| 10248 | |
| 10249 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 10250 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10251 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 10252 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10253 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10254 | {} |
| 10255 | }; |
| 10256 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10257 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 10258 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 10259 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10260 | {} |
| 10261 | }; |
| 10262 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10263 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10264 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10265 | .items = { |
| 10266 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10267 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10268 | { "CD", 0x4 }, |
| 10269 | }, |
| 10270 | }; |
| 10271 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10272 | static struct hda_input_mux alc262_HP_capture_source = { |
| 10273 | .num_items = 5, |
| 10274 | .items = { |
| 10275 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10276 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10277 | { "Line", 0x2 }, |
| 10278 | { "CD", 0x4 }, |
| 10279 | { "AUX IN", 0x6 }, |
| 10280 | }, |
| 10281 | }; |
| 10282 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 10283 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 10284 | .num_items = 4, |
| 10285 | .items = { |
| 10286 | { "Mic", 0x0 }, |
| 10287 | { "Front Mic", 0x2 }, |
| 10288 | { "Line", 0x1 }, |
| 10289 | { "CD", 0x4 }, |
| 10290 | }, |
| 10291 | }; |
| 10292 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10293 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10294 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 10295 | { |
| 10296 | struct alc_spec *spec = codec->spec; |
| 10297 | unsigned int mute; |
| 10298 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10299 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10300 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10301 | /* need to execute and sync at first */ |
| 10302 | 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] | 10303 | /* check laptop HP jack */ |
| 10304 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10305 | AC_VERB_GET_PIN_SENSE, 0); |
| 10306 | /* need to execute and sync at first */ |
| 10307 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10308 | /* check docking HP jack */ |
| 10309 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 10310 | AC_VERB_GET_PIN_SENSE, 0); |
| 10311 | if (present & AC_PINSENSE_PRESENCE) |
| 10312 | spec->jack_present = 1; |
| 10313 | else |
| 10314 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10315 | spec->sense_updated = 1; |
| 10316 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10317 | /* unmute internal speaker only if both HPs are unplugged and |
| 10318 | * master switch is on |
| 10319 | */ |
| 10320 | if (spec->jack_present) |
| 10321 | mute = HDA_AMP_MUTE; |
| 10322 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10323 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10324 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10325 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10326 | } |
| 10327 | |
| 10328 | /* unsolicited event for HP jack sensing */ |
| 10329 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 10330 | unsigned int res) |
| 10331 | { |
| 10332 | if ((res >> 26) != ALC_HP_EVENT) |
| 10333 | return; |
| 10334 | alc262_fujitsu_automute(codec, 1); |
| 10335 | } |
| 10336 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 10337 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 10338 | { |
| 10339 | alc262_fujitsu_automute(codec, 1); |
| 10340 | } |
| 10341 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10342 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10343 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 10344 | .ops = &snd_hda_bind_vol, |
| 10345 | .values = { |
| 10346 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 10347 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 10348 | 0 |
| 10349 | }, |
| 10350 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10351 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10352 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10353 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 10354 | { |
| 10355 | struct alc_spec *spec = codec->spec; |
| 10356 | unsigned int mute; |
| 10357 | |
| 10358 | if (force || !spec->sense_updated) { |
| 10359 | unsigned int present_int_hp; |
| 10360 | /* need to execute and sync at first */ |
| 10361 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10362 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 10363 | AC_VERB_GET_PIN_SENSE, 0); |
| 10364 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 10365 | spec->sense_updated = 1; |
| 10366 | } |
| 10367 | if (spec->jack_present) { |
| 10368 | /* mute internal speaker */ |
| 10369 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10370 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10371 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10372 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 10373 | } else { |
| 10374 | /* unmute internal speaker if necessary */ |
| 10375 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 10376 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10377 | HDA_AMP_MUTE, mute); |
| 10378 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 10379 | HDA_AMP_MUTE, mute); |
| 10380 | } |
| 10381 | } |
| 10382 | |
| 10383 | /* unsolicited event for HP jack sensing */ |
| 10384 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 10385 | unsigned int res) |
| 10386 | { |
| 10387 | if ((res >> 26) != ALC_HP_EVENT) |
| 10388 | return; |
| 10389 | alc262_lenovo_3000_automute(codec, 1); |
| 10390 | } |
| 10391 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10392 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, |
| 10393 | int dir, int idx, long *valp) |
| 10394 | { |
| 10395 | int i, change = 0; |
| 10396 | |
| 10397 | for (i = 0; i < 2; i++, valp++) |
| 10398 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, |
| 10399 | HDA_AMP_MUTE, |
| 10400 | *valp ? 0 : HDA_AMP_MUTE); |
| 10401 | return change; |
| 10402 | } |
| 10403 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10404 | /* bind hp and internal speaker mute (with plug check) */ |
| 10405 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10406 | struct snd_ctl_elem_value *ucontrol) |
| 10407 | { |
| 10408 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10409 | long *valp = ucontrol->value.integer.value; |
| 10410 | int change; |
| 10411 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10412 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
| 10413 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 10414 | if (change) |
| 10415 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10416 | return change; |
| 10417 | } |
| 10418 | |
| 10419 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 10420 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10421 | { |
| 10422 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10423 | .name = "Master Playback Switch", |
| 10424 | .info = snd_hda_mixer_amp_switch_info, |
| 10425 | .get = snd_hda_mixer_amp_switch_get, |
| 10426 | .put = alc262_fujitsu_master_sw_put, |
| 10427 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10428 | }, |
| 10429 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10430 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10431 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10433 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 10434 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10435 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10436 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10437 | { } /* end */ |
| 10438 | }; |
| 10439 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10440 | /* bind hp and internal speaker mute (with plug check) */ |
| 10441 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10442 | struct snd_ctl_elem_value *ucontrol) |
| 10443 | { |
| 10444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10445 | long *valp = ucontrol->value.integer.value; |
| 10446 | int change; |
| 10447 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 10448 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 10449 | if (change) |
| 10450 | alc262_lenovo_3000_automute(codec, 0); |
| 10451 | return change; |
| 10452 | } |
| 10453 | |
| 10454 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 10455 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 10456 | { |
| 10457 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10458 | .name = "Master Playback Switch", |
| 10459 | .info = snd_hda_mixer_amp_switch_info, |
| 10460 | .get = snd_hda_mixer_amp_switch_get, |
| 10461 | .put = alc262_lenovo_3000_master_sw_put, |
| 10462 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 10463 | }, |
| 10464 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 10465 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 10466 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10468 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10469 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10470 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 10471 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 10472 | { } /* end */ |
| 10473 | }; |
| 10474 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10475 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { |
| 10476 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 10477 | ALC262_HIPPO_MASTER_SWITCH, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10480 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10481 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10482 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10483 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10484 | { } /* end */ |
| 10485 | }; |
| 10486 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 10487 | /* additional init verbs for Benq laptops */ |
| 10488 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 10489 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10490 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 10491 | {} |
| 10492 | }; |
| 10493 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 10494 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 10495 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10496 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10497 | |
| 10498 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 10499 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 10500 | {} |
| 10501 | }; |
| 10502 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10503 | /* Samsung Q1 Ultra Vista model setup */ |
| 10504 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10505 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 10506 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10508 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10509 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10510 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10511 | { } /* end */ |
| 10512 | }; |
| 10513 | |
| 10514 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10515 | /* output mixer */ |
| 10516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10518 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10519 | /* speaker */ |
| 10520 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10521 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10522 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10523 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10524 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10525 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10526 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10527 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10528 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10529 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10530 | /* internal mic */ |
| 10531 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10532 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10533 | /* ADC, choose mic */ |
| 10534 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10535 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10536 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10537 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10538 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 10543 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10544 | {} |
| 10545 | }; |
| 10546 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10547 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10548 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 10549 | { |
| 10550 | struct alc_spec *spec = codec->spec; |
| 10551 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10552 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10553 | mute = 0; |
| 10554 | /* auto-mute only when HP is used as HP */ |
| 10555 | if (!spec->cur_mux[0]) { |
| 10556 | unsigned int present; |
| 10557 | /* need to execute and sync at first */ |
| 10558 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 10559 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 10560 | AC_VERB_GET_PIN_SENSE, 0); |
| 10561 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 10562 | if (spec->jack_present) |
| 10563 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10564 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10565 | /* mute/unmute internal speaker */ |
| 10566 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10567 | HDA_AMP_MUTE, mute); |
| 10568 | /* mute/unmute HP */ |
| 10569 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10570 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 10571 | } |
| 10572 | |
| 10573 | /* unsolicited event for HP jack sensing */ |
| 10574 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 10575 | unsigned int res) |
| 10576 | { |
| 10577 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10578 | return; |
| 10579 | alc262_ultra_automute(codec); |
| 10580 | } |
| 10581 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10582 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 10583 | .num_items = 2, |
| 10584 | .items = { |
| 10585 | { "Mic", 0x1 }, |
| 10586 | { "Headphone", 0x7 }, |
| 10587 | }, |
| 10588 | }; |
| 10589 | |
| 10590 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 10591 | struct snd_ctl_elem_value *ucontrol) |
| 10592 | { |
| 10593 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10594 | struct alc_spec *spec = codec->spec; |
| 10595 | int ret; |
| 10596 | |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10597 | ret = alc_mux_enum_put(kcontrol, ucontrol); |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10598 | if (!ret) |
| 10599 | return 0; |
| 10600 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 10601 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 10602 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10603 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 10604 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 10605 | return ret; |
| 10606 | } |
| 10607 | |
| 10608 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 10609 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10610 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10611 | { |
| 10612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10613 | .name = "Capture Source", |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 10614 | .info = alc_mux_enum_info, |
| 10615 | .get = alc_mux_enum_get, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 10616 | .put = alc262_ultra_mux_enum_put, |
| 10617 | }, |
| 10618 | { } /* end */ |
| 10619 | }; |
| 10620 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10621 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10622 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10623 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10624 | { |
| 10625 | hda_nid_t nid; |
| 10626 | int err; |
| 10627 | |
| 10628 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10629 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10630 | spec->multiout.dac_nids[0] = 2; |
| 10631 | |
| 10632 | nid = cfg->line_out_pins[0]; |
| 10633 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10634 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10635 | "Front Playback Volume", |
| 10636 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 10637 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10638 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10639 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10640 | "Front Playback Switch", |
| 10641 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10642 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10643 | return err; |
| 10644 | } |
| 10645 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 10646 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10647 | if (nid) { |
| 10648 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10649 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10650 | "Speaker Playback Volume", |
| 10651 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10652 | HDA_OUTPUT)); |
| 10653 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10654 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10655 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10656 | "Speaker Playback Switch", |
| 10657 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10658 | HDA_OUTPUT)); |
| 10659 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10660 | return err; |
| 10661 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10662 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10663 | "Speaker Playback Switch", |
| 10664 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10665 | HDA_OUTPUT)); |
| 10666 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10667 | return err; |
| 10668 | } |
| 10669 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 10670 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10671 | if (nid) { |
| 10672 | /* spec->multiout.hp_nid = 2; */ |
| 10673 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10674 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10675 | "Headphone Playback Volume", |
| 10676 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 10677 | HDA_OUTPUT)); |
| 10678 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10679 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10680 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10681 | "Headphone Playback Switch", |
| 10682 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10683 | HDA_OUTPUT)); |
| 10684 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10685 | return err; |
| 10686 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10687 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10688 | "Headphone Playback Switch", |
| 10689 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10690 | HDA_OUTPUT)); |
| 10691 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10692 | return err; |
| 10693 | } |
| 10694 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10695 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10696 | } |
| 10697 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 10698 | static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10699 | const struct auto_pin_cfg *cfg) |
| 10700 | { |
| 10701 | int err; |
| 10702 | |
| 10703 | err = alc880_auto_create_analog_input_ctls(spec, cfg); |
| 10704 | if (err < 0) |
| 10705 | return err; |
| 10706 | /* digital-mic input pin is excluded in alc880_auto_create..() |
| 10707 | * because it's under 0x18 |
| 10708 | */ |
| 10709 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
| 10710 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
| 10711 | struct hda_input_mux *imux = &spec->private_imux[0]; |
| 10712 | imux->items[imux->num_items].label = "Int Mic"; |
| 10713 | imux->items[imux->num_items].index = 0x09; |
| 10714 | imux->num_items++; |
| 10715 | } |
| 10716 | return 0; |
| 10717 | } |
| 10718 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10719 | |
| 10720 | /* |
| 10721 | * generic initialization of ADC, input mixers and output mixers |
| 10722 | */ |
| 10723 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 10724 | /* |
| 10725 | * Unmute ADC0-2 and set the default input to mic-in |
| 10726 | */ |
| 10727 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10728 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10729 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10730 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10731 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10732 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10733 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10734 | /* 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] | 10735 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10736 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10737 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10738 | */ |
| 10739 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10742 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10743 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10744 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10745 | |
| 10746 | /* |
| 10747 | * Set up output mixers (0x0c - 0x0f) |
| 10748 | */ |
| 10749 | /* set vol=0 to output mixers */ |
| 10750 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10751 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10752 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10753 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10754 | /* set up input amps for analog loopback */ |
| 10755 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10756 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10758 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10759 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10760 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10761 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10762 | |
| 10763 | /* FIXME: use matrix-type input source selection */ |
| 10764 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10765 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10766 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10767 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10769 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10770 | /* Input mixer2 */ |
| 10771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10772 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10773 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10774 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10775 | /* Input mixer3 */ |
| 10776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10780 | |
| 10781 | { } |
| 10782 | }; |
| 10783 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10784 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 10785 | /* |
| 10786 | * Unmute ADC0-2 and set the default input to mic-in |
| 10787 | */ |
| 10788 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10790 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10791 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10792 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10793 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10794 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10795 | /* 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] | 10796 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10797 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10798 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10799 | */ |
| 10800 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10802 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10803 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10804 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10805 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10806 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10807 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 10808 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10809 | /* |
| 10810 | * Set up output mixers (0x0c - 0x0e) |
| 10811 | */ |
| 10812 | /* set vol=0 to output mixers */ |
| 10813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10816 | |
| 10817 | /* set up input amps for analog loopback */ |
| 10818 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10825 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10826 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10827 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10828 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 10829 | |
| 10830 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10831 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10832 | |
| 10833 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10834 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10835 | |
| 10836 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10837 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10838 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10839 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10840 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10841 | |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10842 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10843 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10844 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10845 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10846 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10847 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10848 | |
| 10849 | |
| 10850 | /* FIXME: use matrix-type input source selection */ |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10851 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ |
| 10852 | /* Input mixer1: only unmute Mic */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10853 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10854 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10855 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10856 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10857 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10858 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10859 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10860 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10861 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10862 | /* Input mixer2 */ |
| 10863 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10864 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10865 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10866 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10867 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10868 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10869 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10870 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10871 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10872 | /* Input mixer3 */ |
| 10873 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
Jaroslav Kysela | 0e4835c | 2009-05-25 16:44:20 +0200 | [diff] [blame] | 10874 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, |
| 10875 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 10876 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 10877 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 10878 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, |
| 10879 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, |
| 10880 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, |
| 10881 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10882 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10883 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10884 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10885 | { } |
| 10886 | }; |
| 10887 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10888 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 10889 | /* |
| 10890 | * Unmute ADC0-2 and set the default input to mic-in |
| 10891 | */ |
| 10892 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10893 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10894 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10895 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10896 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10897 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10898 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10899 | /* 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] | 10900 | * mixer widget |
| 10901 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 10902 | * panel mic (mic 2) |
| 10903 | */ |
| 10904 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 10905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10906 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10907 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10908 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10909 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 10911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 10912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10913 | /* |
| 10914 | * Set up output mixers (0x0c - 0x0e) |
| 10915 | */ |
| 10916 | /* set vol=0 to output mixers */ |
| 10917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10919 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10920 | |
| 10921 | /* set up input amps for analog loopback */ |
| 10922 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10923 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10924 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10925 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10926 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10927 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10928 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10929 | |
| 10930 | |
| 10931 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 10932 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 10933 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 10934 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 10935 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10936 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 10937 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 10938 | |
| 10939 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10940 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10941 | |
| 10942 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10943 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10944 | |
| 10945 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 10946 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10947 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10948 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 10949 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10950 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 10951 | |
| 10952 | /* FIXME: use matrix-type input source selection */ |
| 10953 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 10954 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10955 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 10956 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 10957 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 10958 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 10959 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 10960 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10961 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 10962 | /* Input mixer2 */ |
| 10963 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10964 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10965 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10966 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10967 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10968 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10969 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10970 | /* Input mixer3 */ |
| 10971 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 10972 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 10973 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 10974 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 10975 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 10976 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 10977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 10978 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 10979 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10980 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 10981 | { } |
| 10982 | }; |
| 10983 | |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 10984 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { |
| 10985 | |
| 10986 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ |
| 10987 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 10988 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 10989 | |
| 10990 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ |
| 10991 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 10992 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10993 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, |
| 10994 | |
| 10995 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ |
| 10996 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10997 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 10998 | {} |
| 10999 | }; |
| 11000 | |
| 11001 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11002 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11003 | #define alc262_loopbacks alc880_loopbacks |
| 11004 | #endif |
| 11005 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 11006 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11007 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 11008 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 11009 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 11010 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 11011 | |
| 11012 | /* |
| 11013 | * BIOS auto configuration |
| 11014 | */ |
| 11015 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 11016 | { |
| 11017 | struct alc_spec *spec = codec->spec; |
| 11018 | int err; |
| 11019 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 11020 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11021 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11022 | alc262_ignore); |
| 11023 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11024 | return err; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11025 | if (!spec->autocfg.line_outs) { |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11026 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11027 | spec->multiout.max_channels = 2; |
| 11028 | spec->no_analog = 1; |
| 11029 | goto dig_only; |
| 11030 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11031 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11032 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11033 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11034 | if (err < 0) |
| 11035 | return err; |
| 11036 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11037 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11038 | return err; |
| 11039 | |
| 11040 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11041 | |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11042 | dig_only: |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11043 | if (spec->autocfg.dig_outs) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11044 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 11045 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11046 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11047 | if (spec->autocfg.dig_in_pin) |
| 11048 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 11049 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 11050 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11051 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11052 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 11053 | add_verb(spec, alc262_volume_init_verbs); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11054 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 11055 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11056 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 11057 | err = alc_auto_add_mic_boost(codec); |
| 11058 | if (err < 0) |
| 11059 | return err; |
| 11060 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 11061 | alc_ssid_check(codec, 0x15, 0x14, 0x1b); |
| 11062 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11063 | return 1; |
| 11064 | } |
| 11065 | |
| 11066 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 11067 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 11068 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11069 | #define alc262_auto_init_input_src alc882_auto_init_input_src |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11070 | |
| 11071 | |
| 11072 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11073 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11074 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11075 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11076 | alc262_auto_init_multi_out(codec); |
| 11077 | alc262_auto_init_hp_out(codec); |
| 11078 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 11079 | alc262_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11080 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 11081 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11082 | } |
| 11083 | |
| 11084 | /* |
| 11085 | * configuration and preset |
| 11086 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11087 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 11088 | [ALC262_BASIC] = "basic", |
| 11089 | [ALC262_HIPPO] = "hippo", |
| 11090 | [ALC262_HIPPO_1] = "hippo_1", |
| 11091 | [ALC262_FUJITSU] = "fujitsu", |
| 11092 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11093 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 11094 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11095 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11096 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 11097 | [ALC262_BENQ_T31] = "benq-t31", |
| 11098 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 11099 | [ALC262_TOSHIBA_S06] = "toshiba-s06", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11100 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11101 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11102 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11103 | [ALC262_NEC] = "nec", |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11104 | [ALC262_TYAN] = "tyan", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11105 | [ALC262_AUTO] = "auto", |
| 11106 | }; |
| 11107 | |
| 11108 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 11109 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11110 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11111 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
| 11112 | ALC262_HP_BPC), |
| 11113 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
| 11114 | ALC262_HP_BPC), |
Takashi Iwai | 53eff7e | 2009-02-27 17:49:44 +0100 | [diff] [blame] | 11115 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
| 11116 | ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11117 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11118 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11119 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11120 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11121 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11122 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11123 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11124 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11125 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 11126 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 11127 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11128 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 11129 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11130 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11131 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11132 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11133 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | bd6afe3 | 2009-03-04 11:30:25 +0100 | [diff] [blame] | 11134 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
Takashi Iwai | 376b508 | 2009-06-22 11:03:13 +0200 | [diff] [blame] | 11135 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), |
Takashi Iwai | f872a91 | 2009-02-26 00:57:01 +0100 | [diff] [blame] | 11136 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
| 11137 | ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 11138 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11139 | ALC262_TOSHIBA_RX1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 11140 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11141 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 11142 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11143 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 11144 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
| 11145 | ALC262_ULTRA), |
Luke Yelavich | 3e420e7 | 2008-12-16 12:37:47 +1100 | [diff] [blame] | 11146 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11147 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11148 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11149 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11150 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11151 | {} |
| 11152 | }; |
| 11153 | |
| 11154 | static struct alc_config_preset alc262_presets[] = { |
| 11155 | [ALC262_BASIC] = { |
| 11156 | .mixers = { alc262_base_mixer }, |
| 11157 | .init_verbs = { alc262_init_verbs }, |
| 11158 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11159 | .dac_nids = alc262_dac_nids, |
| 11160 | .hp_nid = 0x03, |
| 11161 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11162 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 11163 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11164 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11165 | [ALC262_HIPPO] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11166 | .mixers = { alc262_hippo_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11167 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 11168 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11169 | .dac_nids = alc262_dac_nids, |
| 11170 | .hp_nid = 0x03, |
| 11171 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11172 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11173 | .channel_mode = alc262_modes, |
| 11174 | .input_mux = &alc262_capture_source, |
| 11175 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11176 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11177 | }, |
| 11178 | [ALC262_HIPPO_1] = { |
| 11179 | .mixers = { alc262_hippo1_mixer }, |
| 11180 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 11181 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11182 | .dac_nids = alc262_dac_nids, |
| 11183 | .hp_nid = 0x02, |
| 11184 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11185 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11186 | .channel_mode = alc262_modes, |
| 11187 | .input_mux = &alc262_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11188 | .unsol_event = alc262_hippo_unsol_event, |
| 11189 | .init_hook = alc262_hippo1_init_hook, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 11190 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11191 | [ALC262_FUJITSU] = { |
| 11192 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 11193 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11194 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11195 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11196 | .dac_nids = alc262_dac_nids, |
| 11197 | .hp_nid = 0x03, |
| 11198 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11199 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11200 | .channel_mode = alc262_modes, |
| 11201 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11202 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 11203 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 11204 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11205 | [ALC262_HP_BPC] = { |
| 11206 | .mixers = { alc262_HP_BPC_mixer }, |
| 11207 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 11208 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11209 | .dac_nids = alc262_dac_nids, |
| 11210 | .hp_nid = 0x03, |
| 11211 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11212 | .channel_mode = alc262_modes, |
| 11213 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11214 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 11215 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11216 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11217 | [ALC262_HP_BPC_D7000_WF] = { |
| 11218 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 11219 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11220 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11221 | .dac_nids = alc262_dac_nids, |
| 11222 | .hp_nid = 0x03, |
| 11223 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11224 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11225 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11226 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11227 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11228 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11229 | [ALC262_HP_BPC_D7000_WL] = { |
| 11230 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 11231 | alc262_HP_BPC_WildWest_option_mixer }, |
| 11232 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 11233 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11234 | .dac_nids = alc262_dac_nids, |
| 11235 | .hp_nid = 0x03, |
| 11236 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11237 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 11238 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 11239 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 11240 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11241 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11242 | [ALC262_HP_TC_T5735] = { |
| 11243 | .mixers = { alc262_hp_t5735_mixer }, |
| 11244 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 11245 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11246 | .dac_nids = alc262_dac_nids, |
| 11247 | .hp_nid = 0x03, |
| 11248 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11249 | .channel_mode = alc262_modes, |
| 11250 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11251 | .unsol_event = alc_automute_amp_unsol_event, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11252 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 11253 | }, |
| 11254 | [ALC262_HP_RP5700] = { |
| 11255 | .mixers = { alc262_hp_rp5700_mixer }, |
| 11256 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 11257 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11258 | .dac_nids = alc262_dac_nids, |
| 11259 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11260 | .channel_mode = alc262_modes, |
| 11261 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 11262 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 11263 | [ALC262_BENQ_ED8] = { |
| 11264 | .mixers = { alc262_base_mixer }, |
| 11265 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 11266 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11267 | .dac_nids = alc262_dac_nids, |
| 11268 | .hp_nid = 0x03, |
| 11269 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11270 | .channel_mode = alc262_modes, |
| 11271 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11272 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11273 | [ALC262_SONY_ASSAMD] = { |
| 11274 | .mixers = { alc262_sony_mixer }, |
| 11275 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 11276 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11277 | .dac_nids = alc262_dac_nids, |
| 11278 | .hp_nid = 0x02, |
| 11279 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11280 | .channel_mode = alc262_modes, |
| 11281 | .input_mux = &alc262_capture_source, |
| 11282 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11283 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11284 | }, |
| 11285 | [ALC262_BENQ_T31] = { |
| 11286 | .mixers = { alc262_benq_t31_mixer }, |
| 11287 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 11288 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11289 | .dac_nids = alc262_dac_nids, |
| 11290 | .hp_nid = 0x03, |
| 11291 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11292 | .channel_mode = alc262_modes, |
| 11293 | .input_mux = &alc262_capture_source, |
| 11294 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11295 | .init_hook = alc262_hippo_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11296 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11297 | [ALC262_ULTRA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11298 | .mixers = { alc262_ultra_mixer }, |
| 11299 | .cap_mixer = alc262_ultra_capture_mixer, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11300 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11301 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11302 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11303 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11304 | .channel_mode = alc262_modes, |
| 11305 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 11306 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 11307 | .capsrc_nids = alc262_capsrc_nids, |
| 11308 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 11309 | .unsol_event = alc262_ultra_unsol_event, |
| 11310 | .init_hook = alc262_ultra_automute, |
| 11311 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 11312 | [ALC262_LENOVO_3000] = { |
| 11313 | .mixers = { alc262_lenovo_3000_mixer }, |
| 11314 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 11315 | alc262_lenovo_3000_unsol_verbs }, |
| 11316 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11317 | .dac_nids = alc262_dac_nids, |
| 11318 | .hp_nid = 0x03, |
| 11319 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11320 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11321 | .channel_mode = alc262_modes, |
| 11322 | .input_mux = &alc262_fujitsu_capture_source, |
| 11323 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 11324 | }, |
Pascal Terjan | e8f9ae2 | 2008-08-04 14:36:05 +0200 | [diff] [blame] | 11325 | [ALC262_NEC] = { |
| 11326 | .mixers = { alc262_nec_mixer }, |
| 11327 | .init_verbs = { alc262_nec_verbs }, |
| 11328 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11329 | .dac_nids = alc262_dac_nids, |
| 11330 | .hp_nid = 0x03, |
| 11331 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11332 | .channel_mode = alc262_modes, |
| 11333 | .input_mux = &alc262_capture_source, |
| 11334 | }, |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11335 | [ALC262_TOSHIBA_S06] = { |
| 11336 | .mixers = { alc262_toshiba_s06_mixer }, |
| 11337 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, |
| 11338 | alc262_eapd_verbs }, |
| 11339 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11340 | .capsrc_nids = alc262_dmic_capsrc_nids, |
| 11341 | .dac_nids = alc262_dac_nids, |
| 11342 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ |
Takashi Iwai | ae14ef6 | 2009-06-22 08:16:56 +0200 | [diff] [blame] | 11343 | .num_adc_nids = 1, /* single ADC */ |
Kailang Yang | 4e555fe | 2008-08-26 13:05:55 +0200 | [diff] [blame] | 11344 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11345 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11346 | .channel_mode = alc262_modes, |
| 11347 | .input_mux = &alc262_dmic_capture_source, |
| 11348 | .unsol_event = alc262_toshiba_s06_unsol_event, |
| 11349 | .init_hook = alc262_toshiba_s06_init_hook, |
| 11350 | }, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11351 | [ALC262_TOSHIBA_RX1] = { |
| 11352 | .mixers = { alc262_toshiba_rx1_mixer }, |
| 11353 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, |
| 11354 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11355 | .dac_nids = alc262_dac_nids, |
| 11356 | .hp_nid = 0x03, |
| 11357 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11358 | .channel_mode = alc262_modes, |
| 11359 | .input_mux = &alc262_capture_source, |
| 11360 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11361 | .init_hook = alc262_hippo_init_hook, |
Hiroshi Miura | 9f99a63 | 2008-08-28 16:09:06 +0200 | [diff] [blame] | 11362 | }, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11363 | [ALC262_TYAN] = { |
| 11364 | .mixers = { alc262_tyan_mixer }, |
| 11365 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, |
| 11366 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 11367 | .dac_nids = alc262_dac_nids, |
| 11368 | .hp_nid = 0x02, |
| 11369 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 11370 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 11371 | .channel_mode = alc262_modes, |
| 11372 | .input_mux = &alc262_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11373 | .unsol_event = alc_automute_amp_unsol_event, |
| 11374 | .init_hook = alc262_tyan_init_hook, |
Tony Vroon | ba340e8 | 2009-02-02 19:01:30 +0000 | [diff] [blame] | 11375 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11376 | }; |
| 11377 | |
| 11378 | static int patch_alc262(struct hda_codec *codec) |
| 11379 | { |
| 11380 | struct alc_spec *spec; |
| 11381 | int board_config; |
| 11382 | int err; |
| 11383 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11384 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11385 | if (spec == NULL) |
| 11386 | return -ENOMEM; |
| 11387 | |
| 11388 | codec->spec = spec; |
| 11389 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11390 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 11391 | * under-run |
| 11392 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11393 | { |
| 11394 | int tmp; |
| 11395 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11396 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 11397 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 11398 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 11399 | } |
| 11400 | #endif |
| 11401 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11402 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 11403 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11404 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 11405 | alc262_models, |
| 11406 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 11407 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11408 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 11409 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 11410 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11411 | board_config = ALC262_AUTO; |
| 11412 | } |
| 11413 | |
| 11414 | if (board_config == ALC262_AUTO) { |
| 11415 | /* automatic parse from the BIOS config */ |
| 11416 | err = alc262_parse_auto_config(codec); |
| 11417 | if (err < 0) { |
| 11418 | alc_free(codec); |
| 11419 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11420 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11421 | printk(KERN_INFO |
| 11422 | "hda_codec: Cannot set up configuration " |
| 11423 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11424 | board_config = ALC262_BASIC; |
| 11425 | } |
| 11426 | } |
| 11427 | |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11428 | if (!spec->no_analog) { |
| 11429 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 11430 | if (err < 0) { |
| 11431 | alc_free(codec); |
| 11432 | return err; |
| 11433 | } |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 11434 | } |
| 11435 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11436 | if (board_config != ALC262_AUTO) |
| 11437 | setup_preset(spec, &alc262_presets[board_config]); |
| 11438 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11439 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 11440 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11441 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11442 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 11443 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 11444 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11446 | int i; |
| 11447 | /* check whether the digital-mic has to be supported */ |
| 11448 | for (i = 0; i < spec->input_mux->num_items; i++) { |
| 11449 | if (spec->input_mux->items[i].index >= 9) |
| 11450 | break; |
| 11451 | } |
| 11452 | if (i < spec->input_mux->num_items) { |
| 11453 | /* use only ADC0 */ |
| 11454 | spec->adc_nids = alc262_dmic_adc_nids; |
| 11455 | spec->num_adc_nids = 1; |
| 11456 | spec->capsrc_nids = alc262_dmic_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11457 | } else { |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11458 | /* all analog inputs */ |
| 11459 | /* check whether NID 0x07 is valid */ |
| 11460 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 11461 | |
| 11462 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 11463 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 11464 | if (wcap != AC_WID_AUD_IN) { |
| 11465 | spec->adc_nids = alc262_adc_nids_alt; |
| 11466 | spec->num_adc_nids = |
| 11467 | ARRAY_SIZE(alc262_adc_nids_alt); |
| 11468 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
| 11469 | } else { |
| 11470 | spec->adc_nids = alc262_adc_nids; |
| 11471 | spec->num_adc_nids = |
| 11472 | ARRAY_SIZE(alc262_adc_nids); |
| 11473 | spec->capsrc_nids = alc262_capsrc_nids; |
| 11474 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11475 | } |
| 11476 | } |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 11477 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 11478 | set_capture_mixer(spec); |
Takashi Iwai | 07eba61 | 2009-02-19 08:06:35 +0100 | [diff] [blame] | 11479 | if (!spec->no_analog) |
| 11480 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11481 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11482 | spec->vmaster_nid = 0x0c; |
| 11483 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11484 | codec->patch_ops = alc_patch_ops; |
| 11485 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11486 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11487 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11488 | if (!spec->loopback.amplist) |
| 11489 | spec->loopback.amplist = alc262_loopbacks; |
| 11490 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 11491 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11492 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11493 | return 0; |
| 11494 | } |
| 11495 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11496 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11497 | * ALC268 channel source setting (2 channel) |
| 11498 | */ |
| 11499 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 11500 | #define alc268_modes alc260_modes |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11501 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11502 | static hda_nid_t alc268_dac_nids[2] = { |
| 11503 | /* front, hp */ |
| 11504 | 0x02, 0x03 |
| 11505 | }; |
| 11506 | |
| 11507 | static hda_nid_t alc268_adc_nids[2] = { |
| 11508 | /* ADC0-1 */ |
| 11509 | 0x08, 0x07 |
| 11510 | }; |
| 11511 | |
| 11512 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 11513 | /* ADC0 */ |
| 11514 | 0x08 |
| 11515 | }; |
| 11516 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11517 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 11518 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11519 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 11520 | /* output mixer control */ |
| 11521 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11522 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11523 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11525 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11526 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11527 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11528 | { } |
| 11529 | }; |
| 11530 | |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11531 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { |
| 11532 | /* output mixer control */ |
| 11533 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11534 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11535 | ALC262_HIPPO_MASTER_SWITCH, |
| 11536 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11537 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11538 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11539 | { } |
| 11540 | }; |
| 11541 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11542 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 11543 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 11544 | .ops = &snd_hda_bind_sw, |
| 11545 | .values = { |
| 11546 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 11547 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 11548 | 0 |
| 11549 | }, |
| 11550 | }; |
| 11551 | |
| 11552 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 11553 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 11554 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 11555 | { } |
| 11556 | }; |
| 11557 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11558 | static struct hda_verb alc268_eapd_verbs[] = { |
| 11559 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11560 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11561 | { } |
| 11562 | }; |
| 11563 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11564 | /* Toshiba specific */ |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11565 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 11566 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11567 | { } /* end */ |
| 11568 | }; |
| 11569 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11570 | static struct hda_input_mux alc268_acer_lc_capture_source = { |
| 11571 | .num_items = 2, |
| 11572 | .items = { |
| 11573 | { "i-Mic", 0x6 }, |
| 11574 | { "E-Mic", 0x0 }, |
| 11575 | }, |
| 11576 | }; |
| 11577 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11578 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11579 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 11580 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 11581 | .ops = &snd_hda_bind_vol, |
| 11582 | .values = { |
| 11583 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 11584 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 11585 | 0 |
| 11586 | }, |
| 11587 | }; |
| 11588 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11589 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 11590 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 11591 | { |
| 11592 | struct alc_spec *spec = codec->spec; |
| 11593 | unsigned int mute; |
| 11594 | |
| 11595 | if (force || !spec->sense_updated) { |
| 11596 | unsigned int present; |
| 11597 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 11598 | AC_VERB_GET_PIN_SENSE, 0); |
| 11599 | spec->jack_present = (present & 0x80000000) != 0; |
| 11600 | spec->sense_updated = 1; |
| 11601 | } |
| 11602 | if (spec->jack_present) |
| 11603 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 11604 | else /* unmute internal speaker if necessary */ |
| 11605 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 11606 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 11607 | HDA_AMP_MUTE, mute); |
| 11608 | } |
| 11609 | |
| 11610 | |
| 11611 | /* bind hp and internal speaker mute (with plug check) */ |
| 11612 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 11613 | struct snd_ctl_elem_value *ucontrol) |
| 11614 | { |
| 11615 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11616 | long *valp = ucontrol->value.integer.value; |
| 11617 | int change; |
| 11618 | |
Takashi Iwai | 8de56b7 | 2009-07-24 16:51:47 +0200 | [diff] [blame] | 11619 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11620 | if (change) |
| 11621 | alc268_acer_automute(codec, 0); |
| 11622 | return change; |
| 11623 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11624 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11625 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { |
| 11626 | /* output mixer control */ |
| 11627 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11628 | { |
| 11629 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11630 | .name = "Master Playback Switch", |
| 11631 | .info = snd_hda_mixer_amp_switch_info, |
| 11632 | .get = snd_hda_mixer_amp_switch_get, |
| 11633 | .put = alc268_acer_master_sw_put, |
| 11634 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11635 | }, |
| 11636 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), |
| 11637 | { } |
| 11638 | }; |
| 11639 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11640 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 11641 | /* output mixer control */ |
| 11642 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11643 | { |
| 11644 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11645 | .name = "Master Playback Switch", |
| 11646 | .info = snd_hda_mixer_amp_switch_info, |
| 11647 | .get = snd_hda_mixer_amp_switch_get, |
| 11648 | .put = alc268_acer_master_sw_put, |
| 11649 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11650 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 11651 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11652 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11653 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11654 | { } |
| 11655 | }; |
| 11656 | |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11657 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { |
| 11658 | /* output mixer control */ |
| 11659 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 11660 | { |
| 11661 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11662 | .name = "Master Playback Switch", |
| 11663 | .info = snd_hda_mixer_amp_switch_info, |
| 11664 | .get = snd_hda_mixer_amp_switch_get, |
| 11665 | .put = alc268_acer_master_sw_put, |
| 11666 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 11667 | }, |
| 11668 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11669 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
| 11670 | { } |
| 11671 | }; |
| 11672 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11673 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { |
| 11674 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11675 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11676 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11677 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11678 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, |
| 11679 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, |
| 11680 | { } |
| 11681 | }; |
| 11682 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11683 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11684 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 11685 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11686 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11687 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11688 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11689 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11690 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11691 | { } |
| 11692 | }; |
| 11693 | |
| 11694 | /* unsolicited event for HP jack sensing */ |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 11695 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event |
| 11696 | #define alc268_toshiba_init_hook alc262_hippo_init_hook |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11697 | |
| 11698 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 11699 | unsigned int res) |
| 11700 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11701 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 11702 | return; |
| 11703 | alc268_acer_automute(codec, 1); |
| 11704 | } |
| 11705 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 11706 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 11707 | { |
| 11708 | alc268_acer_automute(codec, 1); |
| 11709 | } |
| 11710 | |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 11711 | /* toggle speaker-output according to the hp-jack state */ |
| 11712 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) |
| 11713 | { |
| 11714 | unsigned int present; |
| 11715 | unsigned char bits; |
| 11716 | |
| 11717 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 11718 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11719 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 11720 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, |
| 11721 | AMP_IN_MUTE(0), bits); |
| 11722 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, |
| 11723 | AMP_IN_MUTE(0), bits); |
| 11724 | } |
| 11725 | |
| 11726 | |
| 11727 | static void alc268_acer_mic_automute(struct hda_codec *codec) |
| 11728 | { |
| 11729 | unsigned int present; |
| 11730 | |
| 11731 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11732 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11733 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, |
| 11734 | present ? 0x0 : 0x6); |
| 11735 | } |
| 11736 | |
| 11737 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, |
| 11738 | unsigned int res) |
| 11739 | { |
| 11740 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11741 | alc268_aspire_one_speaker_automute(codec); |
| 11742 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 11743 | alc268_acer_mic_automute(codec); |
| 11744 | } |
| 11745 | |
| 11746 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) |
| 11747 | { |
| 11748 | alc268_aspire_one_speaker_automute(codec); |
| 11749 | alc268_acer_mic_automute(codec); |
| 11750 | } |
| 11751 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11752 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 11753 | /* output mixer control */ |
| 11754 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11755 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11756 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11757 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11758 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11759 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 11760 | { } |
| 11761 | }; |
| 11762 | |
| 11763 | static struct hda_verb alc268_dell_verbs[] = { |
| 11764 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11765 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11766 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11767 | { } |
| 11768 | }; |
| 11769 | |
| 11770 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11771 | static void alc268_dell_init_hook(struct hda_codec *codec) |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11772 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11773 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11774 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11775 | spec->autocfg.hp_pins[0] = 0x15; |
| 11776 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11777 | alc_automute_pin(codec); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 11778 | } |
| 11779 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11780 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 11781 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 11782 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11783 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 11784 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11785 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11786 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11787 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 11788 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 11789 | { } |
| 11790 | }; |
| 11791 | |
| 11792 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 11793 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 11794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 11795 | { } |
| 11796 | }; |
| 11797 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11798 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 11799 | { |
| 11800 | unsigned int present; |
| 11801 | |
| 11802 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11803 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 11804 | snd_hda_codec_write(codec, 0x23, 0, |
| 11805 | AC_VERB_SET_CONNECT_SEL, |
| 11806 | present ? 0x00 : 0x01); |
| 11807 | } |
| 11808 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11809 | static void alc267_quanta_il1_init_hook(struct hda_codec *codec) |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11810 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11811 | struct alc_spec *spec = codec->spec; |
| 11812 | |
| 11813 | spec->autocfg.hp_pins[0] = 0x15; |
| 11814 | spec->autocfg.speaker_pins[0] = 0x14; |
| 11815 | alc_automute_pin(codec); |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11816 | alc267_quanta_il1_mic_automute(codec); |
| 11817 | } |
| 11818 | |
| 11819 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 11820 | unsigned int res) |
| 11821 | { |
| 11822 | switch (res >> 26) { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11823 | case ALC880_MIC_EVENT: |
| 11824 | alc267_quanta_il1_mic_automute(codec); |
| 11825 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 11826 | default: |
| 11827 | alc_sku_unsol_event(codec, res); |
| 11828 | break; |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 11829 | } |
| 11830 | } |
| 11831 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11832 | /* |
| 11833 | * generic initialization of ADC, input mixers and output mixers |
| 11834 | */ |
| 11835 | static struct hda_verb alc268_base_init_verbs[] = { |
| 11836 | /* Unmute DAC0-1 and set vol = 0 */ |
| 11837 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11838 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11839 | |
| 11840 | /* |
| 11841 | * Set up output mixers (0x0c - 0x0e) |
| 11842 | */ |
| 11843 | /* set vol=0 to output mixers */ |
| 11844 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11845 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11846 | |
| 11847 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11848 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11849 | |
| 11850 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11851 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 11852 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 11853 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11855 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11856 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11857 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11858 | |
| 11859 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11860 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11861 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11862 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11863 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11864 | |
| 11865 | /* set PCBEEP vol = 0, mute connections */ |
| 11866 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11867 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11868 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11869 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11870 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 11871 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 11872 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11873 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11874 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11875 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11876 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11877 | { } |
| 11878 | }; |
| 11879 | |
| 11880 | /* |
| 11881 | * generic initialization of ADC, input mixers and output mixers |
| 11882 | */ |
| 11883 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 11884 | /* set output DAC */ |
Takashi Iwai | 4cfb91c | 2009-01-23 12:53:09 +0100 | [diff] [blame] | 11885 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11886 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11887 | |
| 11888 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11889 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 11890 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11891 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11892 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 11893 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11894 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11895 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11896 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11897 | |
| 11898 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11899 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11900 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 11901 | /* set PCBEEP vol = 0, mute connections */ |
| 11902 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11903 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11904 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11905 | |
| 11906 | { } |
| 11907 | }; |
| 11908 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11909 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 11910 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11911 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11912 | { |
| 11913 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11914 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11915 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11916 | */ |
| 11917 | /* .name = "Capture Source", */ |
| 11918 | .name = "Input Source", |
| 11919 | .count = 1, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11920 | .info = alc_mux_enum_info, |
| 11921 | .get = alc_mux_enum_get, |
| 11922 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11923 | }, |
| 11924 | { } /* end */ |
| 11925 | }; |
| 11926 | |
| 11927 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 11928 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11929 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11930 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11931 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 11932 | { |
| 11933 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11934 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11935 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11936 | */ |
| 11937 | /* .name = "Capture Source", */ |
| 11938 | .name = "Input Source", |
| 11939 | .count = 2, |
Takashi Iwai | 54cbc9a | 2008-10-31 15:24:04 +0100 | [diff] [blame] | 11940 | .info = alc_mux_enum_info, |
| 11941 | .get = alc_mux_enum_get, |
| 11942 | .put = alc_mux_enum_put, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 11943 | }, |
| 11944 | { } /* end */ |
| 11945 | }; |
| 11946 | |
| 11947 | static struct hda_input_mux alc268_capture_source = { |
| 11948 | .num_items = 4, |
| 11949 | .items = { |
| 11950 | { "Mic", 0x0 }, |
| 11951 | { "Front Mic", 0x1 }, |
| 11952 | { "Line", 0x2 }, |
| 11953 | { "CD", 0x3 }, |
| 11954 | }, |
| 11955 | }; |
| 11956 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11957 | static struct hda_input_mux alc268_acer_capture_source = { |
| 11958 | .num_items = 3, |
| 11959 | .items = { |
| 11960 | { "Mic", 0x0 }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 11961 | { "Internal Mic", 0x1 }, |
| 11962 | { "Line", 0x2 }, |
| 11963 | }, |
| 11964 | }; |
| 11965 | |
| 11966 | static struct hda_input_mux alc268_acer_dmic_capture_source = { |
| 11967 | .num_items = 3, |
| 11968 | .items = { |
| 11969 | { "Mic", 0x0 }, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 11970 | { "Internal Mic", 0x6 }, |
| 11971 | { "Line", 0x2 }, |
| 11972 | }, |
| 11973 | }; |
| 11974 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11975 | #ifdef CONFIG_SND_DEBUG |
| 11976 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11977 | /* Volume widgets */ |
| 11978 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11979 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11980 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11981 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11982 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 11983 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 11984 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 11985 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 11986 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 11987 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 11988 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 11989 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 11990 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 11991 | /* The below appears problematic on some hardwares */ |
| 11992 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 11993 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11994 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 11995 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 11996 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 11997 | |
| 11998 | /* Modes for retasking pin widgets */ |
| 11999 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 12000 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 12001 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 12002 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 12003 | |
| 12004 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 12005 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 12006 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 12007 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 12008 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 12009 | |
| 12010 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 12011 | * The ALC268 does not have an SPDIF input. |
| 12012 | */ |
| 12013 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 12014 | |
| 12015 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 12016 | * this output to turn on an external amplifier. |
| 12017 | */ |
| 12018 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 12019 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 12020 | |
| 12021 | { } /* end */ |
| 12022 | }; |
| 12023 | #endif |
| 12024 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12025 | /* create input playback/capture controls for the given pin */ |
| 12026 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 12027 | const char *ctlname, int idx) |
| 12028 | { |
| 12029 | char name[32]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12030 | hda_nid_t dac; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12031 | int err; |
| 12032 | |
| 12033 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12034 | switch (nid) { |
| 12035 | case 0x14: |
| 12036 | case 0x16: |
| 12037 | dac = 0x02; |
| 12038 | break; |
| 12039 | case 0x15: |
| 12040 | dac = 0x03; |
| 12041 | break; |
| 12042 | default: |
| 12043 | return 0; |
| 12044 | } |
| 12045 | if (spec->multiout.dac_nids[0] != dac && |
| 12046 | spec->multiout.dac_nids[1] != dac) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12047 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12048 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12049 | HDA_OUTPUT)); |
| 12050 | if (err < 0) |
| 12051 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12052 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
| 12053 | } |
| 12054 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12055 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12056 | if (nid != 0x16) |
| 12057 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12058 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12059 | else /* mono */ |
| 12060 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12061 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12062 | if (err < 0) |
| 12063 | return err; |
| 12064 | return 0; |
| 12065 | } |
| 12066 | |
| 12067 | /* add playback controls from the parsed DAC table */ |
| 12068 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12069 | const struct auto_pin_cfg *cfg) |
| 12070 | { |
| 12071 | hda_nid_t nid; |
| 12072 | int err; |
| 12073 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12074 | spec->multiout.dac_nids = spec->private_dac_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12075 | |
| 12076 | nid = cfg->line_out_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12077 | if (nid) { |
| 12078 | const char *name; |
| 12079 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 12080 | name = "Speaker"; |
| 12081 | else |
| 12082 | name = "Front"; |
| 12083 | err = alc268_new_analog_output(spec, nid, name, 0); |
| 12084 | if (err < 0) |
| 12085 | return err; |
| 12086 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12087 | |
| 12088 | nid = cfg->speaker_pins[0]; |
| 12089 | if (nid == 0x1d) { |
| 12090 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12091 | "Speaker Playback Volume", |
| 12092 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 12093 | if (err < 0) |
| 12094 | return err; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12095 | } else { |
| 12096 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); |
| 12097 | if (err < 0) |
| 12098 | return err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12099 | } |
| 12100 | nid = cfg->hp_pins[0]; |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12101 | if (nid) { |
| 12102 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 12103 | if (err < 0) |
| 12104 | return err; |
| 12105 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12106 | |
| 12107 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 12108 | if (nid == 0x16) { |
| 12109 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12110 | "Mono Playback Switch", |
Takashi Iwai | 3f3b7c1 | 2009-07-17 14:36:59 +0200 | [diff] [blame] | 12111 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12112 | if (err < 0) |
| 12113 | return err; |
| 12114 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12115 | return 0; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12116 | } |
| 12117 | |
| 12118 | /* create playback/capture controls for input pins */ |
| 12119 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12120 | const struct auto_pin_cfg *cfg) |
| 12121 | { |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12122 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12123 | int i, idx1; |
| 12124 | |
| 12125 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12126 | switch(cfg->input_pins[i]) { |
| 12127 | case 0x18: |
| 12128 | idx1 = 0; /* Mic 1 */ |
| 12129 | break; |
| 12130 | case 0x19: |
| 12131 | idx1 = 1; /* Mic 2 */ |
| 12132 | break; |
| 12133 | case 0x1a: |
| 12134 | idx1 = 2; /* Line In */ |
| 12135 | break; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12136 | case 0x1c: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12137 | idx1 = 3; /* CD */ |
| 12138 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 12139 | case 0x12: |
| 12140 | case 0x13: |
| 12141 | idx1 = 6; /* digital mics */ |
| 12142 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12143 | default: |
| 12144 | continue; |
| 12145 | } |
| 12146 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 12147 | imux->items[imux->num_items].index = idx1; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12148 | imux->num_items++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12149 | } |
| 12150 | return 0; |
| 12151 | } |
| 12152 | |
| 12153 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 12154 | { |
| 12155 | struct alc_spec *spec = codec->spec; |
| 12156 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 12157 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 12158 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 12159 | unsigned int dac_vol1, dac_vol2; |
| 12160 | |
| 12161 | if (speaker_nid) { |
| 12162 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 12163 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 12164 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12165 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12166 | AMP_IN_UNMUTE(1)); |
| 12167 | snd_hda_codec_write(codec, 0x10, 0, |
| 12168 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12169 | AMP_IN_UNMUTE(1)); |
| 12170 | } else { |
| 12171 | snd_hda_codec_write(codec, 0x0f, 0, |
| 12172 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12173 | snd_hda_codec_write(codec, 0x10, 0, |
| 12174 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 12175 | } |
| 12176 | |
| 12177 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12178 | if (line_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12179 | dac_vol2 = AMP_OUT_ZERO; |
| 12180 | else if (line_nid == 0x15) |
| 12181 | dac_vol1 = AMP_OUT_ZERO; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12182 | if (hp_nid == 0x14) |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12183 | dac_vol2 = AMP_OUT_ZERO; |
| 12184 | else if (hp_nid == 0x15) |
| 12185 | dac_vol1 = AMP_OUT_ZERO; |
| 12186 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 12187 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 12188 | spec->autocfg.line_out_pins[2] != 0x16) |
| 12189 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 12190 | |
| 12191 | snd_hda_codec_write(codec, 0x02, 0, |
| 12192 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 12193 | snd_hda_codec_write(codec, 0x03, 0, |
| 12194 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 12195 | } |
| 12196 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 12197 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12198 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 12199 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12200 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12201 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 12202 | |
| 12203 | /* |
| 12204 | * BIOS auto configuration |
| 12205 | */ |
| 12206 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 12207 | { |
| 12208 | struct alc_spec *spec = codec->spec; |
| 12209 | int err; |
| 12210 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 12211 | |
| 12212 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12213 | alc268_ignore); |
| 12214 | if (err < 0) |
| 12215 | return err; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12216 | if (!spec->autocfg.line_outs) { |
| 12217 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { |
| 12218 | spec->multiout.max_channels = 2; |
| 12219 | spec->no_analog = 1; |
| 12220 | goto dig_only; |
| 12221 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12222 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12223 | } |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12224 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12225 | if (err < 0) |
| 12226 | return err; |
| 12227 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12228 | if (err < 0) |
| 12229 | return err; |
| 12230 | |
| 12231 | spec->multiout.max_channels = 2; |
| 12232 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12233 | dig_only: |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12234 | /* digital only support output */ |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12235 | if (spec->autocfg.dig_outs) { |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12236 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12237 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
| 12238 | } |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 12239 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12240 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12241 | |
Takashi Iwai | 892981f | 2009-03-02 08:04:35 +0100 | [diff] [blame] | 12242 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12243 | add_mixer(spec, alc268_beep_mixer); |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12244 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12245 | add_verb(spec, alc268_volume_init_verbs); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12246 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 12247 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12248 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12249 | err = alc_auto_add_mic_boost(codec); |
| 12250 | if (err < 0) |
| 12251 | return err; |
| 12252 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 12253 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 12254 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12255 | return 1; |
| 12256 | } |
| 12257 | |
| 12258 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 12259 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 12260 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 12261 | |
| 12262 | /* init callback for auto-configuration model -- overriding the default init */ |
| 12263 | static void alc268_auto_init(struct hda_codec *codec) |
| 12264 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12265 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12266 | alc268_auto_init_multi_out(codec); |
| 12267 | alc268_auto_init_hp_out(codec); |
| 12268 | alc268_auto_init_mono_speaker_out(codec); |
| 12269 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12270 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 12271 | alc_inithook(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12272 | } |
| 12273 | |
| 12274 | /* |
| 12275 | * configuration and preset |
| 12276 | */ |
| 12277 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12278 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12279 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12280 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12281 | [ALC268_ACER] = "acer", |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12282 | [ALC268_ACER_DMIC] = "acer-dmic", |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12283 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12284 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12285 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12286 | #ifdef CONFIG_SND_DEBUG |
| 12287 | [ALC268_TEST] = "test", |
| 12288 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12289 | [ALC268_AUTO] = "auto", |
| 12290 | }; |
| 12291 | |
| 12292 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 12293 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12294 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 12295 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12296 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 12297 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12298 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", |
| 12299 | ALC268_ACER_ASPIRE_ONE), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12300 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | 57d1392 | 2009-01-08 15:52:09 +0100 | [diff] [blame] | 12301 | SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12302 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", |
| 12303 | ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12304 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12305 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
| 12306 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", |
| 12307 | ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 12308 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 12309 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12310 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Takashi Iwai | 8871e5b | 2009-06-02 01:02:50 +0200 | [diff] [blame] | 12311 | SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12312 | {} |
| 12313 | }; |
| 12314 | |
| 12315 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12316 | [ALC267_QUANTA_IL1] = { |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12317 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12318 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12319 | alc267_quanta_il1_verbs }, |
| 12320 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12321 | .dac_nids = alc268_dac_nids, |
| 12322 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12323 | .adc_nids = alc268_adc_nids_alt, |
| 12324 | .hp_nid = 0x03, |
| 12325 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12326 | .channel_mode = alc268_modes, |
| 12327 | .input_mux = &alc268_capture_source, |
| 12328 | .unsol_event = alc267_quanta_il1_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12329 | .init_hook = alc267_quanta_il1_init_hook, |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 12330 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12331 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12332 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12333 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12334 | .init_verbs = { alc268_base_init_verbs }, |
| 12335 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12336 | .dac_nids = alc268_dac_nids, |
| 12337 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12338 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12339 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12340 | .hp_nid = 0x03, |
| 12341 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12342 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12343 | .channel_mode = alc268_modes, |
| 12344 | .input_mux = &alc268_capture_source, |
| 12345 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12346 | [ALC268_TOSHIBA] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12347 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12348 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12349 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12350 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12351 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12352 | .dac_nids = alc268_dac_nids, |
| 12353 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12354 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12355 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12356 | .hp_nid = 0x03, |
| 12357 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12358 | .channel_mode = alc268_modes, |
| 12359 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12360 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12361 | .init_hook = alc268_toshiba_init_hook, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12362 | }, |
| 12363 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12364 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 12365 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12366 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12367 | alc268_acer_verbs }, |
| 12368 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12369 | .dac_nids = alc268_dac_nids, |
| 12370 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12371 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12372 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12373 | .hp_nid = 0x02, |
| 12374 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12375 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 12376 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 12377 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 12378 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12379 | }, |
Takashi Iwai | c238b4f | 2008-11-05 14:57:20 +0100 | [diff] [blame] | 12380 | [ALC268_ACER_DMIC] = { |
| 12381 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, |
| 12382 | alc268_beep_mixer }, |
| 12383 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12384 | alc268_acer_verbs }, |
| 12385 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12386 | .dac_nids = alc268_dac_nids, |
| 12387 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12388 | .adc_nids = alc268_adc_nids_alt, |
| 12389 | .capsrc_nids = alc268_capsrc_nids, |
| 12390 | .hp_nid = 0x02, |
| 12391 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12392 | .channel_mode = alc268_modes, |
| 12393 | .input_mux = &alc268_acer_dmic_capture_source, |
| 12394 | .unsol_event = alc268_acer_unsol_event, |
| 12395 | .init_hook = alc268_acer_init_hook, |
| 12396 | }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12397 | [ALC268_ACER_ASPIRE_ONE] = { |
| 12398 | .mixers = { alc268_acer_aspire_one_mixer, |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12399 | alc268_beep_mixer, |
| 12400 | alc268_capture_alt_mixer }, |
Kailang Yang | 8ef355d | 2008-08-26 13:10:22 +0200 | [diff] [blame] | 12401 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12402 | alc268_acer_aspire_one_verbs }, |
| 12403 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12404 | .dac_nids = alc268_dac_nids, |
| 12405 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12406 | .adc_nids = alc268_adc_nids_alt, |
| 12407 | .capsrc_nids = alc268_capsrc_nids, |
| 12408 | .hp_nid = 0x03, |
| 12409 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12410 | .channel_mode = alc268_modes, |
| 12411 | .input_mux = &alc268_acer_lc_capture_source, |
| 12412 | .unsol_event = alc268_acer_lc_unsol_event, |
| 12413 | .init_hook = alc268_acer_lc_init_hook, |
| 12414 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12415 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12416 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12417 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12418 | alc268_dell_verbs }, |
| 12419 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12420 | .dac_nids = alc268_dac_nids, |
| 12421 | .hp_nid = 0x02, |
| 12422 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12423 | .channel_mode = alc268_modes, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 12424 | .unsol_event = alc_sku_unsol_event, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12425 | .init_hook = alc268_dell_init_hook, |
| 12426 | .input_mux = &alc268_capture_source, |
| 12427 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12428 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12429 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 12430 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12431 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12432 | alc268_toshiba_verbs }, |
| 12433 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12434 | .dac_nids = alc268_dac_nids, |
| 12435 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12436 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12437 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12438 | .hp_nid = 0x03, |
| 12439 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12440 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12441 | .channel_mode = alc268_modes, |
| 12442 | .input_mux = &alc268_capture_source, |
| 12443 | .unsol_event = alc268_toshiba_unsol_event, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 12444 | .init_hook = alc268_toshiba_init_hook |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 12445 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12446 | #ifdef CONFIG_SND_DEBUG |
| 12447 | [ALC268_TEST] = { |
| 12448 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 12449 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 12450 | alc268_volume_init_verbs }, |
| 12451 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 12452 | .dac_nids = alc268_dac_nids, |
| 12453 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 12454 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12455 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 12456 | .hp_nid = 0x03, |
| 12457 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 12458 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 12459 | .channel_mode = alc268_modes, |
| 12460 | .input_mux = &alc268_capture_source, |
| 12461 | }, |
| 12462 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12463 | }; |
| 12464 | |
| 12465 | static int patch_alc268(struct hda_codec *codec) |
| 12466 | { |
| 12467 | struct alc_spec *spec; |
| 12468 | int board_config; |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12469 | int i, has_beep, err; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12470 | |
| 12471 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 12472 | if (spec == NULL) |
| 12473 | return -ENOMEM; |
| 12474 | |
| 12475 | codec->spec = spec; |
| 12476 | |
| 12477 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 12478 | alc268_models, |
| 12479 | alc268_cfg_tbl); |
| 12480 | |
| 12481 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 12482 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 12483 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12484 | board_config = ALC268_AUTO; |
| 12485 | } |
| 12486 | |
| 12487 | if (board_config == ALC268_AUTO) { |
| 12488 | /* automatic parse from the BIOS config */ |
| 12489 | err = alc268_parse_auto_config(codec); |
| 12490 | if (err < 0) { |
| 12491 | alc_free(codec); |
| 12492 | return err; |
| 12493 | } else if (!err) { |
| 12494 | printk(KERN_INFO |
| 12495 | "hda_codec: Cannot set up configuration " |
| 12496 | "from BIOS. Using base mode...\n"); |
| 12497 | board_config = ALC268_3ST; |
| 12498 | } |
| 12499 | } |
| 12500 | |
| 12501 | if (board_config != ALC268_AUTO) |
| 12502 | setup_preset(spec, &alc268_presets[board_config]); |
| 12503 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12504 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 12505 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 12506 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12507 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12508 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 12509 | |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12510 | has_beep = 0; |
| 12511 | for (i = 0; i < spec->num_mixers; i++) { |
| 12512 | if (spec->mixers[i] == alc268_beep_mixer) { |
| 12513 | has_beep = 1; |
| 12514 | break; |
| 12515 | } |
| 12516 | } |
| 12517 | |
| 12518 | if (has_beep) { |
| 12519 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 12520 | if (err < 0) { |
| 12521 | alc_free(codec); |
| 12522 | return err; |
| 12523 | } |
| 12524 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 12525 | /* override the amp caps for beep generator */ |
| 12526 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12527 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 12528 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 12529 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 12530 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
Takashi Iwai | 22971e3 | 2009-02-10 11:56:44 +0100 | [diff] [blame] | 12531 | } |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 12532 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 12533 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12534 | /* check whether NID 0x07 is valid */ |
| 12535 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12536 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12537 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12538 | /* get type */ |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 12539 | wcap = get_wcaps_type(wcap); |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 12540 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12541 | spec->adc_nids = alc268_adc_nids_alt; |
| 12542 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12543 | add_mixer(spec, alc268_capture_alt_mixer); |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 12544 | } else { |
| 12545 | spec->adc_nids = alc268_adc_nids; |
| 12546 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 12547 | add_mixer(spec, alc268_capture_mixer); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12548 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12549 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 12550 | /* set default input source */ |
| 12551 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12552 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 12553 | 0, AC_VERB_SET_CONNECT_SEL, |
| 12554 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12555 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12556 | |
| 12557 | spec->vmaster_nid = 0x02; |
| 12558 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12559 | codec->patch_ops = alc_patch_ops; |
| 12560 | if (board_config == ALC268_AUTO) |
| 12561 | spec->init_hook = alc268_auto_init; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 12562 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 12563 | codec->proc_widget_hook = print_realtek_coef; |
| 12564 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 12565 | return 0; |
| 12566 | } |
| 12567 | |
| 12568 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12569 | * ALC269 channel source setting (2 channel) |
| 12570 | */ |
| 12571 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 12572 | |
| 12573 | #define alc269_dac_nids alc260_dac_nids |
| 12574 | |
| 12575 | static hda_nid_t alc269_adc_nids[1] = { |
| 12576 | /* ADC1 */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12577 | 0x08, |
| 12578 | }; |
| 12579 | |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 12580 | static hda_nid_t alc269_capsrc_nids[1] = { |
| 12581 | 0x23, |
| 12582 | }; |
| 12583 | |
| 12584 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), |
| 12585 | * not a mux! |
| 12586 | */ |
| 12587 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12588 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
| 12589 | .num_items = 2, |
| 12590 | .items = { |
| 12591 | { "i-Mic", 0x5 }, |
| 12592 | { "e-Mic", 0x0 }, |
| 12593 | }, |
| 12594 | }; |
| 12595 | |
| 12596 | static struct hda_input_mux alc269_eeepc_amic_capture_source = { |
| 12597 | .num_items = 2, |
| 12598 | .items = { |
| 12599 | { "i-Mic", 0x1 }, |
| 12600 | { "e-Mic", 0x0 }, |
| 12601 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12602 | }; |
| 12603 | |
| 12604 | #define alc269_modes alc260_modes |
| 12605 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 12606 | |
| 12607 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 12608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12609 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12610 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12611 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12614 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12615 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12616 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12617 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12618 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 12619 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 12620 | { } /* end */ |
| 12621 | }; |
| 12622 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12623 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { |
| 12624 | /* output mixer control */ |
| 12625 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12626 | { |
| 12627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12628 | .name = "Master Playback Switch", |
| 12629 | .info = snd_hda_mixer_amp_switch_info, |
| 12630 | .get = snd_hda_mixer_amp_switch_get, |
| 12631 | .put = alc268_acer_master_sw_put, |
| 12632 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12633 | }, |
| 12634 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12636 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12637 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12638 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12639 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12640 | { } |
| 12641 | }; |
| 12642 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12643 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { |
| 12644 | /* output mixer control */ |
| 12645 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 12646 | { |
| 12647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12648 | .name = "Master Playback Switch", |
| 12649 | .info = snd_hda_mixer_amp_switch_info, |
| 12650 | .get = snd_hda_mixer_amp_switch_get, |
| 12651 | .put = alc268_acer_master_sw_put, |
| 12652 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 12653 | }, |
| 12654 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12655 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12657 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 12658 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 12659 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 12660 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 12661 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 12662 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12663 | { } |
| 12664 | }; |
| 12665 | |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12666 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12667 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12668 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12669 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Darren Salt | 508f711 | 2009-07-08 15:29:49 +0100 | [diff] [blame] | 12670 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12671 | { } /* end */ |
| 12672 | }; |
| 12673 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12674 | /* capture mixer elements */ |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12675 | static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { |
| 12676 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12677 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 12678 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12679 | { } /* end */ |
| 12680 | }; |
| 12681 | |
| 12682 | /* FSC amilo */ |
Takashi Iwai | aa20245 | 2009-07-03 15:00:54 +0200 | [diff] [blame] | 12683 | #define alc269_fujitsu_mixer alc269_eeepc_mixer |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 12684 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12685 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
| 12686 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12687 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12688 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12689 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12690 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12691 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12692 | { } |
| 12693 | }; |
| 12694 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12695 | static struct hda_verb alc269_lifebook_verbs[] = { |
| 12696 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12697 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12698 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12699 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12700 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12701 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12702 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12703 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 12704 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12705 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12706 | { } |
| 12707 | }; |
| 12708 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12709 | /* toggle speaker-output according to the hp-jack state */ |
| 12710 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
| 12711 | { |
| 12712 | unsigned int present; |
| 12713 | unsigned char bits; |
| 12714 | |
| 12715 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12716 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12717 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12718 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12719 | AMP_IN_MUTE(0), bits); |
| 12720 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12721 | AMP_IN_MUTE(0), bits); |
| 12722 | |
| 12723 | snd_hda_codec_write(codec, 0x20, 0, |
| 12724 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12725 | snd_hda_codec_write(codec, 0x20, 0, |
| 12726 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12727 | |
| 12728 | snd_hda_codec_write(codec, 0x20, 0, |
| 12729 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12730 | snd_hda_codec_write(codec, 0x20, 0, |
| 12731 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12732 | } |
| 12733 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12734 | /* toggle speaker-output according to the hp-jacks state */ |
| 12735 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) |
| 12736 | { |
| 12737 | unsigned int present; |
| 12738 | unsigned char bits; |
| 12739 | |
| 12740 | /* Check laptop headphone socket */ |
| 12741 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12742 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12743 | |
| 12744 | /* Check port replicator headphone socket */ |
| 12745 | present |= snd_hda_codec_read(codec, 0x1a, 0, |
| 12746 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12747 | |
| 12748 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12749 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12750 | AMP_IN_MUTE(0), bits); |
| 12751 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12752 | AMP_IN_MUTE(0), bits); |
| 12753 | |
| 12754 | snd_hda_codec_write(codec, 0x20, 0, |
| 12755 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12756 | snd_hda_codec_write(codec, 0x20, 0, |
| 12757 | AC_VERB_SET_PROC_COEF, 0x680); |
| 12758 | |
| 12759 | snd_hda_codec_write(codec, 0x20, 0, |
| 12760 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 12761 | snd_hda_codec_write(codec, 0x20, 0, |
| 12762 | AC_VERB_SET_PROC_COEF, 0x480); |
| 12763 | } |
| 12764 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12765 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
| 12766 | { |
| 12767 | unsigned int present; |
| 12768 | |
| 12769 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12770 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12771 | snd_hda_codec_write(codec, 0x23, 0, |
| 12772 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
| 12773 | } |
| 12774 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12775 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) |
| 12776 | { |
| 12777 | unsigned int present_laptop; |
| 12778 | unsigned int present_dock; |
| 12779 | |
| 12780 | present_laptop = snd_hda_codec_read(codec, 0x18, 0, |
| 12781 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12782 | |
| 12783 | present_dock = snd_hda_codec_read(codec, 0x1b, 0, |
| 12784 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12785 | |
| 12786 | /* Laptop mic port overrides dock mic port, design decision */ |
| 12787 | if (present_dock) |
| 12788 | snd_hda_codec_write(codec, 0x23, 0, |
| 12789 | AC_VERB_SET_CONNECT_SEL, 0x3); |
| 12790 | if (present_laptop) |
| 12791 | snd_hda_codec_write(codec, 0x23, 0, |
| 12792 | AC_VERB_SET_CONNECT_SEL, 0x0); |
| 12793 | if (!present_dock && !present_laptop) |
| 12794 | snd_hda_codec_write(codec, 0x23, 0, |
| 12795 | AC_VERB_SET_CONNECT_SEL, 0x1); |
| 12796 | } |
| 12797 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12798 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
| 12799 | unsigned int res) |
| 12800 | { |
| 12801 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12802 | alc269_quanta_fl1_speaker_automute(codec); |
| 12803 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12804 | alc269_quanta_fl1_mic_automute(codec); |
| 12805 | } |
| 12806 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12807 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, |
| 12808 | unsigned int res) |
| 12809 | { |
| 12810 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12811 | alc269_lifebook_speaker_automute(codec); |
| 12812 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12813 | alc269_lifebook_mic_autoswitch(codec); |
| 12814 | } |
| 12815 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12816 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) |
| 12817 | { |
| 12818 | alc269_quanta_fl1_speaker_automute(codec); |
| 12819 | alc269_quanta_fl1_mic_automute(codec); |
| 12820 | } |
| 12821 | |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 12822 | static void alc269_lifebook_init_hook(struct hda_codec *codec) |
| 12823 | { |
| 12824 | alc269_lifebook_speaker_automute(codec); |
| 12825 | alc269_lifebook_mic_autoswitch(codec); |
| 12826 | } |
| 12827 | |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12828 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
| 12829 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12830 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, |
| 12831 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12832 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, |
| 12833 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12834 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12835 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12836 | {} |
| 12837 | }; |
| 12838 | |
| 12839 | static struct hda_verb alc269_eeepc_amic_init_verbs[] = { |
| 12840 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12841 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12842 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, |
| 12843 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, |
| 12844 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12845 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12846 | {} |
| 12847 | }; |
| 12848 | |
| 12849 | /* toggle speaker-output according to the hp-jack state */ |
| 12850 | static void alc269_speaker_automute(struct hda_codec *codec) |
| 12851 | { |
| 12852 | unsigned int present; |
| 12853 | unsigned char bits; |
| 12854 | |
| 12855 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12856 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12857 | bits = present ? AMP_IN_MUTE(0) : 0; |
| 12858 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 12859 | AMP_IN_MUTE(0), bits); |
| 12860 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 12861 | AMP_IN_MUTE(0), bits); |
| 12862 | } |
| 12863 | |
| 12864 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
| 12865 | { |
| 12866 | unsigned int present; |
| 12867 | |
| 12868 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12869 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12870 | snd_hda_codec_write(codec, 0x23, 0, |
| 12871 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
| 12872 | } |
| 12873 | |
| 12874 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
| 12875 | { |
| 12876 | unsigned int present; |
| 12877 | |
| 12878 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12879 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12880 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12881 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12882 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12883 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12884 | } |
| 12885 | |
| 12886 | /* unsolicited event for HP jack sensing */ |
| 12887 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
| 12888 | unsigned int res) |
| 12889 | { |
| 12890 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12891 | alc269_speaker_automute(codec); |
| 12892 | |
| 12893 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12894 | alc269_eeepc_dmic_automute(codec); |
| 12895 | } |
| 12896 | |
| 12897 | static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) |
| 12898 | { |
| 12899 | alc269_speaker_automute(codec); |
| 12900 | alc269_eeepc_dmic_automute(codec); |
| 12901 | } |
| 12902 | |
| 12903 | /* unsolicited event for HP jack sensing */ |
| 12904 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
| 12905 | unsigned int res) |
| 12906 | { |
| 12907 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12908 | alc269_speaker_automute(codec); |
| 12909 | |
| 12910 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 12911 | alc269_eeepc_amic_automute(codec); |
| 12912 | } |
| 12913 | |
| 12914 | static void alc269_eeepc_amic_inithook(struct hda_codec *codec) |
| 12915 | { |
| 12916 | alc269_speaker_automute(codec); |
| 12917 | alc269_eeepc_amic_automute(codec); |
| 12918 | } |
| 12919 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12920 | /* |
| 12921 | * generic initialization of ADC, input mixers and output mixers |
| 12922 | */ |
| 12923 | static struct hda_verb alc269_init_verbs[] = { |
| 12924 | /* |
| 12925 | * Unmute ADC0 and set the default input to mic-in |
| 12926 | */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12927 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12928 | |
| 12929 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 12930 | * analog-loopback mixer widget |
| 12931 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 12932 | * front panel mic (mic 2) |
| 12933 | */ |
| 12934 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 12935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12937 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12938 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12939 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12940 | |
| 12941 | /* |
| 12942 | * Set up output mixers (0x0c - 0x0e) |
| 12943 | */ |
| 12944 | /* set vol=0 to output mixers */ |
| 12945 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12946 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12947 | |
| 12948 | /* set up input amps for analog loopback */ |
| 12949 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12950 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12951 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12952 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12953 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12954 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12955 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12956 | |
| 12957 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12958 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12959 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12960 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12961 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12962 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12964 | |
| 12965 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12968 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12969 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12970 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12971 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12972 | |
| 12973 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12974 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12975 | |
| 12976 | /* FIXME: use matrix-type input source selection */ |
| 12977 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 12978 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 12979 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12980 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 12981 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12983 | |
| 12984 | /* set EAPD */ |
| 12985 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12986 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12987 | { } |
| 12988 | }; |
| 12989 | |
| 12990 | /* add playback controls from the parsed DAC table */ |
| 12991 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12992 | const struct auto_pin_cfg *cfg) |
| 12993 | { |
| 12994 | hda_nid_t nid; |
| 12995 | int err; |
| 12996 | |
| 12997 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 12998 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 12999 | spec->multiout.dac_nids[0] = 2; |
| 13000 | |
| 13001 | nid = cfg->line_out_pins[0]; |
| 13002 | if (nid) { |
| 13003 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13004 | "Front Playback Volume", |
| 13005 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 13006 | if (err < 0) |
| 13007 | return err; |
| 13008 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13009 | "Front Playback Switch", |
| 13010 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13011 | if (err < 0) |
| 13012 | return err; |
| 13013 | } |
| 13014 | |
| 13015 | nid = cfg->speaker_pins[0]; |
| 13016 | if (nid) { |
| 13017 | if (!cfg->line_out_pins[0]) { |
| 13018 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13019 | "Speaker Playback Volume", |
| 13020 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13021 | HDA_OUTPUT)); |
| 13022 | if (err < 0) |
| 13023 | return err; |
| 13024 | } |
| 13025 | if (nid == 0x16) { |
| 13026 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13027 | "Speaker Playback Switch", |
| 13028 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13029 | HDA_OUTPUT)); |
| 13030 | if (err < 0) |
| 13031 | return err; |
| 13032 | } else { |
| 13033 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13034 | "Speaker Playback Switch", |
| 13035 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13036 | HDA_OUTPUT)); |
| 13037 | if (err < 0) |
| 13038 | return err; |
| 13039 | } |
| 13040 | } |
| 13041 | nid = cfg->hp_pins[0]; |
| 13042 | if (nid) { |
| 13043 | /* spec->multiout.hp_nid = 2; */ |
| 13044 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 13045 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13046 | "Headphone Playback Volume", |
| 13047 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 13048 | HDA_OUTPUT)); |
| 13049 | if (err < 0) |
| 13050 | return err; |
| 13051 | } |
| 13052 | if (nid == 0x16) { |
| 13053 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13054 | "Headphone Playback Switch", |
| 13055 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13056 | HDA_OUTPUT)); |
| 13057 | if (err < 0) |
| 13058 | return err; |
| 13059 | } else { |
| 13060 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 13061 | "Headphone Playback Switch", |
| 13062 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13063 | HDA_OUTPUT)); |
| 13064 | if (err < 0) |
| 13065 | return err; |
| 13066 | } |
| 13067 | } |
| 13068 | return 0; |
| 13069 | } |
| 13070 | |
Takashi Iwai | 8c927b4 | 2009-06-22 10:56:54 +0200 | [diff] [blame] | 13071 | #define alc269_auto_create_analog_input_ctls \ |
| 13072 | alc262_auto_create_analog_input_ctls |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13073 | |
| 13074 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13075 | #define alc269_loopbacks alc880_loopbacks |
| 13076 | #endif |
| 13077 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13078 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13079 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 13080 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 13081 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 13082 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 13083 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13084 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 13085 | .substreams = 1, |
| 13086 | .channels_min = 2, |
| 13087 | .channels_max = 8, |
| 13088 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13089 | /* NID is set in alc_build_pcms */ |
| 13090 | .ops = { |
| 13091 | .open = alc880_playback_pcm_open, |
| 13092 | .prepare = alc880_playback_pcm_prepare, |
| 13093 | .cleanup = alc880_playback_pcm_cleanup |
| 13094 | }, |
| 13095 | }; |
| 13096 | |
| 13097 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 13098 | .substreams = 1, |
| 13099 | .channels_min = 2, |
| 13100 | .channels_max = 2, |
| 13101 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 13102 | /* NID is set in alc_build_pcms */ |
| 13103 | }; |
| 13104 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13105 | /* |
| 13106 | * BIOS auto configuration |
| 13107 | */ |
| 13108 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 13109 | { |
| 13110 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | cfb9fb5 | 2009-02-06 17:34:03 +0100 | [diff] [blame] | 13111 | int err; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13112 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 13113 | |
| 13114 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13115 | alc269_ignore); |
| 13116 | if (err < 0) |
| 13117 | return err; |
| 13118 | |
| 13119 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13120 | if (err < 0) |
| 13121 | return err; |
| 13122 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13123 | if (err < 0) |
| 13124 | return err; |
| 13125 | |
| 13126 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13127 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 13128 | if (spec->autocfg.dig_outs) |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13129 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 13130 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 13131 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13132 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13133 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 13134 | add_verb(spec, alc269_init_verbs); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13135 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 13136 | spec->input_mux = &spec->private_imux[0]; |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13137 | /* set default input source */ |
| 13138 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
| 13139 | 0, AC_VERB_SET_CONNECT_SEL, |
| 13140 | spec->input_mux->items[0].index); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13141 | |
| 13142 | err = alc_auto_add_mic_boost(codec); |
| 13143 | if (err < 0) |
| 13144 | return err; |
| 13145 | |
Takashi Iwai | 7e0e44d | 2009-02-19 08:15:49 +0100 | [diff] [blame] | 13146 | if (!spec->cap_mixer && !spec->no_analog) |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13147 | set_capture_mixer(spec); |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13148 | |
Takashi Iwai | 1d955eb | 2009-06-29 11:33:53 +0200 | [diff] [blame] | 13149 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 13150 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13151 | return 1; |
| 13152 | } |
| 13153 | |
| 13154 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 13155 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 13156 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 13157 | |
| 13158 | |
| 13159 | /* init callback for auto-configuration model -- overriding the default init */ |
| 13160 | static void alc269_auto_init(struct hda_codec *codec) |
| 13161 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13162 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13163 | alc269_auto_init_multi_out(codec); |
| 13164 | alc269_auto_init_hp_out(codec); |
| 13165 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13166 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 13167 | alc_inithook(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13168 | } |
| 13169 | |
| 13170 | /* |
| 13171 | * configuration and preset |
| 13172 | */ |
| 13173 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13174 | [ALC269_BASIC] = "basic", |
Takashi Iwai | 2922c9a | 2008-08-27 18:12:42 +0200 | [diff] [blame] | 13175 | [ALC269_QUANTA_FL1] = "quanta", |
| 13176 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13177 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13178 | [ALC269_FUJITSU] = "fujitsu", |
| 13179 | [ALC269_LIFEBOOK] = "lifebook" |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13180 | }; |
| 13181 | |
| 13182 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13183 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13184 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 13185 | ALC269_ASUS_EEEPC_P703), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13186 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), |
| 13187 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), |
| 13188 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), |
| 13189 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), |
| 13190 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), |
| 13191 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13192 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
| 13193 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13194 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
| 13195 | ALC269_ASUS_EEEPC_P901), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 13196 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13197 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13198 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13199 | {} |
| 13200 | }; |
| 13201 | |
| 13202 | static struct alc_config_preset alc269_presets[] = { |
| 13203 | [ALC269_BASIC] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13204 | .mixers = { alc269_base_mixer }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13205 | .init_verbs = { alc269_init_verbs }, |
| 13206 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13207 | .dac_nids = alc269_dac_nids, |
| 13208 | .hp_nid = 0x03, |
| 13209 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13210 | .channel_mode = alc269_modes, |
| 13211 | .input_mux = &alc269_capture_source, |
| 13212 | }, |
Kailang Yang | 60db6b5 | 2008-08-26 13:13:00 +0200 | [diff] [blame] | 13213 | [ALC269_QUANTA_FL1] = { |
| 13214 | .mixers = { alc269_quanta_fl1_mixer }, |
| 13215 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, |
| 13216 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13217 | .dac_nids = alc269_dac_nids, |
| 13218 | .hp_nid = 0x03, |
| 13219 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13220 | .channel_mode = alc269_modes, |
| 13221 | .input_mux = &alc269_capture_source, |
| 13222 | .unsol_event = alc269_quanta_fl1_unsol_event, |
| 13223 | .init_hook = alc269_quanta_fl1_init_hook, |
| 13224 | }, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13225 | [ALC269_ASUS_EEEPC_P703] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13226 | .mixers = { alc269_eeepc_mixer }, |
| 13227 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13228 | .init_verbs = { alc269_init_verbs, |
| 13229 | alc269_eeepc_amic_init_verbs }, |
| 13230 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13231 | .dac_nids = alc269_dac_nids, |
| 13232 | .hp_nid = 0x03, |
| 13233 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13234 | .channel_mode = alc269_modes, |
| 13235 | .input_mux = &alc269_eeepc_amic_capture_source, |
| 13236 | .unsol_event = alc269_eeepc_amic_unsol_event, |
| 13237 | .init_hook = alc269_eeepc_amic_inithook, |
| 13238 | }, |
| 13239 | [ALC269_ASUS_EEEPC_P901] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13240 | .mixers = { alc269_eeepc_mixer }, |
| 13241 | .cap_mixer = alc269_epc_capture_mixer, |
Kailang Yang | f53281e | 2008-07-18 12:36:43 +0200 | [diff] [blame] | 13242 | .init_verbs = { alc269_init_verbs, |
| 13243 | alc269_eeepc_dmic_init_verbs }, |
| 13244 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13245 | .dac_nids = alc269_dac_nids, |
| 13246 | .hp_nid = 0x03, |
| 13247 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13248 | .channel_mode = alc269_modes, |
| 13249 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13250 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13251 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13252 | }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13253 | [ALC269_FUJITSU] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13254 | .mixers = { alc269_fujitsu_mixer }, |
Takashi Iwai | 26f5df2 | 2008-11-03 17:39:46 +0100 | [diff] [blame] | 13255 | .cap_mixer = alc269_epc_capture_mixer, |
| 13256 | .init_verbs = { alc269_init_verbs, |
| 13257 | alc269_eeepc_dmic_init_verbs }, |
| 13258 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13259 | .dac_nids = alc269_dac_nids, |
| 13260 | .hp_nid = 0x03, |
| 13261 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13262 | .channel_mode = alc269_modes, |
| 13263 | .input_mux = &alc269_eeepc_dmic_capture_source, |
| 13264 | .unsol_event = alc269_eeepc_dmic_unsol_event, |
| 13265 | .init_hook = alc269_eeepc_dmic_inithook, |
| 13266 | }, |
Tony Vroon | 6415483 | 2008-11-06 15:08:49 +0000 | [diff] [blame] | 13267 | [ALC269_LIFEBOOK] = { |
| 13268 | .mixers = { alc269_lifebook_mixer }, |
| 13269 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, |
| 13270 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 13271 | .dac_nids = alc269_dac_nids, |
| 13272 | .hp_nid = 0x03, |
| 13273 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 13274 | .channel_mode = alc269_modes, |
| 13275 | .input_mux = &alc269_capture_source, |
| 13276 | .unsol_event = alc269_lifebook_unsol_event, |
| 13277 | .init_hook = alc269_lifebook_init_hook, |
| 13278 | }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13279 | }; |
| 13280 | |
| 13281 | static int patch_alc269(struct hda_codec *codec) |
| 13282 | { |
| 13283 | struct alc_spec *spec; |
| 13284 | int board_config; |
| 13285 | int err; |
| 13286 | |
| 13287 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13288 | if (spec == NULL) |
| 13289 | return -ENOMEM; |
| 13290 | |
| 13291 | codec->spec = spec; |
| 13292 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 13293 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 13294 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13295 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 13296 | alc269_models, |
| 13297 | alc269_cfg_tbl); |
| 13298 | |
| 13299 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 13300 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 13301 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13302 | board_config = ALC269_AUTO; |
| 13303 | } |
| 13304 | |
| 13305 | if (board_config == ALC269_AUTO) { |
| 13306 | /* automatic parse from the BIOS config */ |
| 13307 | err = alc269_parse_auto_config(codec); |
| 13308 | if (err < 0) { |
| 13309 | alc_free(codec); |
| 13310 | return err; |
| 13311 | } else if (!err) { |
| 13312 | printk(KERN_INFO |
| 13313 | "hda_codec: Cannot set up configuration " |
| 13314 | "from BIOS. Using base mode...\n"); |
| 13315 | board_config = ALC269_BASIC; |
| 13316 | } |
| 13317 | } |
| 13318 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 13319 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 13320 | if (err < 0) { |
| 13321 | alc_free(codec); |
| 13322 | return err; |
| 13323 | } |
| 13324 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13325 | if (board_config != ALC269_AUTO) |
| 13326 | setup_preset(spec, &alc269_presets[board_config]); |
| 13327 | |
Takashi Iwai | f03d311 | 2009-03-05 14:18:16 +0100 | [diff] [blame] | 13328 | if (codec->subsystem_id == 0x17aa3bf8) { |
| 13329 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 13330 | * fix the sample rate of analog I/O to 44.1kHz |
| 13331 | */ |
| 13332 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 13333 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; |
| 13334 | } else { |
| 13335 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 13336 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 13337 | } |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13338 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 13339 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 13340 | |
| 13341 | spec->adc_nids = alc269_adc_nids; |
| 13342 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
Takashi Iwai | e01bf50 | 2008-08-21 16:25:07 +0200 | [diff] [blame] | 13343 | spec->capsrc_nids = alc269_capsrc_nids; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 13344 | if (!spec->cap_mixer) |
| 13345 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 13346 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13347 | |
| 13348 | codec->patch_ops = alc_patch_ops; |
| 13349 | if (board_config == ALC269_AUTO) |
| 13350 | spec->init_hook = alc269_auto_init; |
| 13351 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13352 | if (!spec->loopback.amplist) |
| 13353 | spec->loopback.amplist = alc269_loopbacks; |
| 13354 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 13355 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13356 | |
| 13357 | return 0; |
| 13358 | } |
| 13359 | |
| 13360 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13361 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 13362 | */ |
| 13363 | |
| 13364 | /* |
| 13365 | * set the path ways for 2 channel output |
| 13366 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 13367 | */ |
| 13368 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 13369 | /* set pin widget 1Ah (line in) for input */ |
| 13370 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13371 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13372 | * the vref |
| 13373 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13374 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13375 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13377 | #if 0 |
| 13378 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13379 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13380 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13381 | { } /* end */ |
| 13382 | }; |
| 13383 | /* |
| 13384 | * 6ch mode |
| 13385 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 13386 | */ |
| 13387 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 13388 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13389 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13390 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13391 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13392 | |
| 13393 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13394 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13395 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13396 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13397 | #if 0 |
| 13398 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13399 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13400 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13401 | { } /* end */ |
| 13402 | }; |
| 13403 | |
| 13404 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 13405 | { 2, alc861_threestack_ch2_init }, |
| 13406 | { 6, alc861_threestack_ch6_init }, |
| 13407 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13408 | /* Set mic1 as input and unmute the mixer */ |
| 13409 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 13410 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13411 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13412 | { } /* end */ |
| 13413 | }; |
| 13414 | /* Set mic1 as output and mute mixer */ |
| 13415 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 13416 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13417 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13418 | { } /* end */ |
| 13419 | }; |
| 13420 | |
| 13421 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 13422 | { 2, alc861_uniwill_m31_ch2_init }, |
| 13423 | { 4, alc861_uniwill_m31_ch4_init }, |
| 13424 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13425 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13426 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 13427 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 13428 | /* set pin widget 1Ah (line in) for input */ |
| 13429 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13430 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 13431 | * the vref |
| 13432 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13433 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13434 | |
| 13435 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 13436 | #if 0 |
| 13437 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 13438 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 13439 | #endif |
| 13440 | { } /* end */ |
| 13441 | }; |
| 13442 | /* Set mic1 nad line-in as output and mute mixer */ |
| 13443 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 13444 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 13445 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13446 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13447 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 13448 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13449 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 13450 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13451 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13452 | |
| 13453 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 13454 | #if 0 |
| 13455 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 13456 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 13457 | #endif |
| 13458 | { } /* end */ |
| 13459 | }; |
| 13460 | |
| 13461 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 13462 | { 2, alc861_asus_ch2_init }, |
| 13463 | { 6, alc861_asus_ch6_init }, |
| 13464 | }; |
| 13465 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13466 | /* patch-ALC861 */ |
| 13467 | |
| 13468 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 13469 | /* output mixer control */ |
| 13470 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13471 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13472 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13473 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13474 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13475 | |
| 13476 | /*Input mixer control */ |
| 13477 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13478 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13480 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13481 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13482 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13483 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13484 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13486 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13487 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13488 | { } /* end */ |
| 13489 | }; |
| 13490 | |
| 13491 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 13492 | /* output mixer control */ |
| 13493 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13494 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13495 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13496 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13497 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13498 | |
| 13499 | /* Input mixer control */ |
| 13500 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13501 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13502 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13503 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13504 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13505 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13506 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13507 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13509 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13510 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13511 | { |
| 13512 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13513 | .name = "Channel Mode", |
| 13514 | .info = alc_ch_mode_info, |
| 13515 | .get = alc_ch_mode_get, |
| 13516 | .put = alc_ch_mode_put, |
| 13517 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 13518 | }, |
| 13519 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13520 | }; |
| 13521 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13522 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13523 | /* output mixer control */ |
| 13524 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13525 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13526 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13527 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13528 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13529 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13530 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13531 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 13532 | /* output mixer control */ |
| 13533 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13534 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13535 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13536 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13537 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 13538 | |
| 13539 | /* Input mixer control */ |
| 13540 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13541 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 13542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13543 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13545 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13548 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 13549 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13550 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13551 | { |
| 13552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13553 | .name = "Channel Mode", |
| 13554 | .info = alc_ch_mode_info, |
| 13555 | .get = alc_ch_mode_get, |
| 13556 | .put = alc_ch_mode_put, |
| 13557 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 13558 | }, |
| 13559 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13560 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13561 | |
| 13562 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 13563 | /* output mixer control */ |
| 13564 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 13565 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 13566 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 13567 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 13568 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 13569 | |
| 13570 | /* Input mixer control */ |
| 13571 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 13572 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13573 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13574 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 13575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 13576 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 13577 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 13578 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 13579 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13580 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 13581 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13582 | { |
| 13583 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13584 | .name = "Channel Mode", |
| 13585 | .info = alc_ch_mode_info, |
| 13586 | .get = alc_ch_mode_get, |
| 13587 | .put = alc_ch_mode_put, |
| 13588 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 13589 | }, |
| 13590 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13591 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13592 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13593 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 13594 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13595 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 13596 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13597 | { } |
| 13598 | }; |
| 13599 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13600 | /* |
| 13601 | * generic initialization of ADC, input mixers and output mixers |
| 13602 | */ |
| 13603 | static struct hda_verb alc861_base_init_verbs[] = { |
| 13604 | /* |
| 13605 | * Unmute ADC0 and set the default input to mic-in |
| 13606 | */ |
| 13607 | /* port-A for surround (rear panel) */ |
| 13608 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13609 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13610 | /* port-B for mic-in (rear panel) with vref */ |
| 13611 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13612 | /* port-C for line-in (rear panel) */ |
| 13613 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13614 | /* port-D for Front */ |
| 13615 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13616 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13617 | /* port-E for HP out (front panel) */ |
| 13618 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13619 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13620 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13621 | /* port-F for mic-in (front panel) with vref */ |
| 13622 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13623 | /* port-G for CLFE (rear panel) */ |
| 13624 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13625 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13626 | /* port-H for side (rear panel) */ |
| 13627 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13628 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13629 | /* CD-in */ |
| 13630 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13631 | /* route front mic to ADC1*/ |
| 13632 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13633 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13634 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13635 | /* Unmute DAC0~3 & spdif out*/ |
| 13636 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13637 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13638 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13639 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13640 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13642 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13643 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13644 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13645 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13646 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13647 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13648 | /* Unmute Stereo Mixer 15 */ |
| 13649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13650 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13651 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13652 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13653 | |
| 13654 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13655 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13656 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13657 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13658 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13659 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13660 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13661 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13662 | /* hp used DAC 3 (Front) */ |
| 13663 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13664 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13665 | |
| 13666 | { } |
| 13667 | }; |
| 13668 | |
| 13669 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 13670 | /* |
| 13671 | * Unmute ADC0 and set the default input to mic-in |
| 13672 | */ |
| 13673 | /* port-A for surround (rear panel) */ |
| 13674 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13675 | /* port-B for mic-in (rear panel) with vref */ |
| 13676 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13677 | /* port-C for line-in (rear panel) */ |
| 13678 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13679 | /* port-D for Front */ |
| 13680 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13681 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13682 | /* port-E for HP out (front panel) */ |
| 13683 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 13684 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13685 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13686 | /* port-F for mic-in (front panel) with vref */ |
| 13687 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13688 | /* port-G for CLFE (rear panel) */ |
| 13689 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13690 | /* port-H for side (rear panel) */ |
| 13691 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13692 | /* CD-in */ |
| 13693 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13694 | /* route front mic to ADC1*/ |
| 13695 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13696 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13697 | /* Unmute DAC0~3 & spdif out*/ |
| 13698 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13699 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13700 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13701 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13702 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13703 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13704 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13705 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13706 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13707 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13708 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13709 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13710 | /* Unmute Stereo Mixer 15 */ |
| 13711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13712 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13713 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13714 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13715 | |
| 13716 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13717 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13718 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13719 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13720 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13721 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13722 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13723 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13724 | /* hp used DAC 3 (Front) */ |
| 13725 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13726 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13727 | { } |
| 13728 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13729 | |
| 13730 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 13731 | /* |
| 13732 | * Unmute ADC0 and set the default input to mic-in |
| 13733 | */ |
| 13734 | /* port-A for surround (rear panel) */ |
| 13735 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13736 | /* port-B for mic-in (rear panel) with vref */ |
| 13737 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13738 | /* port-C for line-in (rear panel) */ |
| 13739 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13740 | /* port-D for Front */ |
| 13741 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13742 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13743 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13744 | /* this has to be set to VREF80 */ |
| 13745 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13746 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13747 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13748 | /* port-F for mic-in (front panel) with vref */ |
| 13749 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13750 | /* port-G for CLFE (rear panel) */ |
| 13751 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13752 | /* port-H for side (rear panel) */ |
| 13753 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13754 | /* CD-in */ |
| 13755 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13756 | /* route front mic to ADC1*/ |
| 13757 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13758 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13759 | /* Unmute DAC0~3 & spdif out*/ |
| 13760 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13761 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13762 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13763 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13764 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13765 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13766 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13767 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13768 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13769 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13770 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13771 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13772 | /* Unmute Stereo Mixer 15 */ |
| 13773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13774 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13775 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13776 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13777 | |
| 13778 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13780 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13781 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13782 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13783 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13784 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13785 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13786 | /* hp used DAC 3 (Front) */ |
| 13787 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 13788 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13789 | { } |
| 13790 | }; |
| 13791 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13792 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 13793 | /* |
| 13794 | * Unmute ADC0 and set the default input to mic-in |
| 13795 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13796 | /* port-A for surround (rear panel) |
| 13797 | * according to codec#0 this is the HP jack |
| 13798 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13799 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 13800 | /* route front PCM to HP */ |
| 13801 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13802 | /* port-B for mic-in (rear panel) with vref */ |
| 13803 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13804 | /* port-C for line-in (rear panel) */ |
| 13805 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13806 | /* port-D for Front */ |
| 13807 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13808 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 13809 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13810 | /* this has to be set to VREF80 */ |
| 13811 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13812 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 13813 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13814 | /* port-F for mic-in (front panel) with vref */ |
| 13815 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 13816 | /* port-G for CLFE (rear panel) */ |
| 13817 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13818 | /* port-H for side (rear panel) */ |
| 13819 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 13820 | /* CD-in */ |
| 13821 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 13822 | /* route front mic to ADC1*/ |
| 13823 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13825 | /* Unmute DAC0~3 & spdif out*/ |
| 13826 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13827 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13828 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13829 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13830 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13831 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13832 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13833 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13834 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13835 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13836 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13837 | /* Unmute Stereo Mixer 15 */ |
| 13838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13839 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13841 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13842 | |
| 13843 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13844 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13845 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13846 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13847 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13848 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13849 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13850 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13851 | /* hp used DAC 3 (Front) */ |
| 13852 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13853 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13854 | { } |
| 13855 | }; |
| 13856 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 13857 | /* additional init verbs for ASUS laptops */ |
| 13858 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 13859 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 13860 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 13861 | { } |
| 13862 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 13863 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13864 | /* |
| 13865 | * generic initialization of ADC, input mixers and output mixers |
| 13866 | */ |
| 13867 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 13868 | /* |
| 13869 | * Unmute ADC0 and set the default input to mic-in |
| 13870 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13871 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13872 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13873 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13874 | /* Unmute DAC0~3 & spdif out*/ |
| 13875 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13876 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13877 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13878 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13879 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13880 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13881 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 13882 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13883 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13884 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13885 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 13886 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13887 | /* Unmute Stereo Mixer 15 */ |
| 13888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13889 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13890 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13891 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 13892 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13893 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13894 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13895 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13896 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13897 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13898 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13899 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13900 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13901 | |
| 13902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13903 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13905 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13906 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13908 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13909 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13910 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13911 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13912 | |
| 13913 | { } |
| 13914 | }; |
| 13915 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13916 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 13917 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13918 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13919 | { } |
| 13920 | }; |
| 13921 | |
| 13922 | /* toggle speaker-output according to the hp-jack state */ |
| 13923 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 13924 | { |
| 13925 | unsigned int present; |
| 13926 | |
| 13927 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 13928 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13929 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 13930 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 13931 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 13932 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13933 | } |
| 13934 | |
| 13935 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 13936 | unsigned int res) |
| 13937 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 13938 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13939 | alc861_toshiba_automute(codec); |
| 13940 | } |
| 13941 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 13942 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13943 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 13944 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 13945 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 13946 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 13947 | |
| 13948 | |
| 13949 | #define ALC861_DIGOUT_NID 0x07 |
| 13950 | |
| 13951 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 13952 | { 8, NULL } |
| 13953 | }; |
| 13954 | |
| 13955 | static hda_nid_t alc861_dac_nids[4] = { |
| 13956 | /* front, surround, clfe, side */ |
| 13957 | 0x03, 0x06, 0x05, 0x04 |
| 13958 | }; |
| 13959 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13960 | static hda_nid_t alc660_dac_nids[3] = { |
| 13961 | /* front, clfe, surround */ |
| 13962 | 0x03, 0x05, 0x06 |
| 13963 | }; |
| 13964 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13965 | static hda_nid_t alc861_adc_nids[1] = { |
| 13966 | /* ADC0-2 */ |
| 13967 | 0x08, |
| 13968 | }; |
| 13969 | |
| 13970 | static struct hda_input_mux alc861_capture_source = { |
| 13971 | .num_items = 5, |
| 13972 | .items = { |
| 13973 | { "Mic", 0x0 }, |
| 13974 | { "Front Mic", 0x3 }, |
| 13975 | { "Line", 0x1 }, |
| 13976 | { "CD", 0x4 }, |
| 13977 | { "Mixer", 0x5 }, |
| 13978 | }, |
| 13979 | }; |
| 13980 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13981 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) |
| 13982 | { |
| 13983 | struct alc_spec *spec = codec->spec; |
| 13984 | hda_nid_t mix, srcs[5]; |
| 13985 | int i, j, num; |
| 13986 | |
| 13987 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) |
| 13988 | return 0; |
| 13989 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 13990 | if (num < 0) |
| 13991 | return 0; |
| 13992 | for (i = 0; i < num; i++) { |
| 13993 | unsigned int type; |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame^] | 13994 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 13995 | if (type != AC_WID_AUD_OUT) |
| 13996 | continue; |
| 13997 | for (j = 0; j < spec->multiout.num_dacs; j++) |
| 13998 | if (spec->multiout.dac_nids[j] == srcs[i]) |
| 13999 | break; |
| 14000 | if (j >= spec->multiout.num_dacs) |
| 14001 | return srcs[i]; |
| 14002 | } |
| 14003 | return 0; |
| 14004 | } |
| 14005 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14006 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14007 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14008 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14009 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14010 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14011 | int i; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14012 | hda_nid_t nid, dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14013 | |
| 14014 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 14015 | for (i = 0; i < cfg->line_outs; i++) { |
| 14016 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14017 | dac = alc861_look_for_dac(codec, nid); |
| 14018 | if (!dac) |
| 14019 | continue; |
| 14020 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14021 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14022 | return 0; |
| 14023 | } |
| 14024 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14025 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, |
| 14026 | hda_nid_t nid, unsigned int chs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14027 | { |
| 14028 | char name[32]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14029 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
| 14030 | return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name, |
| 14031 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 14032 | } |
| 14033 | |
| 14034 | /* add playback controls from the parsed DAC table */ |
| 14035 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 14036 | const struct auto_pin_cfg *cfg) |
| 14037 | { |
| 14038 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14039 | static const char *chname[4] = { |
| 14040 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14041 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14042 | hda_nid_t nid; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14043 | int i, err; |
| 14044 | |
| 14045 | if (cfg->line_outs == 1) { |
| 14046 | const char *pfx = NULL; |
| 14047 | if (!cfg->hp_outs) |
| 14048 | pfx = "Master"; |
| 14049 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
| 14050 | pfx = "Speaker"; |
| 14051 | if (pfx) { |
| 14052 | nid = spec->multiout.dac_nids[0]; |
| 14053 | return alc861_create_out_sw(codec, pfx, nid, 3); |
| 14054 | } |
| 14055 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14056 | |
| 14057 | for (i = 0; i < cfg->line_outs; i++) { |
| 14058 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14059 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14060 | continue; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14061 | if (i == 2) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14062 | /* Center/LFE */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14063 | err = alc861_create_out_sw(codec, "Center", nid, 1); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14064 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14065 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14066 | err = alc861_create_out_sw(codec, "LFE", nid, 2); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14067 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14068 | return err; |
| 14069 | } else { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14070 | err = alc861_create_out_sw(codec, chname[i], nid, 3); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14071 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14072 | return err; |
| 14073 | } |
| 14074 | } |
| 14075 | return 0; |
| 14076 | } |
| 14077 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14078 | 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] | 14079 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14080 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14081 | int err; |
| 14082 | hda_nid_t nid; |
| 14083 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14084 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14085 | return 0; |
| 14086 | |
| 14087 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14088 | nid = alc861_look_for_dac(codec, pin); |
| 14089 | if (nid) { |
| 14090 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); |
| 14091 | if (err < 0) |
| 14092 | return err; |
| 14093 | spec->multiout.hp_nid = nid; |
| 14094 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14095 | } |
| 14096 | return 0; |
| 14097 | } |
| 14098 | |
| 14099 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14100 | static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14101 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14102 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14103 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14104 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14105 | int i, err, idx, idx1; |
| 14106 | |
| 14107 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14108 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14109 | case 0x0c: |
| 14110 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14111 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14112 | break; |
| 14113 | case 0x0f: |
| 14114 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14115 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14116 | break; |
| 14117 | case 0x0d: |
| 14118 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14119 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14120 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14121 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14122 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14123 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14124 | break; |
| 14125 | case 0x11: |
| 14126 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14127 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14128 | break; |
| 14129 | default: |
| 14130 | continue; |
| 14131 | } |
| 14132 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14133 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14134 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14135 | if (err < 0) |
| 14136 | return err; |
| 14137 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 14138 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14139 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14140 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14141 | } |
| 14142 | return 0; |
| 14143 | } |
| 14144 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14145 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14146 | hda_nid_t nid, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14147 | int pin_type, hda_nid_t dac) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14148 | { |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14149 | hda_nid_t mix, srcs[5]; |
| 14150 | int i, num; |
| 14151 | |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 14152 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14153 | pin_type); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14154 | 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] | 14155 | AMP_OUT_UNMUTE); |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14156 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) |
| 14157 | return; |
| 14158 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); |
| 14159 | if (num < 0) |
| 14160 | return; |
| 14161 | for (i = 0; i < num; i++) { |
| 14162 | unsigned int mute; |
| 14163 | if (srcs[i] == dac || srcs[i] == 0x15) |
| 14164 | mute = AMP_IN_UNMUTE(i); |
| 14165 | else |
| 14166 | mute = AMP_IN_MUTE(i); |
| 14167 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14168 | mute); |
| 14169 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14170 | } |
| 14171 | |
| 14172 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 14173 | { |
| 14174 | struct alc_spec *spec = codec->spec; |
| 14175 | int i; |
| 14176 | |
| 14177 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 14178 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14179 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14180 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14181 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14182 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14183 | } |
| 14184 | } |
| 14185 | |
| 14186 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14187 | { |
| 14188 | struct alc_spec *spec = codec->spec; |
| 14189 | hda_nid_t pin; |
| 14190 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 14191 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14192 | if (pin) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14193 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14194 | spec->multiout.hp_nid); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14195 | pin = spec->autocfg.speaker_pins[0]; |
| 14196 | if (pin) |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14197 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, |
| 14198 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14199 | } |
| 14200 | |
| 14201 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 14202 | { |
| 14203 | struct alc_spec *spec = codec->spec; |
| 14204 | int i; |
| 14205 | |
| 14206 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14207 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 14208 | if (nid >= 0x0c && nid <= 0x11) |
| 14209 | alc_set_input_pin(codec, nid, i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14210 | } |
| 14211 | } |
| 14212 | |
| 14213 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14214 | /* return 1 if successful, 0 if the proper config is not found, |
| 14215 | * or a negative error code |
| 14216 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14217 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 14218 | { |
| 14219 | struct alc_spec *spec = codec->spec; |
| 14220 | int err; |
| 14221 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 14222 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14223 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14224 | alc861_ignore); |
| 14225 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14226 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14227 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14228 | return 0; /* can't find valid BIOS pin config */ |
| 14229 | |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14230 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14231 | if (err < 0) |
| 14232 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14233 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14234 | if (err < 0) |
| 14235 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14236 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14237 | if (err < 0) |
| 14238 | return err; |
Takashi Iwai | 1c20930 | 2009-07-22 15:17:45 +0200 | [diff] [blame] | 14239 | err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14240 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14241 | return err; |
| 14242 | |
| 14243 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14244 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 14245 | if (spec->autocfg.dig_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14246 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 14247 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 14248 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14249 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14250 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 14251 | add_verb(spec, alc861_auto_init_verbs); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14252 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 14253 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 14254 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14255 | |
| 14256 | spec->adc_nids = alc861_adc_nids; |
| 14257 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 14258 | set_capture_mixer(spec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14259 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 14260 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); |
| 14261 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14262 | return 1; |
| 14263 | } |
| 14264 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14265 | /* additional initialization for auto-configuration model */ |
| 14266 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14267 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14268 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14269 | alc861_auto_init_multi_out(codec); |
| 14270 | alc861_auto_init_hp_out(codec); |
| 14271 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14272 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 14273 | alc_inithook(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14274 | } |
| 14275 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14276 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14277 | static struct hda_amp_list alc861_loopbacks[] = { |
| 14278 | { 0x15, HDA_INPUT, 0 }, |
| 14279 | { 0x15, HDA_INPUT, 1 }, |
| 14280 | { 0x15, HDA_INPUT, 2 }, |
| 14281 | { 0x15, HDA_INPUT, 3 }, |
| 14282 | { } /* end */ |
| 14283 | }; |
| 14284 | #endif |
| 14285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14286 | |
| 14287 | /* |
| 14288 | * configuration and preset |
| 14289 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14290 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 14291 | [ALC861_3ST] = "3stack", |
| 14292 | [ALC660_3ST] = "3stack-660", |
| 14293 | [ALC861_3ST_DIG] = "3stack-dig", |
| 14294 | [ALC861_6ST_DIG] = "6stack-dig", |
| 14295 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 14296 | [ALC861_TOSHIBA] = "toshiba", |
| 14297 | [ALC861_ASUS] = "asus", |
| 14298 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 14299 | [ALC861_AUTO] = "auto", |
| 14300 | }; |
| 14301 | |
| 14302 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 14303 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14304 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14305 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 14306 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14307 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 14308 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 14309 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 14310 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 14311 | * Any other models that need this preset? |
| 14312 | */ |
| 14313 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 14314 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 14315 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14316 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 14317 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 14318 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 14319 | /* FIXME: the below seems conflict */ |
| 14320 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 14321 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 14322 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14323 | {} |
| 14324 | }; |
| 14325 | |
| 14326 | static struct alc_config_preset alc861_presets[] = { |
| 14327 | [ALC861_3ST] = { |
| 14328 | .mixers = { alc861_3ST_mixer }, |
| 14329 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14330 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14331 | .dac_nids = alc861_dac_nids, |
| 14332 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14333 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14334 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14335 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14336 | .adc_nids = alc861_adc_nids, |
| 14337 | .input_mux = &alc861_capture_source, |
| 14338 | }, |
| 14339 | [ALC861_3ST_DIG] = { |
| 14340 | .mixers = { alc861_base_mixer }, |
| 14341 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14342 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14343 | .dac_nids = alc861_dac_nids, |
| 14344 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14345 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14346 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14347 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14348 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14349 | .adc_nids = alc861_adc_nids, |
| 14350 | .input_mux = &alc861_capture_source, |
| 14351 | }, |
| 14352 | [ALC861_6ST_DIG] = { |
| 14353 | .mixers = { alc861_base_mixer }, |
| 14354 | .init_verbs = { alc861_base_init_verbs }, |
| 14355 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14356 | .dac_nids = alc861_dac_nids, |
| 14357 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14358 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 14359 | .channel_mode = alc861_8ch_modes, |
| 14360 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14361 | .adc_nids = alc861_adc_nids, |
| 14362 | .input_mux = &alc861_capture_source, |
| 14363 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14364 | [ALC660_3ST] = { |
| 14365 | .mixers = { alc861_3ST_mixer }, |
| 14366 | .init_verbs = { alc861_threestack_init_verbs }, |
| 14367 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 14368 | .dac_nids = alc660_dac_nids, |
| 14369 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 14370 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 14371 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14372 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14373 | .adc_nids = alc861_adc_nids, |
| 14374 | .input_mux = &alc861_capture_source, |
| 14375 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 14376 | [ALC861_UNIWILL_M31] = { |
| 14377 | .mixers = { alc861_uniwill_m31_mixer }, |
| 14378 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 14379 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14380 | .dac_nids = alc861_dac_nids, |
| 14381 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14382 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 14383 | .channel_mode = alc861_uniwill_m31_modes, |
| 14384 | .need_dac_fix = 1, |
| 14385 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14386 | .adc_nids = alc861_adc_nids, |
| 14387 | .input_mux = &alc861_capture_source, |
| 14388 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14389 | [ALC861_TOSHIBA] = { |
| 14390 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14391 | .init_verbs = { alc861_base_init_verbs, |
| 14392 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 14393 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14394 | .dac_nids = alc861_dac_nids, |
| 14395 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14396 | .channel_mode = alc883_3ST_2ch_modes, |
| 14397 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14398 | .adc_nids = alc861_adc_nids, |
| 14399 | .input_mux = &alc861_capture_source, |
| 14400 | .unsol_event = alc861_toshiba_unsol_event, |
| 14401 | .init_hook = alc861_toshiba_automute, |
| 14402 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 14403 | [ALC861_ASUS] = { |
| 14404 | .mixers = { alc861_asus_mixer }, |
| 14405 | .init_verbs = { alc861_asus_init_verbs }, |
| 14406 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14407 | .dac_nids = alc861_dac_nids, |
| 14408 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14409 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 14410 | .channel_mode = alc861_asus_modes, |
| 14411 | .need_dac_fix = 1, |
| 14412 | .hp_nid = 0x06, |
| 14413 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14414 | .adc_nids = alc861_adc_nids, |
| 14415 | .input_mux = &alc861_capture_source, |
| 14416 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 14417 | [ALC861_ASUS_LAPTOP] = { |
| 14418 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 14419 | .init_verbs = { alc861_asus_init_verbs, |
| 14420 | alc861_asus_laptop_init_verbs }, |
| 14421 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 14422 | .dac_nids = alc861_dac_nids, |
| 14423 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 14424 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 14425 | .channel_mode = alc883_3ST_2ch_modes, |
| 14426 | .need_dac_fix = 1, |
| 14427 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 14428 | .adc_nids = alc861_adc_nids, |
| 14429 | .input_mux = &alc861_capture_source, |
| 14430 | }, |
| 14431 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14432 | |
| 14433 | |
| 14434 | static int patch_alc861(struct hda_codec *codec) |
| 14435 | { |
| 14436 | struct alc_spec *spec; |
| 14437 | int board_config; |
| 14438 | int err; |
| 14439 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 14440 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14441 | if (spec == NULL) |
| 14442 | return -ENOMEM; |
| 14443 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14444 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14445 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14446 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 14447 | alc861_models, |
| 14448 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14449 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 14450 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 14451 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 14452 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14453 | board_config = ALC861_AUTO; |
| 14454 | } |
| 14455 | |
| 14456 | if (board_config == ALC861_AUTO) { |
| 14457 | /* automatic parse from the BIOS config */ |
| 14458 | err = alc861_parse_auto_config(codec); |
| 14459 | if (err < 0) { |
| 14460 | alc_free(codec); |
| 14461 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14462 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14463 | printk(KERN_INFO |
| 14464 | "hda_codec: Cannot set up configuration " |
| 14465 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14466 | board_config = ALC861_3ST_DIG; |
| 14467 | } |
| 14468 | } |
| 14469 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 14470 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 14471 | if (err < 0) { |
| 14472 | alc_free(codec); |
| 14473 | return err; |
| 14474 | } |
| 14475 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14476 | if (board_config != ALC861_AUTO) |
| 14477 | setup_preset(spec, &alc861_presets[board_config]); |
| 14478 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14479 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 14480 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 14481 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14482 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 14483 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 14484 | |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 14485 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
| 14486 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14487 | spec->vmaster_nid = 0x03; |
| 14488 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14489 | codec->patch_ops = alc_patch_ops; |
| 14490 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 14491 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14492 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14493 | if (!spec->loopback.amplist) |
| 14494 | spec->loopback.amplist = alc861_loopbacks; |
| 14495 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 14496 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14497 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14498 | return 0; |
| 14499 | } |
| 14500 | |
| 14501 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14502 | * ALC861-VD support |
| 14503 | * |
| 14504 | * Based on ALC882 |
| 14505 | * |
| 14506 | * In addition, an independent DAC |
| 14507 | */ |
| 14508 | #define ALC861VD_DIGOUT_NID 0x06 |
| 14509 | |
| 14510 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 14511 | /* front, surr, clfe, side surr */ |
| 14512 | 0x02, 0x03, 0x04, 0x05 |
| 14513 | }; |
| 14514 | |
| 14515 | /* dac_nids for ALC660vd are in a different order - according to |
| 14516 | * Realtek's driver. |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14517 | * This should probably result in a different mixer for 6stack models |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14518 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 14519 | * - and it is the same as in 861vd. |
| 14520 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 14521 | */ |
| 14522 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 14523 | /* front, rear, clfe, rear_surr */ |
| 14524 | 0x02, 0x04, 0x03 |
| 14525 | }; |
| 14526 | |
| 14527 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 14528 | /* ADC0 */ |
| 14529 | 0x09, |
| 14530 | }; |
| 14531 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14532 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 14533 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14534 | /* input MUX */ |
| 14535 | /* FIXME: should be a matrix-type input source selection */ |
| 14536 | static struct hda_input_mux alc861vd_capture_source = { |
| 14537 | .num_items = 4, |
| 14538 | .items = { |
| 14539 | { "Mic", 0x0 }, |
| 14540 | { "Front Mic", 0x1 }, |
| 14541 | { "Line", 0x2 }, |
| 14542 | { "CD", 0x4 }, |
| 14543 | }, |
| 14544 | }; |
| 14545 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14546 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14547 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14548 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14549 | { "Ext Mic", 0x0 }, |
| 14550 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14551 | }, |
| 14552 | }; |
| 14553 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14554 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 14555 | .num_items = 2, |
| 14556 | .items = { |
| 14557 | { "Front Mic", 0x0 }, |
| 14558 | { "ATAPI Mic", 0x1 }, |
| 14559 | }, |
| 14560 | }; |
| 14561 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14562 | /* |
| 14563 | * 2ch mode |
| 14564 | */ |
| 14565 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 14566 | { 2, NULL } |
| 14567 | }; |
| 14568 | |
| 14569 | /* |
| 14570 | * 6ch mode |
| 14571 | */ |
| 14572 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 14573 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 14574 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14575 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14576 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14577 | { } /* end */ |
| 14578 | }; |
| 14579 | |
| 14580 | /* |
| 14581 | * 8ch mode |
| 14582 | */ |
| 14583 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 14584 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14585 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14586 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14587 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 14588 | { } /* end */ |
| 14589 | }; |
| 14590 | |
| 14591 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 14592 | { 6, alc861vd_6stack_ch6_init }, |
| 14593 | { 8, alc861vd_6stack_ch8_init }, |
| 14594 | }; |
| 14595 | |
| 14596 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 14597 | { |
| 14598 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 14599 | .name = "Channel Mode", |
| 14600 | .info = alc_ch_mode_info, |
| 14601 | .get = alc_ch_mode_get, |
| 14602 | .put = alc_ch_mode_put, |
| 14603 | }, |
| 14604 | { } /* end */ |
| 14605 | }; |
| 14606 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14607 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 14608 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 14609 | */ |
| 14610 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 14611 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14612 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14613 | |
| 14614 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14615 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14616 | |
| 14617 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 14618 | HDA_OUTPUT), |
| 14619 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 14620 | HDA_OUTPUT), |
| 14621 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 14622 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 14623 | |
| 14624 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 14625 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 14626 | |
| 14627 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14628 | |
| 14629 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14630 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14631 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14632 | |
| 14633 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14636 | |
| 14637 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14638 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14639 | |
| 14640 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14641 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14642 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14643 | { } /* end */ |
| 14644 | }; |
| 14645 | |
| 14646 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 14647 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14648 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14649 | |
| 14650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14651 | |
| 14652 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14653 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14654 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14655 | |
| 14656 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14657 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14658 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14659 | |
| 14660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 14661 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 14662 | |
| 14663 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14664 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14665 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14666 | { } /* end */ |
| 14667 | }; |
| 14668 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14669 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 14670 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14671 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 14672 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 14673 | |
| 14674 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 14675 | |
| 14676 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 14677 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14678 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14679 | |
| 14680 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 14681 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14682 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 14683 | |
| 14684 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 14685 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 14686 | |
| 14687 | { } /* end */ |
| 14688 | }; |
| 14689 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14690 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 14691 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14692 | */ |
| 14693 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14695 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14697 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14698 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 14699 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14700 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14701 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 14702 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14703 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14704 | { } /* end */ |
| 14705 | }; |
| 14706 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14707 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 14708 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 14709 | */ |
| 14710 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 14711 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 14712 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 14713 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 14714 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 14715 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 14716 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 14717 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 14718 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14719 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 14720 | { } /* end */ |
| 14721 | }; |
| 14722 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14723 | /* |
| 14724 | * generic initialization of ADC, input mixers and output mixers |
| 14725 | */ |
| 14726 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 14727 | /* |
| 14728 | * Unmute ADC0 and set the default input to mic-in |
| 14729 | */ |
| 14730 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14731 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14732 | |
| 14733 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 14734 | * the analog-loopback mixer widget |
| 14735 | */ |
| 14736 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14737 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14738 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14739 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14741 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14742 | |
| 14743 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14744 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14745 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14746 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14747 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14748 | |
| 14749 | /* |
| 14750 | * Set up output mixers (0x02 - 0x05) |
| 14751 | */ |
| 14752 | /* set vol=0 to output mixers */ |
| 14753 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14754 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14755 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14756 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14757 | |
| 14758 | /* set up input amps for analog loopback */ |
| 14759 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 14760 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14761 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14762 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14763 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14764 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14765 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14766 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14767 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14768 | |
| 14769 | { } |
| 14770 | }; |
| 14771 | |
| 14772 | /* |
| 14773 | * 3-stack pin configuration: |
| 14774 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 14775 | */ |
| 14776 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 14777 | /* |
| 14778 | * Set pin mode and muting |
| 14779 | */ |
| 14780 | /* set front pin widgets 0x14 for output */ |
| 14781 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14782 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14783 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14784 | |
| 14785 | /* Mic (rear) pin: input vref at 80% */ |
| 14786 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14787 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14788 | /* Front Mic pin: input vref at 80% */ |
| 14789 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14790 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14791 | /* Line In pin: input */ |
| 14792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14793 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14794 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14795 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14796 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14797 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14798 | /* CD pin widget for input */ |
| 14799 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14800 | |
| 14801 | { } |
| 14802 | }; |
| 14803 | |
| 14804 | /* |
| 14805 | * 6-stack pin configuration: |
| 14806 | */ |
| 14807 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 14808 | /* |
| 14809 | * Set pin mode and muting |
| 14810 | */ |
| 14811 | /* set front pin widgets 0x14 for output */ |
| 14812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14813 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14814 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14815 | |
| 14816 | /* Rear Pin: output 1 (0x0d) */ |
| 14817 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14818 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14819 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 14820 | /* CLFE Pin: output 2 (0x0e) */ |
| 14821 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14822 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14823 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 14824 | /* Side Pin: output 3 (0x0f) */ |
| 14825 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14826 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14827 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 14828 | |
| 14829 | /* Mic (rear) pin: input vref at 80% */ |
| 14830 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14831 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14832 | /* Front Mic pin: input vref at 80% */ |
| 14833 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 14834 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14835 | /* Line In pin: input */ |
| 14836 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14837 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14838 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 14839 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 14840 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14841 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 14842 | /* CD pin widget for input */ |
| 14843 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14844 | |
| 14845 | { } |
| 14846 | }; |
| 14847 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14848 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 14849 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14850 | { } |
| 14851 | }; |
| 14852 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 14853 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 14854 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14855 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 14856 | { } |
| 14857 | }; |
| 14858 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14859 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 14860 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14861 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14862 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 14863 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14864 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14865 | {} |
| 14866 | }; |
| 14867 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14868 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 14869 | { |
| 14870 | unsigned int present; |
| 14871 | unsigned char bits; |
| 14872 | |
| 14873 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14874 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 14875 | bits = present ? HDA_AMP_MUTE : 0; |
| 14876 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 14877 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14878 | } |
| 14879 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14880 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14881 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14882 | struct alc_spec *spec = codec->spec; |
| 14883 | |
| 14884 | spec->autocfg.hp_pins[0] = 0x1b; |
| 14885 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14886 | alc_automute_amp(codec); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14887 | alc861vd_lenovo_mic_automute(codec); |
| 14888 | } |
| 14889 | |
| 14890 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 14891 | unsigned int res) |
| 14892 | { |
| 14893 | switch (res >> 26) { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14894 | case ALC880_MIC_EVENT: |
| 14895 | alc861vd_lenovo_mic_automute(codec); |
| 14896 | break; |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14897 | default: |
| 14898 | alc_automute_amp_unsol_event(codec, res); |
| 14899 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14900 | } |
| 14901 | } |
| 14902 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14903 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 14904 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14905 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14906 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14907 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 14908 | |
| 14909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14910 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 14911 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14912 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14913 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14914 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 14915 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 14916 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14917 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14918 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14919 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14920 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14921 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14922 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14923 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14924 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 14925 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 14926 | |
| 14927 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14928 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14929 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 14930 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 14931 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14933 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14934 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 14935 | |
| 14936 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 14937 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 14938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 14939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 14940 | |
| 14941 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 14942 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14943 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 14944 | |
| 14945 | { } /* end */ |
| 14946 | }; |
| 14947 | |
| 14948 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14949 | static void alc861vd_dallas_init_hook(struct hda_codec *codec) |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14950 | { |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14951 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14952 | |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 14953 | spec->autocfg.hp_pins[0] = 0x15; |
| 14954 | spec->autocfg.speaker_pins[0] = 0x14; |
| 14955 | alc_automute_amp(codec); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14956 | } |
| 14957 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14958 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14959 | #define alc861vd_loopbacks alc880_loopbacks |
| 14960 | #endif |
| 14961 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 14962 | /* pcm configuration: identical with ALC880 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14963 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 14964 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 14965 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 14966 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 14967 | |
| 14968 | /* |
| 14969 | * configuration and preset |
| 14970 | */ |
| 14971 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 14972 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14973 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14974 | [ALC660VD_ASUS_V1S] = "asus-v1s", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14975 | [ALC861VD_3ST] = "3stack", |
| 14976 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 14977 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 14978 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14979 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 14980 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14981 | [ALC861VD_AUTO] = "auto", |
| 14982 | }; |
| 14983 | |
| 14984 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14985 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 14986 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 14987 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14988 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 14989 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 14990 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14991 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14992 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 14993 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 14994 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 14995 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 14996 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 14997 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 14998 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 14999 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15000 | {} |
| 15001 | }; |
| 15002 | |
| 15003 | static struct alc_config_preset alc861vd_presets[] = { |
| 15004 | [ALC660VD_3ST] = { |
| 15005 | .mixers = { alc861vd_3st_mixer }, |
| 15006 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15007 | alc861vd_3stack_init_verbs }, |
| 15008 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15009 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15010 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15011 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15012 | .input_mux = &alc861vd_capture_source, |
| 15013 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15014 | [ALC660VD_3ST_DIG] = { |
| 15015 | .mixers = { alc861vd_3st_mixer }, |
| 15016 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15017 | alc861vd_3stack_init_verbs }, |
| 15018 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15019 | .dac_nids = alc660vd_dac_nids, |
| 15020 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 15021 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15022 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15023 | .input_mux = &alc861vd_capture_source, |
| 15024 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15025 | [ALC861VD_3ST] = { |
| 15026 | .mixers = { alc861vd_3st_mixer }, |
| 15027 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15028 | alc861vd_3stack_init_verbs }, |
| 15029 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15030 | .dac_nids = alc861vd_dac_nids, |
| 15031 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15032 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15033 | .input_mux = &alc861vd_capture_source, |
| 15034 | }, |
| 15035 | [ALC861VD_3ST_DIG] = { |
| 15036 | .mixers = { alc861vd_3st_mixer }, |
| 15037 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15038 | alc861vd_3stack_init_verbs }, |
| 15039 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15040 | .dac_nids = alc861vd_dac_nids, |
| 15041 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15042 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15043 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15044 | .input_mux = &alc861vd_capture_source, |
| 15045 | }, |
| 15046 | [ALC861VD_6ST_DIG] = { |
| 15047 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 15048 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15049 | alc861vd_6stack_init_verbs }, |
| 15050 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15051 | .dac_nids = alc861vd_dac_nids, |
| 15052 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15053 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 15054 | .channel_mode = alc861vd_6stack_modes, |
| 15055 | .input_mux = &alc861vd_capture_source, |
| 15056 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15057 | [ALC861VD_LENOVO] = { |
| 15058 | .mixers = { alc861vd_lenovo_mixer }, |
| 15059 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15060 | alc861vd_3stack_init_verbs, |
| 15061 | alc861vd_eapd_verbs, |
| 15062 | alc861vd_lenovo_unsol_verbs }, |
| 15063 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15064 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15065 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15066 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15067 | .input_mux = &alc861vd_capture_source, |
| 15068 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15069 | .init_hook = alc861vd_lenovo_init_hook, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15070 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15071 | [ALC861VD_DALLAS] = { |
| 15072 | .mixers = { alc861vd_dallas_mixer }, |
| 15073 | .init_verbs = { alc861vd_dallas_verbs }, |
| 15074 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15075 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 15076 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15077 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15078 | .input_mux = &alc861vd_dallas_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15079 | .unsol_event = alc_automute_amp_unsol_event, |
| 15080 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15081 | }, |
| 15082 | [ALC861VD_HP] = { |
| 15083 | .mixers = { alc861vd_hp_mixer }, |
| 15084 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 15085 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 15086 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15087 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15088 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15089 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15090 | .input_mux = &alc861vd_hp_capture_source, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15091 | .unsol_event = alc_automute_amp_unsol_event, |
| 15092 | .init_hook = alc861vd_dallas_init_hook, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 15093 | }, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15094 | [ALC660VD_ASUS_V1S] = { |
| 15095 | .mixers = { alc861vd_lenovo_mixer }, |
| 15096 | .init_verbs = { alc861vd_volume_init_verbs, |
| 15097 | alc861vd_3stack_init_verbs, |
| 15098 | alc861vd_eapd_verbs, |
| 15099 | alc861vd_lenovo_unsol_verbs }, |
| 15100 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 15101 | .dac_nids = alc660vd_dac_nids, |
| 15102 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 15103 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 15104 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 15105 | .input_mux = &alc861vd_capture_source, |
| 15106 | .unsol_event = alc861vd_lenovo_unsol_event, |
Takashi Iwai | a9fd4f3 | 2009-05-08 15:57:59 +0200 | [diff] [blame] | 15107 | .init_hook = alc861vd_lenovo_init_hook, |
Takashi Iwai | 13c9474 | 2008-11-05 08:06:08 +0100 | [diff] [blame] | 15108 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15109 | }; |
| 15110 | |
| 15111 | /* |
| 15112 | * BIOS auto configuration |
| 15113 | */ |
| 15114 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 15115 | hda_nid_t nid, int pin_type, int dac_idx) |
| 15116 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15117 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15118 | } |
| 15119 | |
| 15120 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 15121 | { |
| 15122 | struct alc_spec *spec = codec->spec; |
| 15123 | int i; |
| 15124 | |
| 15125 | for (i = 0; i <= HDA_SIDE; i++) { |
| 15126 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15127 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15128 | if (nid) |
| 15129 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 15130 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15131 | } |
| 15132 | } |
| 15133 | |
| 15134 | |
| 15135 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 15136 | { |
| 15137 | struct alc_spec *spec = codec->spec; |
| 15138 | hda_nid_t pin; |
| 15139 | |
| 15140 | pin = spec->autocfg.hp_pins[0]; |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 15141 | if (pin) /* connect to front and use dac 0 */ |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15142 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15143 | pin = spec->autocfg.speaker_pins[0]; |
| 15144 | if (pin) |
| 15145 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15146 | } |
| 15147 | |
| 15148 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 15149 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 15150 | |
| 15151 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 15152 | { |
| 15153 | struct alc_spec *spec = codec->spec; |
| 15154 | int i; |
| 15155 | |
| 15156 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 15157 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 15158 | if (alc861vd_is_input_pin(nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 15159 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 15160 | if (nid != ALC861VD_PIN_CD_NID && |
| 15161 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15162 | snd_hda_codec_write(codec, nid, 0, |
| 15163 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 15164 | AMP_OUT_MUTE); |
| 15165 | } |
| 15166 | } |
| 15167 | } |
| 15168 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15169 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src |
| 15170 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15171 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 15172 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 15173 | |
| 15174 | /* add playback controls from the parsed DAC table */ |
| 15175 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15176 | * different NIDs for mute/unmute switch and volume control */ |
| 15177 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 15178 | const struct auto_pin_cfg *cfg) |
| 15179 | { |
| 15180 | char name[32]; |
| 15181 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 15182 | hda_nid_t nid_v, nid_s; |
| 15183 | int i, err; |
| 15184 | |
| 15185 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15186 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15187 | continue; |
| 15188 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15189 | alc880_dac_to_idx( |
| 15190 | spec->multiout.dac_nids[i])); |
| 15191 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15192 | alc880_dac_to_idx( |
| 15193 | spec->multiout.dac_nids[i])); |
| 15194 | |
| 15195 | if (i == 2) { |
| 15196 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15197 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15198 | "Center Playback Volume", |
| 15199 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 15200 | HDA_OUTPUT)); |
| 15201 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15202 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15203 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 15204 | "LFE Playback Volume", |
| 15205 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 15206 | HDA_OUTPUT)); |
| 15207 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15208 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15209 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15210 | "Center Playback Switch", |
| 15211 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 15212 | HDA_INPUT)); |
| 15213 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15214 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15215 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 15216 | "LFE Playback Switch", |
| 15217 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 15218 | HDA_INPUT)); |
| 15219 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15220 | return err; |
| 15221 | } else { |
| 15222 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15223 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15224 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 15225 | HDA_OUTPUT)); |
| 15226 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15227 | return err; |
| 15228 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15229 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 15230 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15231 | HDA_INPUT)); |
| 15232 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15233 | return err; |
| 15234 | } |
| 15235 | } |
| 15236 | return 0; |
| 15237 | } |
| 15238 | |
| 15239 | /* add playback controls for speaker and HP outputs */ |
| 15240 | /* Based on ALC880 version. But ALC861VD has separate, |
| 15241 | * different NIDs for mute/unmute switch and volume control */ |
| 15242 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 15243 | hda_nid_t pin, const char *pfx) |
| 15244 | { |
| 15245 | hda_nid_t nid_v, nid_s; |
| 15246 | int err; |
| 15247 | char name[32]; |
| 15248 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15249 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15250 | return 0; |
| 15251 | |
| 15252 | if (alc880_is_fixed_pin(pin)) { |
| 15253 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 15254 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15255 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15256 | spec->multiout.hp_nid = nid_v; |
| 15257 | else |
| 15258 | spec->multiout.extra_out_nid[0] = nid_v; |
| 15259 | /* control HP volume/switch on the output mixer amp */ |
| 15260 | nid_v = alc861vd_idx_to_mixer_vol( |
| 15261 | alc880_fixed_pin_idx(pin)); |
| 15262 | nid_s = alc861vd_idx_to_mixer_switch( |
| 15263 | alc880_fixed_pin_idx(pin)); |
| 15264 | |
| 15265 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15266 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 15267 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 15268 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15269 | return err; |
| 15270 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15271 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 15272 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 15273 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15274 | return err; |
| 15275 | } else if (alc880_is_multi_pin(pin)) { |
| 15276 | /* set manual connection */ |
| 15277 | /* we have only a switch on HP-out PIN */ |
| 15278 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15279 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 15280 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 15281 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15282 | return err; |
| 15283 | } |
| 15284 | return 0; |
| 15285 | } |
| 15286 | |
| 15287 | /* parse the BIOS configuration and set up the alc_spec |
| 15288 | * return 1 if successful, 0 if the proper config is not found, |
| 15289 | * or a negative error code |
| 15290 | * Based on ALC880 version - had to change it to override |
| 15291 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 15292 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 15293 | { |
| 15294 | struct alc_spec *spec = codec->spec; |
| 15295 | int err; |
| 15296 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 15297 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15298 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 15299 | alc861vd_ignore); |
| 15300 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15301 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15302 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15303 | return 0; /* can't find valid BIOS pin config */ |
| 15304 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15305 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 15306 | if (err < 0) |
| 15307 | return err; |
| 15308 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 15309 | if (err < 0) |
| 15310 | return err; |
| 15311 | err = alc861vd_auto_create_extra_out(spec, |
| 15312 | spec->autocfg.speaker_pins[0], |
| 15313 | "Speaker"); |
| 15314 | if (err < 0) |
| 15315 | return err; |
| 15316 | err = alc861vd_auto_create_extra_out(spec, |
| 15317 | spec->autocfg.hp_pins[0], |
| 15318 | "Headphone"); |
| 15319 | if (err < 0) |
| 15320 | return err; |
| 15321 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 15322 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15323 | return err; |
| 15324 | |
| 15325 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 15326 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 15327 | if (spec->autocfg.dig_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15328 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 15329 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 15330 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15331 | add_mixer(spec, spec->kctls.list); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15332 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15333 | add_verb(spec, alc861vd_volume_init_verbs); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15334 | |
| 15335 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 15336 | spec->input_mux = &spec->private_imux[0]; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15337 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 15338 | err = alc_auto_add_mic_boost(codec); |
| 15339 | if (err < 0) |
| 15340 | return err; |
| 15341 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 15342 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 15343 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15344 | return 1; |
| 15345 | } |
| 15346 | |
| 15347 | /* additional initialization for auto-configuration model */ |
| 15348 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 15349 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15350 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15351 | alc861vd_auto_init_multi_out(codec); |
| 15352 | alc861vd_auto_init_hp_out(codec); |
| 15353 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 15354 | alc861vd_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 15355 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 15356 | alc_inithook(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15357 | } |
| 15358 | |
| 15359 | static int patch_alc861vd(struct hda_codec *codec) |
| 15360 | { |
| 15361 | struct alc_spec *spec; |
| 15362 | int err, board_config; |
| 15363 | |
| 15364 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 15365 | if (spec == NULL) |
| 15366 | return -ENOMEM; |
| 15367 | |
| 15368 | codec->spec = spec; |
| 15369 | |
| 15370 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 15371 | alc861vd_models, |
| 15372 | alc861vd_cfg_tbl); |
| 15373 | |
| 15374 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 15375 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 15376 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15377 | board_config = ALC861VD_AUTO; |
| 15378 | } |
| 15379 | |
| 15380 | if (board_config == ALC861VD_AUTO) { |
| 15381 | /* automatic parse from the BIOS config */ |
| 15382 | err = alc861vd_parse_auto_config(codec); |
| 15383 | if (err < 0) { |
| 15384 | alc_free(codec); |
| 15385 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 15386 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15387 | printk(KERN_INFO |
| 15388 | "hda_codec: Cannot set up configuration " |
| 15389 | "from BIOS. Using base mode...\n"); |
| 15390 | board_config = ALC861VD_3ST; |
| 15391 | } |
| 15392 | } |
| 15393 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 15394 | err = snd_hda_attach_beep_device(codec, 0x23); |
| 15395 | if (err < 0) { |
| 15396 | alc_free(codec); |
| 15397 | return err; |
| 15398 | } |
| 15399 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15400 | if (board_config != ALC861VD_AUTO) |
| 15401 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 15402 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15403 | if (codec->vendor_id == 0x10ec0660) { |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 15404 | /* always turn on EAPD */ |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 15405 | add_verb(spec, alc660vd_eapd_verbs); |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 15406 | } |
| 15407 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15408 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 15409 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 15410 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15411 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 15412 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 15413 | |
| 15414 | spec->adc_nids = alc861vd_adc_nids; |
| 15415 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15416 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15417 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 15418 | set_capture_mixer(spec); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 15419 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15420 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 15421 | spec->vmaster_nid = 0x02; |
| 15422 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15423 | codec->patch_ops = alc_patch_ops; |
| 15424 | |
| 15425 | if (board_config == ALC861VD_AUTO) |
| 15426 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15427 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 15428 | if (!spec->loopback.amplist) |
| 15429 | spec->loopback.amplist = alc861vd_loopbacks; |
| 15430 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 15431 | codec->proc_widget_hook = print_realtek_coef; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 15432 | |
| 15433 | return 0; |
| 15434 | } |
| 15435 | |
| 15436 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15437 | * ALC662 support |
| 15438 | * |
| 15439 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 15440 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 15441 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 15442 | * 6-channel independent captures. |
| 15443 | * |
| 15444 | * In addition, an independent DAC for the multi-playback (not used in this |
| 15445 | * driver yet). |
| 15446 | */ |
| 15447 | #define ALC662_DIGOUT_NID 0x06 |
| 15448 | #define ALC662_DIGIN_NID 0x0a |
| 15449 | |
| 15450 | static hda_nid_t alc662_dac_nids[4] = { |
| 15451 | /* front, rear, clfe, rear_surr */ |
| 15452 | 0x02, 0x03, 0x04 |
| 15453 | }; |
| 15454 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15455 | static hda_nid_t alc272_dac_nids[2] = { |
| 15456 | 0x02, 0x03 |
| 15457 | }; |
| 15458 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15459 | static hda_nid_t alc662_adc_nids[1] = { |
| 15460 | /* ADC1-2 */ |
| 15461 | 0x09, |
| 15462 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15463 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15464 | static hda_nid_t alc272_adc_nids[1] = { |
| 15465 | /* ADC1-2 */ |
| 15466 | 0x08, |
| 15467 | }; |
| 15468 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 15469 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 15470 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; |
| 15471 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 15472 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15473 | /* input MUX */ |
| 15474 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15475 | static struct hda_input_mux alc662_capture_source = { |
| 15476 | .num_items = 4, |
| 15477 | .items = { |
| 15478 | { "Mic", 0x0 }, |
| 15479 | { "Front Mic", 0x1 }, |
| 15480 | { "Line", 0x2 }, |
| 15481 | { "CD", 0x4 }, |
| 15482 | }, |
| 15483 | }; |
| 15484 | |
| 15485 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 15486 | .num_items = 2, |
| 15487 | .items = { |
| 15488 | { "Mic", 0x1 }, |
| 15489 | { "Line", 0x2 }, |
| 15490 | }, |
| 15491 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15492 | |
| 15493 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 15494 | .num_items = 2, |
| 15495 | .items = { |
| 15496 | { "i-Mic", 0x1 }, |
| 15497 | { "e-Mic", 0x0 }, |
| 15498 | }, |
| 15499 | }; |
| 15500 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15501 | static struct hda_input_mux alc663_capture_source = { |
| 15502 | .num_items = 3, |
| 15503 | .items = { |
| 15504 | { "Mic", 0x0 }, |
| 15505 | { "Front Mic", 0x1 }, |
| 15506 | { "Line", 0x2 }, |
| 15507 | }, |
| 15508 | }; |
| 15509 | |
| 15510 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 15511 | .num_items = 2, |
| 15512 | .items = { |
| 15513 | { "Ext-Mic", 0x0 }, |
| 15514 | { "D-Mic", 0x9 }, |
| 15515 | }, |
| 15516 | }; |
| 15517 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 15518 | #if 1 /* set to 0 for testing other input sources below */ |
| 15519 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15520 | .num_items = 2, |
| 15521 | .items = { |
| 15522 | { "Autoselect Mic", 0x0 }, |
| 15523 | { "Internal Mic", 0x1 }, |
| 15524 | }, |
| 15525 | }; |
| 15526 | #else |
| 15527 | static struct hda_input_mux alc272_nc10_capture_source = { |
| 15528 | .num_items = 16, |
| 15529 | .items = { |
| 15530 | { "Autoselect Mic", 0x0 }, |
| 15531 | { "Internal Mic", 0x1 }, |
| 15532 | { "In-0x02", 0x2 }, |
| 15533 | { "In-0x03", 0x3 }, |
| 15534 | { "In-0x04", 0x4 }, |
| 15535 | { "In-0x05", 0x5 }, |
| 15536 | { "In-0x06", 0x6 }, |
| 15537 | { "In-0x07", 0x7 }, |
| 15538 | { "In-0x08", 0x8 }, |
| 15539 | { "In-0x09", 0x9 }, |
| 15540 | { "In-0x0a", 0x0a }, |
| 15541 | { "In-0x0b", 0x0b }, |
| 15542 | { "In-0x0c", 0x0c }, |
| 15543 | { "In-0x0d", 0x0d }, |
| 15544 | { "In-0x0e", 0x0e }, |
| 15545 | { "In-0x0f", 0x0f }, |
| 15546 | }, |
| 15547 | }; |
| 15548 | #endif |
| 15549 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15550 | /* |
| 15551 | * 2ch mode |
| 15552 | */ |
| 15553 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 15554 | { 2, NULL } |
| 15555 | }; |
| 15556 | |
| 15557 | /* |
| 15558 | * 2ch mode |
| 15559 | */ |
| 15560 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 15561 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 15562 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15563 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 15564 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 15565 | { } /* end */ |
| 15566 | }; |
| 15567 | |
| 15568 | /* |
| 15569 | * 6ch mode |
| 15570 | */ |
| 15571 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 15572 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15573 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15574 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 15575 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15576 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 15577 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 15578 | { } /* end */ |
| 15579 | }; |
| 15580 | |
| 15581 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 15582 | { 2, alc662_3ST_ch2_init }, |
| 15583 | { 6, alc662_3ST_ch6_init }, |
| 15584 | }; |
| 15585 | |
| 15586 | /* |
| 15587 | * 2ch mode |
| 15588 | */ |
| 15589 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 15590 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15591 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 15592 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15593 | { } /* end */ |
| 15594 | }; |
| 15595 | |
| 15596 | /* |
| 15597 | * 6ch mode |
| 15598 | */ |
| 15599 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 15600 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15601 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15602 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 15603 | { } /* end */ |
| 15604 | }; |
| 15605 | |
| 15606 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 15607 | { 2, alc662_sixstack_ch6_init }, |
| 15608 | { 6, alc662_sixstack_ch8_init }, |
| 15609 | }; |
| 15610 | |
| 15611 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 15612 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 15613 | */ |
| 15614 | |
| 15615 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 15616 | /* output mixer control */ |
| 15617 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15618 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15619 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15620 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15621 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15622 | 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] | 15623 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15624 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15625 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15626 | |
| 15627 | /*Input mixer control */ |
| 15628 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 15629 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 15630 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 15631 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 15632 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 15633 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 15634 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 15635 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15636 | { } /* end */ |
| 15637 | }; |
| 15638 | |
| 15639 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 15640 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15641 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15642 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15643 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15644 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15645 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15646 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15647 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15648 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15649 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15650 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15651 | { } /* end */ |
| 15652 | }; |
| 15653 | |
| 15654 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 15655 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15656 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15657 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 15658 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15659 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15660 | 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] | 15661 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 15662 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15663 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15664 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 15665 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 15666 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15667 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15670 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15671 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15672 | { } /* end */ |
| 15673 | }; |
| 15674 | |
| 15675 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 15676 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15677 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 15678 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15679 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15680 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15681 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15682 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15684 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15685 | { } /* end */ |
| 15686 | }; |
| 15687 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15688 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15689 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15690 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15691 | |
| 15692 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 15693 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15694 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15695 | |
| 15696 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 15697 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15698 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15699 | { } /* end */ |
| 15700 | }; |
| 15701 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15702 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 15703 | ALC262_HIPPO_MASTER_SWITCH, |
| 15704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15705 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15706 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 15707 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15708 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 15709 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15710 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15711 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15712 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15713 | { } /* end */ |
| 15714 | }; |
| 15715 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15716 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { |
| 15717 | .ops = &snd_hda_bind_vol, |
| 15718 | .values = { |
| 15719 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15720 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 15721 | 0 |
| 15722 | }, |
| 15723 | }; |
| 15724 | |
| 15725 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { |
| 15726 | .ops = &snd_hda_bind_sw, |
| 15727 | .values = { |
| 15728 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15729 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15730 | 0 |
| 15731 | }, |
| 15732 | }; |
| 15733 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15734 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15735 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15736 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), |
| 15737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15739 | { } /* end */ |
| 15740 | }; |
| 15741 | |
| 15742 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { |
| 15743 | .ops = &snd_hda_bind_sw, |
| 15744 | .values = { |
| 15745 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15746 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15747 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 15748 | 0 |
| 15749 | }, |
| 15750 | }; |
| 15751 | |
| 15752 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { |
| 15753 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15754 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), |
| 15755 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15756 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15757 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15758 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15759 | |
| 15760 | { } /* end */ |
| 15761 | }; |
| 15762 | |
| 15763 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { |
| 15764 | .ops = &snd_hda_bind_sw, |
| 15765 | .values = { |
| 15766 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15767 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 15768 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 15769 | 0 |
| 15770 | }, |
| 15771 | }; |
| 15772 | |
| 15773 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { |
| 15774 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15775 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), |
| 15776 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15777 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15778 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15779 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15780 | { } /* end */ |
| 15781 | }; |
| 15782 | |
| 15783 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15784 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15785 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 15787 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15788 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15789 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15790 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15791 | { } /* end */ |
| 15792 | }; |
| 15793 | |
| 15794 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { |
| 15795 | .ops = &snd_hda_bind_vol, |
| 15796 | .values = { |
| 15797 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 15798 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), |
| 15799 | 0 |
| 15800 | }, |
| 15801 | }; |
| 15802 | |
| 15803 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { |
| 15804 | .ops = &snd_hda_bind_sw, |
| 15805 | .values = { |
| 15806 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 15807 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), |
| 15808 | 0 |
| 15809 | }, |
| 15810 | }; |
| 15811 | |
| 15812 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { |
| 15813 | HDA_BIND_VOL("Master Playback Volume", |
| 15814 | &alc663_asus_two_bind_master_vol), |
| 15815 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15816 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 15820 | { } /* end */ |
| 15821 | }; |
| 15822 | |
| 15823 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { |
| 15824 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), |
| 15825 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), |
| 15826 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15827 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15828 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15829 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15830 | { } /* end */ |
| 15831 | }; |
| 15832 | |
| 15833 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 15834 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15835 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15836 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 15837 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 15838 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15839 | |
| 15840 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15841 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15842 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15843 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15844 | { } /* end */ |
| 15845 | }; |
| 15846 | |
| 15847 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 15848 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 15849 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 15850 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 15851 | |
| 15852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 15853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 15854 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 15855 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 15856 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 15857 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 15858 | { } /* end */ |
| 15859 | }; |
| 15860 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15861 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 15862 | { |
| 15863 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 15864 | .name = "Channel Mode", |
| 15865 | .info = alc_ch_mode_info, |
| 15866 | .get = alc_ch_mode_get, |
| 15867 | .put = alc_ch_mode_put, |
| 15868 | }, |
| 15869 | { } /* end */ |
| 15870 | }; |
| 15871 | |
| 15872 | static struct hda_verb alc662_init_verbs[] = { |
| 15873 | /* ADC: mute amp left and right */ |
| 15874 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15875 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15876 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 15877 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15878 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15879 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15880 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15881 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15882 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15883 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15884 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15886 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15888 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15890 | |
| 15891 | /* Front Pin: output 0 (0x0c) */ |
| 15892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15894 | |
| 15895 | /* Rear Pin: output 1 (0x0d) */ |
| 15896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15897 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15898 | |
| 15899 | /* CLFE Pin: output 2 (0x0e) */ |
| 15900 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15901 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15902 | |
| 15903 | /* Mic (rear) pin: input vref at 80% */ |
| 15904 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15905 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15906 | /* Front Mic pin: input vref at 80% */ |
| 15907 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 15908 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15909 | /* Line In pin: input */ |
| 15910 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15911 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 15912 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 15913 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 15914 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 15915 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15916 | /* CD pin widget for input */ |
| 15917 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 15918 | |
| 15919 | /* FIXME: use matrix-type input source selection */ |
| 15920 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15921 | /* Input mixer */ |
| 15922 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15923 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 15924 | |
| 15925 | /* always trun on EAPD */ |
| 15926 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15927 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 15928 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15929 | { } |
| 15930 | }; |
| 15931 | |
| 15932 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 15933 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 15934 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 15935 | {} |
| 15936 | }; |
| 15937 | |
| 15938 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 15939 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 15940 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15941 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15942 | }; |
| 15943 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 15944 | /* Set Unsolicited Event*/ |
| 15945 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 15946 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 15947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 15948 | {} |
| 15949 | }; |
| 15950 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15951 | /* |
| 15952 | * generic initialization of ADC, input mixers and output mixers |
| 15953 | */ |
| 15954 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 15955 | /* |
| 15956 | * Unmute ADC and set the default input to mic-in |
| 15957 | */ |
| 15958 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 15959 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15960 | |
| 15961 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 15962 | * mixer widget |
| 15963 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 15964 | * panel mic (mic 2) |
| 15965 | */ |
| 15966 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 15967 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 15968 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 15969 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 15970 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 15971 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15972 | |
| 15973 | /* |
| 15974 | * Set up output mixers (0x0c - 0x0f) |
| 15975 | */ |
| 15976 | /* set vol=0 to output mixers */ |
| 15977 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15978 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15979 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 15980 | |
| 15981 | /* set up input amps for analog loopback */ |
| 15982 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 15983 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15984 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15985 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15986 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 15987 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 15988 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15989 | |
| 15990 | |
| 15991 | /* FIXME: use matrix-type input source selection */ |
| 15992 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 15993 | /* Input mixer */ |
| 15994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 15995 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 15996 | { } |
| 15997 | }; |
| 15998 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 15999 | /* additional verbs for ALC663 */ |
| 16000 | static struct hda_verb alc663_auto_init_verbs[] = { |
| 16001 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 16002 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16003 | { } |
| 16004 | }; |
| 16005 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16006 | static struct hda_verb alc663_m51va_init_verbs[] = { |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16007 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16008 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16009 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16010 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16011 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16012 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16013 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16014 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16015 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16016 | {} |
| 16017 | }; |
| 16018 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16019 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
| 16020 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16021 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16022 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16023 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16024 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16025 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16026 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16027 | {} |
| 16028 | }; |
| 16029 | |
| 16030 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { |
| 16031 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16032 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16033 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16035 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16036 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16037 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16038 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16039 | {} |
| 16040 | }; |
| 16041 | |
| 16042 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { |
| 16043 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16044 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16045 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16048 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16049 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16050 | {} |
| 16051 | }; |
| 16052 | |
| 16053 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { |
| 16054 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16055 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16056 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16057 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16058 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16059 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ |
| 16061 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16063 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16064 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16066 | {} |
| 16067 | }; |
| 16068 | |
| 16069 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { |
| 16070 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16071 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16072 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16073 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 16079 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16080 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16082 | {} |
| 16083 | }; |
| 16084 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16085 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 16086 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16087 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 16088 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 16089 | |
| 16090 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16091 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16092 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16093 | |
| 16094 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 16095 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 16096 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 16097 | {} |
| 16098 | }; |
| 16099 | |
| 16100 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 16101 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16102 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16103 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 16104 | |
| 16105 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16106 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16107 | {} |
| 16108 | }; |
| 16109 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16110 | static struct hda_verb alc662_ecs_init_verbs[] = { |
| 16111 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, |
| 16112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16113 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16114 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16115 | {} |
| 16116 | }; |
| 16117 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16118 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { |
| 16119 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16120 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16123 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16124 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16125 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16126 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16127 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16128 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16129 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16130 | {} |
| 16131 | }; |
| 16132 | |
| 16133 | static struct hda_verb alc272_dell_init_verbs[] = { |
| 16134 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16135 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16137 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 16138 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 16139 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 16140 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
| 16141 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 16142 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 16143 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 16144 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 16145 | {} |
| 16146 | }; |
| 16147 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16148 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
| 16149 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 16150 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 16151 | { } /* end */ |
| 16152 | }; |
| 16153 | |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16154 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { |
| 16155 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 16156 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 16157 | { } /* end */ |
| 16158 | }; |
| 16159 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16160 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 16161 | { |
| 16162 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16163 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16164 | |
| 16165 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 16166 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16167 | bits = present ? HDA_AMP_MUTE : 0; |
| 16168 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16169 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16170 | } |
| 16171 | |
| 16172 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 16173 | { |
| 16174 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16175 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16176 | |
| 16177 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16178 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 16179 | bits = present ? HDA_AMP_MUTE : 0; |
| 16180 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16181 | HDA_AMP_MUTE, bits); |
| 16182 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16183 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16184 | } |
| 16185 | |
| 16186 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 16187 | unsigned int res) |
| 16188 | { |
| 16189 | if ((res >> 26) == ALC880_HP_EVENT) |
| 16190 | alc662_lenovo_101e_all_automute(codec); |
| 16191 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 16192 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 16193 | } |
| 16194 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16195 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 16196 | { |
| 16197 | unsigned int present; |
| 16198 | |
| 16199 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 16200 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 16201 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16202 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16203 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16204 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 16205 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16206 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16207 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 16208 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 16209 | } |
| 16210 | |
| 16211 | /* unsolicited event for HP jack sensing */ |
| 16212 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 16213 | unsigned int res) |
| 16214 | { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16215 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 16216 | alc662_eeepc_mic_automute(codec); |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16217 | else |
| 16218 | alc262_hippo_unsol_event(codec, res); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16219 | } |
| 16220 | |
| 16221 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 16222 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16223 | alc262_hippo1_init_hook(codec); |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16224 | alc662_eeepc_mic_automute(codec); |
| 16225 | } |
| 16226 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16227 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 16228 | { |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16229 | struct alc_spec *spec = codec->spec; |
| 16230 | |
| 16231 | spec->autocfg.hp_pins[0] = 0x14; |
| 16232 | spec->autocfg.speaker_pins[0] = 0x1b; |
| 16233 | alc262_hippo_master_update(codec); |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16234 | } |
| 16235 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16236 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 16237 | { |
| 16238 | unsigned int present; |
| 16239 | unsigned char bits; |
| 16240 | |
| 16241 | present = snd_hda_codec_read(codec, 0x21, 0, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16242 | AC_VERB_GET_PIN_SENSE, 0) |
| 16243 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16244 | bits = present ? HDA_AMP_MUTE : 0; |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16245 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16246 | AMP_IN_MUTE(0), bits); |
| 16247 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16248 | AMP_IN_MUTE(0), bits); |
| 16249 | } |
| 16250 | |
| 16251 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) |
| 16252 | { |
| 16253 | unsigned int present; |
| 16254 | unsigned char bits; |
| 16255 | |
| 16256 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16257 | AC_VERB_GET_PIN_SENSE, 0) |
| 16258 | & AC_PINSENSE_PRESENCE; |
| 16259 | bits = present ? HDA_AMP_MUTE : 0; |
| 16260 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16261 | AMP_IN_MUTE(0), bits); |
| 16262 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16263 | AMP_IN_MUTE(0), bits); |
| 16264 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16265 | AMP_IN_MUTE(0), bits); |
| 16266 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16267 | AMP_IN_MUTE(0), bits); |
| 16268 | } |
| 16269 | |
| 16270 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) |
| 16271 | { |
| 16272 | unsigned int present; |
| 16273 | unsigned char bits; |
| 16274 | |
| 16275 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16276 | AC_VERB_GET_PIN_SENSE, 0) |
| 16277 | & AC_PINSENSE_PRESENCE; |
| 16278 | bits = present ? HDA_AMP_MUTE : 0; |
| 16279 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16280 | AMP_IN_MUTE(0), bits); |
| 16281 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16282 | AMP_IN_MUTE(0), bits); |
| 16283 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, |
| 16284 | AMP_IN_MUTE(0), bits); |
| 16285 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, |
| 16286 | AMP_IN_MUTE(0), bits); |
| 16287 | } |
| 16288 | |
| 16289 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) |
| 16290 | { |
| 16291 | unsigned int present; |
| 16292 | unsigned char bits; |
| 16293 | |
| 16294 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 16295 | AC_VERB_GET_PIN_SENSE, 0) |
| 16296 | & AC_PINSENSE_PRESENCE; |
| 16297 | bits = present ? 0 : PIN_OUT; |
| 16298 | snd_hda_codec_write(codec, 0x14, 0, |
| 16299 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); |
| 16300 | } |
| 16301 | |
| 16302 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) |
| 16303 | { |
| 16304 | unsigned int present1, present2; |
| 16305 | |
| 16306 | present1 = snd_hda_codec_read(codec, 0x21, 0, |
| 16307 | AC_VERB_GET_PIN_SENSE, 0) |
| 16308 | & AC_PINSENSE_PRESENCE; |
| 16309 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16310 | AC_VERB_GET_PIN_SENSE, 0) |
| 16311 | & AC_PINSENSE_PRESENCE; |
| 16312 | |
| 16313 | if (present1 || present2) { |
| 16314 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16315 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 16316 | } else { |
| 16317 | snd_hda_codec_write_cache(codec, 0x14, 0, |
| 16318 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 16319 | } |
| 16320 | } |
| 16321 | |
| 16322 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) |
| 16323 | { |
| 16324 | unsigned int present1, present2; |
| 16325 | |
| 16326 | present1 = snd_hda_codec_read(codec, 0x1b, 0, |
| 16327 | AC_VERB_GET_PIN_SENSE, 0) |
| 16328 | & AC_PINSENSE_PRESENCE; |
| 16329 | present2 = snd_hda_codec_read(codec, 0x15, 0, |
| 16330 | AC_VERB_GET_PIN_SENSE, 0) |
| 16331 | & AC_PINSENSE_PRESENCE; |
| 16332 | |
| 16333 | if (present1 || present2) { |
| 16334 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16335 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16336 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16337 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); |
| 16338 | } else { |
| 16339 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
| 16340 | AMP_IN_MUTE(0), 0); |
| 16341 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
| 16342 | AMP_IN_MUTE(0), 0); |
| 16343 | } |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16344 | } |
| 16345 | |
| 16346 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 16347 | { |
| 16348 | unsigned int present; |
| 16349 | |
| 16350 | present = snd_hda_codec_read(codec, 0x18, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16351 | AC_VERB_GET_PIN_SENSE, 0) |
| 16352 | & AC_PINSENSE_PRESENCE; |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16353 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16354 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16355 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16356 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16357 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16358 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16359 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 16360 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16361 | } |
| 16362 | |
| 16363 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 16364 | unsigned int res) |
| 16365 | { |
| 16366 | switch (res >> 26) { |
| 16367 | case ALC880_HP_EVENT: |
| 16368 | alc663_m51va_speaker_automute(codec); |
| 16369 | break; |
| 16370 | case ALC880_MIC_EVENT: |
| 16371 | alc663_m51va_mic_automute(codec); |
| 16372 | break; |
| 16373 | } |
| 16374 | } |
| 16375 | |
| 16376 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 16377 | { |
| 16378 | alc663_m51va_speaker_automute(codec); |
| 16379 | alc663_m51va_mic_automute(codec); |
| 16380 | } |
| 16381 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16382 | /* ***************** Mode1 ******************************/ |
| 16383 | static void alc663_mode1_unsol_event(struct hda_codec *codec, |
| 16384 | unsigned int res) |
| 16385 | { |
| 16386 | switch (res >> 26) { |
| 16387 | case ALC880_HP_EVENT: |
| 16388 | alc663_m51va_speaker_automute(codec); |
| 16389 | break; |
| 16390 | case ALC880_MIC_EVENT: |
| 16391 | alc662_eeepc_mic_automute(codec); |
| 16392 | break; |
| 16393 | } |
| 16394 | } |
| 16395 | |
| 16396 | static void alc663_mode1_inithook(struct hda_codec *codec) |
| 16397 | { |
| 16398 | alc663_m51va_speaker_automute(codec); |
| 16399 | alc662_eeepc_mic_automute(codec); |
| 16400 | } |
| 16401 | /* ***************** Mode2 ******************************/ |
| 16402 | static void alc662_mode2_unsol_event(struct hda_codec *codec, |
| 16403 | unsigned int res) |
| 16404 | { |
| 16405 | switch (res >> 26) { |
| 16406 | case ALC880_HP_EVENT: |
| 16407 | alc662_f5z_speaker_automute(codec); |
| 16408 | break; |
| 16409 | case ALC880_MIC_EVENT: |
| 16410 | alc662_eeepc_mic_automute(codec); |
| 16411 | break; |
| 16412 | } |
| 16413 | } |
| 16414 | |
| 16415 | static void alc662_mode2_inithook(struct hda_codec *codec) |
| 16416 | { |
| 16417 | alc662_f5z_speaker_automute(codec); |
| 16418 | alc662_eeepc_mic_automute(codec); |
| 16419 | } |
| 16420 | /* ***************** Mode3 ******************************/ |
| 16421 | static void alc663_mode3_unsol_event(struct hda_codec *codec, |
| 16422 | unsigned int res) |
| 16423 | { |
| 16424 | switch (res >> 26) { |
| 16425 | case ALC880_HP_EVENT: |
| 16426 | alc663_two_hp_m1_speaker_automute(codec); |
| 16427 | break; |
| 16428 | case ALC880_MIC_EVENT: |
| 16429 | alc662_eeepc_mic_automute(codec); |
| 16430 | break; |
| 16431 | } |
| 16432 | } |
| 16433 | |
| 16434 | static void alc663_mode3_inithook(struct hda_codec *codec) |
| 16435 | { |
| 16436 | alc663_two_hp_m1_speaker_automute(codec); |
| 16437 | alc662_eeepc_mic_automute(codec); |
| 16438 | } |
| 16439 | /* ***************** Mode4 ******************************/ |
| 16440 | static void alc663_mode4_unsol_event(struct hda_codec *codec, |
| 16441 | unsigned int res) |
| 16442 | { |
| 16443 | switch (res >> 26) { |
| 16444 | case ALC880_HP_EVENT: |
| 16445 | alc663_21jd_two_speaker_automute(codec); |
| 16446 | break; |
| 16447 | case ALC880_MIC_EVENT: |
| 16448 | alc662_eeepc_mic_automute(codec); |
| 16449 | break; |
| 16450 | } |
| 16451 | } |
| 16452 | |
| 16453 | static void alc663_mode4_inithook(struct hda_codec *codec) |
| 16454 | { |
| 16455 | alc663_21jd_two_speaker_automute(codec); |
| 16456 | alc662_eeepc_mic_automute(codec); |
| 16457 | } |
| 16458 | /* ***************** Mode5 ******************************/ |
| 16459 | static void alc663_mode5_unsol_event(struct hda_codec *codec, |
| 16460 | unsigned int res) |
| 16461 | { |
| 16462 | switch (res >> 26) { |
| 16463 | case ALC880_HP_EVENT: |
| 16464 | alc663_15jd_two_speaker_automute(codec); |
| 16465 | break; |
| 16466 | case ALC880_MIC_EVENT: |
| 16467 | alc662_eeepc_mic_automute(codec); |
| 16468 | break; |
| 16469 | } |
| 16470 | } |
| 16471 | |
| 16472 | static void alc663_mode5_inithook(struct hda_codec *codec) |
| 16473 | { |
| 16474 | alc663_15jd_two_speaker_automute(codec); |
| 16475 | alc662_eeepc_mic_automute(codec); |
| 16476 | } |
| 16477 | /* ***************** Mode6 ******************************/ |
| 16478 | static void alc663_mode6_unsol_event(struct hda_codec *codec, |
| 16479 | unsigned int res) |
| 16480 | { |
| 16481 | switch (res >> 26) { |
| 16482 | case ALC880_HP_EVENT: |
| 16483 | alc663_two_hp_m2_speaker_automute(codec); |
| 16484 | break; |
| 16485 | case ALC880_MIC_EVENT: |
| 16486 | alc662_eeepc_mic_automute(codec); |
| 16487 | break; |
| 16488 | } |
| 16489 | } |
| 16490 | |
| 16491 | static void alc663_mode6_inithook(struct hda_codec *codec) |
| 16492 | { |
| 16493 | alc663_two_hp_m2_speaker_automute(codec); |
| 16494 | alc662_eeepc_mic_automute(codec); |
| 16495 | } |
| 16496 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16497 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 16498 | { |
| 16499 | unsigned int present; |
| 16500 | unsigned char bits; |
| 16501 | |
| 16502 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 16503 | AC_VERB_GET_PIN_SENSE, 0) |
| 16504 | & AC_PINSENSE_PRESENCE; |
| 16505 | bits = present ? HDA_AMP_MUTE : 0; |
| 16506 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 16507 | HDA_AMP_MUTE, bits); |
| 16508 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16509 | HDA_AMP_MUTE, bits); |
| 16510 | } |
| 16511 | |
| 16512 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 16513 | { |
| 16514 | unsigned int present; |
| 16515 | unsigned char bits; |
| 16516 | |
| 16517 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 16518 | AC_VERB_GET_PIN_SENSE, 0) |
| 16519 | & AC_PINSENSE_PRESENCE; |
| 16520 | bits = present ? HDA_AMP_MUTE : 0; |
| 16521 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 16522 | HDA_AMP_MUTE, bits); |
| 16523 | } |
| 16524 | |
| 16525 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 16526 | unsigned int res) |
| 16527 | { |
| 16528 | switch (res >> 26) { |
| 16529 | case ALC880_HP_EVENT: |
| 16530 | alc663_g71v_hp_automute(codec); |
| 16531 | break; |
| 16532 | case ALC880_FRONT_EVENT: |
| 16533 | alc663_g71v_front_automute(codec); |
| 16534 | break; |
| 16535 | case ALC880_MIC_EVENT: |
| 16536 | alc662_eeepc_mic_automute(codec); |
| 16537 | break; |
| 16538 | } |
| 16539 | } |
| 16540 | |
| 16541 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 16542 | { |
| 16543 | alc663_g71v_front_automute(codec); |
| 16544 | alc663_g71v_hp_automute(codec); |
| 16545 | alc662_eeepc_mic_automute(codec); |
| 16546 | } |
| 16547 | |
| 16548 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 16549 | unsigned int res) |
| 16550 | { |
| 16551 | switch (res >> 26) { |
| 16552 | case ALC880_HP_EVENT: |
| 16553 | alc663_m51va_speaker_automute(codec); |
| 16554 | break; |
| 16555 | case ALC880_MIC_EVENT: |
| 16556 | alc662_eeepc_mic_automute(codec); |
| 16557 | break; |
| 16558 | } |
| 16559 | } |
| 16560 | |
| 16561 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 16562 | { |
| 16563 | alc663_m51va_speaker_automute(codec); |
| 16564 | alc662_eeepc_mic_automute(codec); |
| 16565 | } |
| 16566 | |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16567 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { |
| 16568 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16569 | ALC262_HIPPO_MASTER_SWITCH, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16570 | |
| 16571 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), |
| 16572 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16573 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16574 | |
| 16575 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 16576 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16577 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16578 | { } /* end */ |
| 16579 | }; |
| 16580 | |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16581 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { |
| 16582 | /* Master Playback automatically created from Speaker and Headphone */ |
| 16583 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 16584 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 16585 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 16586 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 16587 | |
| 16588 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 16589 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 16590 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 16591 | |
| 16592 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 16593 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 16594 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 16595 | { } /* end */ |
| 16596 | }; |
| 16597 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 16598 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 16599 | #define alc662_loopbacks alc880_loopbacks |
| 16600 | #endif |
| 16601 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16602 | |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 16603 | /* pcm configuration: identical with ALC880 */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16604 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 16605 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 16606 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 16607 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 16608 | |
| 16609 | /* |
| 16610 | * configuration and preset |
| 16611 | */ |
| 16612 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 16613 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 16614 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 16615 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 16616 | [ALC662_5ST_DIG] = "6stack-dig", |
| 16617 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 16618 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16619 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16620 | [ALC662_ECS] = "ecs", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16621 | [ALC663_ASUS_M51VA] = "m51va", |
| 16622 | [ALC663_ASUS_G71V] = "g71v", |
| 16623 | [ALC663_ASUS_H13] = "h13", |
| 16624 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16625 | [ALC663_ASUS_MODE1] = "asus-mode1", |
| 16626 | [ALC662_ASUS_MODE2] = "asus-mode2", |
| 16627 | [ALC663_ASUS_MODE3] = "asus-mode3", |
| 16628 | [ALC663_ASUS_MODE4] = "asus-mode4", |
| 16629 | [ALC663_ASUS_MODE5] = "asus-mode5", |
| 16630 | [ALC663_ASUS_MODE6] = "asus-mode6", |
Takashi Iwai | 01f2bd4 | 2009-05-11 08:12:43 +0200 | [diff] [blame] | 16631 | [ALC272_DELL] = "dell", |
| 16632 | [ALC272_DELL_ZM1] = "dell-zm1", |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16633 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16634 | [ALC662_AUTO] = "auto", |
| 16635 | }; |
| 16636 | |
| 16637 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16638 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16639 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), |
| 16640 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16641 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
| 16642 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
| 16643 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
| 16644 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16645 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16646 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
| 16647 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
| 16648 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
| 16649 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
| 16650 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
| 16651 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
| 16652 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16653 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
| 16654 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
| 16655 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16656 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
| 16657 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
| 16658 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
| 16659 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16660 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16661 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
| 16662 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16663 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16664 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
| 16665 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
| 16666 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16667 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), |
| 16668 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), |
| 16669 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16670 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
| 16671 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), |
| 16672 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16673 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16674 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), |
| 16675 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16676 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16677 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), |
Kailang Yang | 80ffe86 | 2008-10-15 11:23:27 +0200 | [diff] [blame] | 16678 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16679 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ |
| 16680 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), |
| 16681 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16682 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16683 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), |
| 16684 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 16685 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16686 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16687 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16688 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
Herton Ronaldo Krzesinski | 95fe5f2 | 2008-09-26 23:48:45 -0300 | [diff] [blame] | 16689 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
| 16690 | ALC662_3ST_6ch_DIG), |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16691 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), |
Herton Ronaldo Krzesinski | cb55974 | 2008-09-26 23:47:45 -0300 | [diff] [blame] | 16692 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
| 16693 | ALC662_3ST_6ch_DIG), |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16694 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
Takashi Iwai | 5bd3729 | 2009-04-21 18:36:30 +0200 | [diff] [blame] | 16695 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16696 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Takashi Iwai | 238713d | 2008-10-05 10:57:39 +0200 | [diff] [blame] | 16697 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
Vedran Miletic | 19c009a | 2008-09-29 20:29:25 +0200 | [diff] [blame] | 16698 | ALC662_3ST_6ch_DIG), |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 16699 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
| 16700 | ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16701 | {} |
| 16702 | }; |
| 16703 | |
| 16704 | static struct alc_config_preset alc662_presets[] = { |
| 16705 | [ALC662_3ST_2ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16706 | .mixers = { alc662_3ST_2ch_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16707 | .init_verbs = { alc662_init_verbs }, |
| 16708 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16709 | .dac_nids = alc662_dac_nids, |
| 16710 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16711 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16712 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16713 | .channel_mode = alc662_3ST_2ch_modes, |
| 16714 | .input_mux = &alc662_capture_source, |
| 16715 | }, |
| 16716 | [ALC662_3ST_6ch_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16717 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16718 | .init_verbs = { alc662_init_verbs }, |
| 16719 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16720 | .dac_nids = alc662_dac_nids, |
| 16721 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16722 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16723 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16724 | .channel_mode = alc662_3ST_6ch_modes, |
| 16725 | .need_dac_fix = 1, |
| 16726 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16727 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16728 | [ALC662_3ST_6ch] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16729 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16730 | .init_verbs = { alc662_init_verbs }, |
| 16731 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16732 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16733 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16734 | .channel_mode = alc662_3ST_6ch_modes, |
| 16735 | .need_dac_fix = 1, |
| 16736 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 16737 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16738 | [ALC662_5ST_DIG] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16739 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16740 | .init_verbs = { alc662_init_verbs }, |
| 16741 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16742 | .dac_nids = alc662_dac_nids, |
| 16743 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16744 | .dig_in_nid = ALC662_DIGIN_NID, |
| 16745 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 16746 | .channel_mode = alc662_5stack_modes, |
| 16747 | .input_mux = &alc662_capture_source, |
| 16748 | }, |
| 16749 | [ALC662_LENOVO_101E] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16750 | .mixers = { alc662_lenovo_101e_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16751 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 16752 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16753 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16754 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16755 | .channel_mode = alc662_3ST_2ch_modes, |
| 16756 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 16757 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 16758 | .init_hook = alc662_lenovo_101e_all_automute, |
| 16759 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16760 | [ALC662_ASUS_EEEPC_P701] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16761 | .mixers = { alc662_eeepc_p701_mixer }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16762 | .init_verbs = { alc662_init_verbs, |
| 16763 | alc662_eeepc_sue_init_verbs }, |
| 16764 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16765 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 16766 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16767 | .channel_mode = alc662_3ST_2ch_modes, |
| 16768 | .input_mux = &alc662_eeepc_capture_source, |
| 16769 | .unsol_event = alc662_eeepc_unsol_event, |
| 16770 | .init_hook = alc662_eeepc_inithook, |
| 16771 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16772 | [ALC662_ASUS_EEEPC_EP20] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16773 | .mixers = { alc662_eeepc_ep20_mixer, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16774 | alc662_chmode_mixer }, |
| 16775 | .init_verbs = { alc662_init_verbs, |
| 16776 | alc662_eeepc_ep20_sue_init_verbs }, |
| 16777 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16778 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16779 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16780 | .channel_mode = alc662_3ST_6ch_modes, |
| 16781 | .input_mux = &alc662_lenovo_101e_capture_source, |
Takashi Iwai | 42171c1 | 2009-05-08 14:11:43 +0200 | [diff] [blame] | 16782 | .unsol_event = alc662_eeepc_unsol_event, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 16783 | .init_hook = alc662_eeepc_ep20_inithook, |
| 16784 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16785 | [ALC662_ECS] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16786 | .mixers = { alc662_ecs_mixer }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16787 | .init_verbs = { alc662_init_verbs, |
| 16788 | alc662_ecs_init_verbs }, |
| 16789 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16790 | .dac_nids = alc662_dac_nids, |
| 16791 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16792 | .channel_mode = alc662_3ST_2ch_modes, |
| 16793 | .input_mux = &alc662_eeepc_capture_source, |
| 16794 | .unsol_event = alc662_eeepc_unsol_event, |
| 16795 | .init_hook = alc662_eeepc_inithook, |
| 16796 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16797 | [ALC663_ASUS_M51VA] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16798 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16799 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16800 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16801 | .dac_nids = alc662_dac_nids, |
| 16802 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16803 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16804 | .channel_mode = alc662_3ST_2ch_modes, |
| 16805 | .input_mux = &alc663_m51va_capture_source, |
| 16806 | .unsol_event = alc663_m51va_unsol_event, |
| 16807 | .init_hook = alc663_m51va_inithook, |
| 16808 | }, |
| 16809 | [ALC663_ASUS_G71V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16810 | .mixers = { alc663_g71v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16811 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 16812 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16813 | .dac_nids = alc662_dac_nids, |
| 16814 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16815 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16816 | .channel_mode = alc662_3ST_2ch_modes, |
| 16817 | .input_mux = &alc662_eeepc_capture_source, |
| 16818 | .unsol_event = alc663_g71v_unsol_event, |
| 16819 | .init_hook = alc663_g71v_inithook, |
| 16820 | }, |
| 16821 | [ALC663_ASUS_H13] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16822 | .mixers = { alc663_m51va_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16823 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 16824 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16825 | .dac_nids = alc662_dac_nids, |
| 16826 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16827 | .channel_mode = alc662_3ST_2ch_modes, |
| 16828 | .input_mux = &alc663_m51va_capture_source, |
| 16829 | .unsol_event = alc663_m51va_unsol_event, |
| 16830 | .init_hook = alc663_m51va_inithook, |
| 16831 | }, |
| 16832 | [ALC663_ASUS_G50V] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16833 | .mixers = { alc663_g50v_mixer }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 16834 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 16835 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16836 | .dac_nids = alc662_dac_nids, |
| 16837 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16838 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 16839 | .channel_mode = alc662_3ST_6ch_modes, |
| 16840 | .input_mux = &alc663_capture_source, |
| 16841 | .unsol_event = alc663_g50v_unsol_event, |
| 16842 | .init_hook = alc663_g50v_inithook, |
| 16843 | }, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16844 | [ALC663_ASUS_MODE1] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16845 | .mixers = { alc663_m51va_mixer }, |
| 16846 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16847 | .init_verbs = { alc662_init_verbs, |
| 16848 | alc663_21jd_amic_init_verbs }, |
| 16849 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16850 | .hp_nid = 0x03, |
| 16851 | .dac_nids = alc662_dac_nids, |
| 16852 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16853 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16854 | .channel_mode = alc662_3ST_2ch_modes, |
| 16855 | .input_mux = &alc662_eeepc_capture_source, |
| 16856 | .unsol_event = alc663_mode1_unsol_event, |
| 16857 | .init_hook = alc663_mode1_inithook, |
| 16858 | }, |
| 16859 | [ALC662_ASUS_MODE2] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16860 | .mixers = { alc662_1bjd_mixer }, |
| 16861 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16862 | .init_verbs = { alc662_init_verbs, |
| 16863 | alc662_1bjd_amic_init_verbs }, |
| 16864 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16865 | .dac_nids = alc662_dac_nids, |
| 16866 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16867 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16868 | .channel_mode = alc662_3ST_2ch_modes, |
| 16869 | .input_mux = &alc662_eeepc_capture_source, |
| 16870 | .unsol_event = alc662_mode2_unsol_event, |
| 16871 | .init_hook = alc662_mode2_inithook, |
| 16872 | }, |
| 16873 | [ALC663_ASUS_MODE3] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16874 | .mixers = { alc663_two_hp_m1_mixer }, |
| 16875 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16876 | .init_verbs = { alc662_init_verbs, |
| 16877 | alc663_two_hp_amic_m1_init_verbs }, |
| 16878 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16879 | .hp_nid = 0x03, |
| 16880 | .dac_nids = alc662_dac_nids, |
| 16881 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16882 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16883 | .channel_mode = alc662_3ST_2ch_modes, |
| 16884 | .input_mux = &alc662_eeepc_capture_source, |
| 16885 | .unsol_event = alc663_mode3_unsol_event, |
| 16886 | .init_hook = alc663_mode3_inithook, |
| 16887 | }, |
| 16888 | [ALC663_ASUS_MODE4] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16889 | .mixers = { alc663_asus_21jd_clfe_mixer }, |
| 16890 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16891 | .init_verbs = { alc662_init_verbs, |
| 16892 | alc663_21jd_amic_init_verbs}, |
| 16893 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16894 | .hp_nid = 0x03, |
| 16895 | .dac_nids = alc662_dac_nids, |
| 16896 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16897 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16898 | .channel_mode = alc662_3ST_2ch_modes, |
| 16899 | .input_mux = &alc662_eeepc_capture_source, |
| 16900 | .unsol_event = alc663_mode4_unsol_event, |
| 16901 | .init_hook = alc663_mode4_inithook, |
| 16902 | }, |
| 16903 | [ALC663_ASUS_MODE5] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16904 | .mixers = { alc663_asus_15jd_clfe_mixer }, |
| 16905 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16906 | .init_verbs = { alc662_init_verbs, |
| 16907 | alc663_15jd_amic_init_verbs }, |
| 16908 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16909 | .hp_nid = 0x03, |
| 16910 | .dac_nids = alc662_dac_nids, |
| 16911 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16912 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16913 | .channel_mode = alc662_3ST_2ch_modes, |
| 16914 | .input_mux = &alc662_eeepc_capture_source, |
| 16915 | .unsol_event = alc663_mode5_unsol_event, |
| 16916 | .init_hook = alc663_mode5_inithook, |
| 16917 | }, |
| 16918 | [ALC663_ASUS_MODE6] = { |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 16919 | .mixers = { alc663_two_hp_m2_mixer }, |
| 16920 | .cap_mixer = alc662_auto_capture_mixer, |
Kailang Yang | f1d4e28 | 2008-08-26 14:03:29 +0200 | [diff] [blame] | 16921 | .init_verbs = { alc662_init_verbs, |
| 16922 | alc663_two_hp_amic_m2_init_verbs }, |
| 16923 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 16924 | .hp_nid = 0x03, |
| 16925 | .dac_nids = alc662_dac_nids, |
| 16926 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 16927 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16928 | .channel_mode = alc662_3ST_2ch_modes, |
| 16929 | .input_mux = &alc662_eeepc_capture_source, |
| 16930 | .unsol_event = alc663_mode6_unsol_event, |
| 16931 | .init_hook = alc663_mode6_inithook, |
| 16932 | }, |
Kailang Yang | 622e84c | 2009-04-21 07:39:04 +0200 | [diff] [blame] | 16933 | [ALC272_DELL] = { |
| 16934 | .mixers = { alc663_m51va_mixer }, |
| 16935 | .cap_mixer = alc272_auto_capture_mixer, |
| 16936 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, |
| 16937 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16938 | .dac_nids = alc662_dac_nids, |
| 16939 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16940 | .adc_nids = alc272_adc_nids, |
| 16941 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), |
| 16942 | .capsrc_nids = alc272_capsrc_nids, |
| 16943 | .channel_mode = alc662_3ST_2ch_modes, |
| 16944 | .input_mux = &alc663_m51va_capture_source, |
| 16945 | .unsol_event = alc663_m51va_unsol_event, |
| 16946 | .init_hook = alc663_m51va_inithook, |
| 16947 | }, |
| 16948 | [ALC272_DELL_ZM1] = { |
| 16949 | .mixers = { alc663_m51va_mixer }, |
| 16950 | .cap_mixer = alc662_auto_capture_mixer, |
| 16951 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, |
| 16952 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16953 | .dac_nids = alc662_dac_nids, |
| 16954 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16955 | .adc_nids = alc662_adc_nids, |
| 16956 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 16957 | .capsrc_nids = alc662_capsrc_nids, |
| 16958 | .channel_mode = alc662_3ST_2ch_modes, |
| 16959 | .input_mux = &alc663_m51va_capture_source, |
| 16960 | .unsol_event = alc663_m51va_unsol_event, |
| 16961 | .init_hook = alc663_m51va_inithook, |
| 16962 | }, |
Chris Pockelé | 9541ba1 | 2009-05-12 08:08:53 +0200 | [diff] [blame] | 16963 | [ALC272_SAMSUNG_NC10] = { |
| 16964 | .mixers = { alc272_nc10_mixer }, |
| 16965 | .init_verbs = { alc662_init_verbs, |
| 16966 | alc663_21jd_amic_init_verbs }, |
| 16967 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), |
| 16968 | .dac_nids = alc272_dac_nids, |
| 16969 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 16970 | .channel_mode = alc662_3ST_2ch_modes, |
| 16971 | .input_mux = &alc272_nc10_capture_source, |
| 16972 | .unsol_event = alc663_mode4_unsol_event, |
| 16973 | .init_hook = alc663_mode4_inithook, |
| 16974 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16975 | }; |
| 16976 | |
| 16977 | |
| 16978 | /* |
| 16979 | * BIOS auto configuration |
| 16980 | */ |
| 16981 | |
| 16982 | /* add playback controls from the parsed DAC table */ |
| 16983 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 16984 | const struct auto_pin_cfg *cfg) |
| 16985 | { |
| 16986 | char name[32]; |
| 16987 | static const char *chname[4] = { |
| 16988 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 16989 | }; |
| 16990 | hda_nid_t nid; |
| 16991 | int i, err; |
| 16992 | |
| 16993 | for (i = 0; i < cfg->line_outs; i++) { |
| 16994 | if (!spec->multiout.dac_nids[i]) |
| 16995 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 16996 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 16997 | if (i == 2) { |
| 16998 | /* Center/LFE */ |
| 16999 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17000 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17001 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 17002 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17003 | if (err < 0) |
| 17004 | return err; |
| 17005 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 17006 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17007 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 17008 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17009 | if (err < 0) |
| 17010 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17011 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17012 | "Center Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17013 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17014 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17015 | if (err < 0) |
| 17016 | return err; |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17017 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17018 | "LFE Playback Switch", |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17019 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17020 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17021 | if (err < 0) |
| 17022 | return err; |
| 17023 | } else { |
| 17024 | sprintf(name, "%s Playback Volume", chname[i]); |
| 17025 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17026 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 17027 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17028 | if (err < 0) |
| 17029 | return err; |
| 17030 | sprintf(name, "%s Playback Switch", chname[i]); |
Herton Ronaldo Krzesinski | b69ce01 | 2008-09-18 16:41:49 -0300 | [diff] [blame] | 17031 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17032 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
| 17033 | 3, 0, HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17034 | if (err < 0) |
| 17035 | return err; |
| 17036 | } |
| 17037 | } |
| 17038 | return 0; |
| 17039 | } |
| 17040 | |
| 17041 | /* add playback controls for speaker and HP outputs */ |
| 17042 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 17043 | const char *pfx) |
| 17044 | { |
| 17045 | hda_nid_t nid; |
| 17046 | int err; |
| 17047 | char name[32]; |
| 17048 | |
| 17049 | if (!pin) |
| 17050 | return 0; |
| 17051 | |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17052 | if (pin == 0x17) { |
| 17053 | /* ALC663 has a mono output pin on 0x17 */ |
| 17054 | sprintf(name, "%s Playback Switch", pfx); |
| 17055 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17056 | HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT)); |
| 17057 | return err; |
| 17058 | } |
| 17059 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17060 | if (alc880_is_fixed_pin(pin)) { |
| 17061 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 939778a | 2009-02-05 15:57:55 +0100 | [diff] [blame] | 17062 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17063 | /* specify the DAC as the extra output */ |
| 17064 | if (!spec->multiout.hp_nid) |
| 17065 | spec->multiout.hp_nid = nid; |
| 17066 | else |
| 17067 | spec->multiout.extra_out_nid[0] = nid; |
| 17068 | /* control HP volume/switch on the output mixer amp */ |
| 17069 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 17070 | sprintf(name, "%s Playback Volume", pfx); |
| 17071 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 17072 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 17073 | if (err < 0) |
| 17074 | return err; |
| 17075 | sprintf(name, "%s Playback Switch", pfx); |
| 17076 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 17077 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 17078 | if (err < 0) |
| 17079 | return err; |
| 17080 | } else if (alc880_is_multi_pin(pin)) { |
| 17081 | /* set manual connection */ |
| 17082 | /* we have only a switch on HP-out PIN */ |
| 17083 | sprintf(name, "%s Playback Switch", pfx); |
| 17084 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 17085 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 17086 | if (err < 0) |
| 17087 | return err; |
| 17088 | } |
| 17089 | return 0; |
| 17090 | } |
| 17091 | |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17092 | /* return the index of the src widget from the connection list of the nid. |
| 17093 | * return -1 if not found |
| 17094 | */ |
| 17095 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, |
| 17096 | hda_nid_t src) |
| 17097 | { |
| 17098 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; |
| 17099 | int i, conns; |
| 17100 | |
| 17101 | conns = snd_hda_get_connections(codec, nid, conn_list, |
| 17102 | ARRAY_SIZE(conn_list)); |
| 17103 | if (conns < 0) |
| 17104 | return -1; |
| 17105 | for (i = 0; i < conns; i++) |
| 17106 | if (conn_list[i] == src) |
| 17107 | return i; |
| 17108 | return -1; |
| 17109 | } |
| 17110 | |
| 17111 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) |
| 17112 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 17113 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17114 | return (pincap & AC_PINCAP_IN) != 0; |
| 17115 | } |
| 17116 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17117 | /* create playback/capture controls for input pins */ |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17118 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17119 | const struct auto_pin_cfg *cfg) |
| 17120 | { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17121 | struct alc_spec *spec = codec->spec; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17122 | struct hda_input_mux *imux = &spec->private_imux[0]; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17123 | int i, err, idx; |
| 17124 | |
| 17125 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17126 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
| 17127 | idx = alc662_input_pin_idx(codec, 0x0b, |
| 17128 | cfg->input_pins[i]); |
| 17129 | if (idx >= 0) { |
| 17130 | err = new_analog_input(spec, cfg->input_pins[i], |
| 17131 | auto_pin_cfg_labels[i], |
| 17132 | idx, 0x0b); |
| 17133 | if (err < 0) |
| 17134 | return err; |
| 17135 | } |
| 17136 | idx = alc662_input_pin_idx(codec, 0x22, |
| 17137 | cfg->input_pins[i]); |
| 17138 | if (idx >= 0) { |
| 17139 | imux->items[imux->num_items].label = |
| 17140 | auto_pin_cfg_labels[i]; |
| 17141 | imux->items[imux->num_items].index = idx; |
| 17142 | imux->num_items++; |
| 17143 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17144 | } |
| 17145 | } |
| 17146 | return 0; |
| 17147 | } |
| 17148 | |
| 17149 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 17150 | hda_nid_t nid, int pin_type, |
| 17151 | int dac_idx) |
| 17152 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17153 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17154 | /* need the manual connection? */ |
| 17155 | if (alc880_is_multi_pin(nid)) { |
| 17156 | struct alc_spec *spec = codec->spec; |
| 17157 | int idx = alc880_multi_pin_idx(nid); |
| 17158 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 17159 | AC_VERB_SET_CONNECT_SEL, |
| 17160 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 17161 | } |
| 17162 | } |
| 17163 | |
| 17164 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 17165 | { |
| 17166 | struct alc_spec *spec = codec->spec; |
| 17167 | int i; |
| 17168 | |
| 17169 | for (i = 0; i <= HDA_SIDE; i++) { |
| 17170 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17171 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17172 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 17173 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17174 | i); |
| 17175 | } |
| 17176 | } |
| 17177 | |
| 17178 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 17179 | { |
| 17180 | struct alc_spec *spec = codec->spec; |
| 17181 | hda_nid_t pin; |
| 17182 | |
| 17183 | pin = spec->autocfg.hp_pins[0]; |
| 17184 | if (pin) /* connect to front */ |
| 17185 | /* use dac 0 */ |
| 17186 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17187 | pin = spec->autocfg.speaker_pins[0]; |
| 17188 | if (pin) |
| 17189 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17190 | } |
| 17191 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17192 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 17193 | |
| 17194 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 17195 | { |
| 17196 | struct alc_spec *spec = codec->spec; |
| 17197 | int i; |
| 17198 | |
| 17199 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 17200 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17201 | if (alc662_is_input_pin(codec, nid)) { |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 17202 | alc_set_input_pin(codec, nid, i); |
Takashi Iwai | 52ca15b | 2009-03-23 12:51:55 +0100 | [diff] [blame] | 17203 | if (nid != ALC662_PIN_CD_NID && |
Takashi Iwai | e82c025 | 2009-03-23 15:17:38 +0100 | [diff] [blame] | 17204 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17205 | snd_hda_codec_write(codec, nid, 0, |
| 17206 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 17207 | AMP_OUT_MUTE); |
| 17208 | } |
| 17209 | } |
| 17210 | } |
| 17211 | |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17212 | #define alc662_auto_init_input_src alc882_auto_init_input_src |
| 17213 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17214 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 17215 | { |
| 17216 | struct alc_spec *spec = codec->spec; |
| 17217 | int err; |
| 17218 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 17219 | |
| 17220 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 17221 | alc662_ignore); |
| 17222 | if (err < 0) |
| 17223 | return err; |
| 17224 | if (!spec->autocfg.line_outs) |
| 17225 | return 0; /* can't find valid BIOS pin config */ |
| 17226 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17227 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 17228 | if (err < 0) |
| 17229 | return err; |
| 17230 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 17231 | if (err < 0) |
| 17232 | return err; |
| 17233 | err = alc662_auto_create_extra_out(spec, |
| 17234 | spec->autocfg.speaker_pins[0], |
| 17235 | "Speaker"); |
| 17236 | if (err < 0) |
| 17237 | return err; |
| 17238 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 17239 | "Headphone"); |
| 17240 | if (err < 0) |
| 17241 | return err; |
Takashi Iwai | 2d864c4 | 2009-03-20 12:52:47 +0100 | [diff] [blame] | 17242 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 17243 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17244 | return err; |
| 17245 | |
| 17246 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 17247 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 17248 | if (spec->autocfg.dig_outs) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17249 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 17250 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 17251 | if (spec->kctls.list) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17252 | add_mixer(spec, spec->kctls.list); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17253 | |
| 17254 | spec->num_mux_defs = 1; |
Herton Ronaldo Krzesinski | 61b9b9b | 2009-01-28 09:16:33 -0200 | [diff] [blame] | 17255 | spec->input_mux = &spec->private_imux[0]; |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 17256 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17257 | add_verb(spec, alc662_auto_init_verbs); |
Takashi Iwai | 24fb917 | 2008-09-02 14:48:20 +0200 | [diff] [blame] | 17258 | if (codec->vendor_id == 0x10ec0663) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 17259 | add_verb(spec, alc663_auto_init_verbs); |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 17260 | |
| 17261 | err = alc_auto_add_mic_boost(codec); |
| 17262 | if (err < 0) |
| 17263 | return err; |
| 17264 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 17265 | alc_ssid_check(codec, 0x15, 0x1b, 0x14); |
| 17266 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17267 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17268 | } |
| 17269 | |
| 17270 | /* additional initialization for auto-configuration model */ |
| 17271 | static void alc662_auto_init(struct hda_codec *codec) |
| 17272 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17273 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17274 | alc662_auto_init_multi_out(codec); |
| 17275 | alc662_auto_init_hp_out(codec); |
| 17276 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f511b01 | 2008-08-15 16:46:42 +0200 | [diff] [blame] | 17277 | alc662_auto_init_input_src(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 17278 | if (spec->unsol_event) |
Kailang Yang | 7fb0d78 | 2008-10-15 11:12:35 +0200 | [diff] [blame] | 17279 | alc_inithook(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17280 | } |
| 17281 | |
| 17282 | static int patch_alc662(struct hda_codec *codec) |
| 17283 | { |
| 17284 | struct alc_spec *spec; |
| 17285 | int err, board_config; |
| 17286 | |
| 17287 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 17288 | if (!spec) |
| 17289 | return -ENOMEM; |
| 17290 | |
| 17291 | codec->spec = spec; |
| 17292 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 17293 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 17294 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17295 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 17296 | alc662_models, |
| 17297 | alc662_cfg_tbl); |
| 17298 | if (board_config < 0) { |
Takashi Iwai | 6c627f3 | 2009-05-18 12:33:36 +0200 | [diff] [blame] | 17299 | printk(KERN_INFO "hda_codec: Unknown model for %s, " |
| 17300 | "trying auto-probe from BIOS...\n", codec->chip_name); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17301 | board_config = ALC662_AUTO; |
| 17302 | } |
| 17303 | |
| 17304 | if (board_config == ALC662_AUTO) { |
| 17305 | /* automatic parse from the BIOS config */ |
| 17306 | err = alc662_parse_auto_config(codec); |
| 17307 | if (err < 0) { |
| 17308 | alc_free(codec); |
| 17309 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 17310 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17311 | printk(KERN_INFO |
| 17312 | "hda_codec: Cannot set up configuration " |
| 17313 | "from BIOS. Using base mode...\n"); |
| 17314 | board_config = ALC662_3ST_2ch_DIG; |
| 17315 | } |
| 17316 | } |
| 17317 | |
Kusanagi Kouichi | 680cd53 | 2009-02-05 00:00:58 +0900 | [diff] [blame] | 17318 | err = snd_hda_attach_beep_device(codec, 0x1); |
| 17319 | if (err < 0) { |
| 17320 | alc_free(codec); |
| 17321 | return err; |
| 17322 | } |
| 17323 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17324 | if (board_config != ALC662_AUTO) |
| 17325 | setup_preset(spec, &alc662_presets[board_config]); |
| 17326 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17327 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 17328 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 17329 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17330 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 17331 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 17332 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 17333 | spec->adc_nids = alc662_adc_nids; |
| 17334 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 17335 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17336 | |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17337 | if (!spec->cap_mixer) |
| 17338 | set_capture_mixer(spec); |
Takashi Iwai | b959144 | 2009-03-16 15:25:00 +0100 | [diff] [blame] | 17339 | if (codec->vendor_id == 0x10ec0662) |
| 17340 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 17341 | else |
| 17342 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 17343 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 17344 | spec->vmaster_nid = 0x02; |
| 17345 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17346 | codec->patch_ops = alc_patch_ops; |
| 17347 | if (board_config == ALC662_AUTO) |
| 17348 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 17349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 17350 | if (!spec->loopback.amplist) |
| 17351 | spec->loopback.amplist = alc662_loopbacks; |
| 17352 | #endif |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 17353 | codec->proc_widget_hook = print_realtek_coef; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17354 | |
| 17355 | return 0; |
| 17356 | } |
| 17357 | |
| 17358 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17359 | * patch entries |
| 17360 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17361 | static struct hda_codec_preset snd_hda_preset_realtek[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17362 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17363 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17364 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 17365 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 17366 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 17367 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17368 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17369 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17370 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 17371 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 17372 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17373 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17374 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 17375 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 17376 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 17377 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 17378 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17379 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17380 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 17381 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17382 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 17383 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17384 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 17385 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17386 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 17387 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550 | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 17388 | .patch = patch_alc882 }, |
| 17389 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
| 17390 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17391 | {} /* terminator */ |
| 17392 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 17393 | |
| 17394 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 17395 | |
| 17396 | MODULE_LICENSE("GPL"); |
| 17397 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 17398 | |
| 17399 | static struct hda_codec_preset_list realtek_list = { |
| 17400 | .preset = snd_hda_preset_realtek, |
| 17401 | .owner = THIS_MODULE, |
| 17402 | }; |
| 17403 | |
| 17404 | static int __init patch_realtek_init(void) |
| 17405 | { |
| 17406 | return snd_hda_add_codec_preset(&realtek_list); |
| 17407 | } |
| 17408 | |
| 17409 | static void __exit patch_realtek_exit(void) |
| 17410 | { |
| 17411 | snd_hda_delete_codec_preset(&realtek_list); |
| 17412 | } |
| 17413 | |
| 17414 | module_init(patch_realtek_init) |
| 17415 | module_exit(patch_realtek_exit) |